diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/Client.java b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/Client.java index 884f2ae0e..e57773ec8 100644 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/Client.java +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/Client.java @@ -5,32 +5,74 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; import java.net.HttpURLConnection; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; public class Client { - private static final Logger logger = LoggerFactory.getLogger(Client.class); + private static final Logger LOGGER = LoggerFactory.getLogger(Client.class); + + public static final String PROXY_TIMESTAMP_HEADER = "proxy"; + + public static final String NODE_TIMESTAMP_HEADER = "node"; + + private static final byte[] EMPTY_BODY = new byte[0]; private final HttpClient httpClient; private String url; private long timeStamp; - public static final String PROXY_TIMESTAMP_HEADER = "proxy"; + private final ExecutorService proxyExecutor; - public static final String NODE_TIMESTAMP_HEADER = "node"; + Client(ExecutorService proxyExecutor) { + this.httpClient = HttpClient.newBuilder().build(); + this.proxyExecutor = proxyExecutor; + } + + public CompletableFuture handleProxyRequest(Request request) { + CompletableFuture> responseFuture = getProxyResponse(request); + return responseFuture.thenApplyAsync(response -> { + if (response == null) { + return new Response(Response.INTERNAL_ERROR, Response.EMPTY); + } + String statusCode = switch (response.statusCode()) { + case HttpURLConnection.HTTP_OK -> Response.OK; + case HttpURLConnection.HTTP_CREATED -> Response.CREATED; + case HttpURLConnection.HTTP_ACCEPTED -> Response.ACCEPTED; + case HttpURLConnection.HTTP_BAD_REQUEST -> Response.BAD_REQUEST; + case HttpURLConnection.HTTP_NOT_FOUND -> Response.NOT_FOUND; + case HttpURLConnection.HTTP_INTERNAL_ERROR -> Response.INTERNAL_ERROR; + default -> throw new IllegalStateException("Unexpected value: " + response.statusCode()); + }; + Optional nodeHeader = response.headers().firstValue(NODE_TIMESTAMP_HEADER); + Response finalResponse = new Response(statusCode, response.body()); + if (nodeHeader.isPresent()) { + long time = Long.parseLong(nodeHeader.get()); + finalResponse.addHeader(Client.NODE_TIMESTAMP_HEADER + ":" + time); + } + return finalResponse; + }, proxyExecutor).exceptionally(throwable -> { + LOGGER.error("can't reach target node", throwable); + return new Response(Response.INTERNAL_ERROR, Response.EMPTY); + }); + } + + public void setUrl(String url) { + this.url = url; + } - Client() { - httpClient = HttpClient.newBuilder().build(); + public void setTimeStamp(long timeStamp) { + this.timeStamp = timeStamp; } private byte[] getRequestBody(Request request) { - return request.getBody() == null ? new byte[0] : request.getBody(); + return request.getBody() == null ? EMPTY_BODY : request.getBody(); } private HttpRequest getProxyRequest(Request request) { @@ -41,47 +83,8 @@ private HttpRequest getProxyRequest(Request request) { .build(); } - private HttpResponse getProxyResponse(Request request) { - try { - return httpClient.send(getProxyRequest(request), - HttpResponse.BodyHandlers.ofByteArray()); - } catch (IOException e) { - logger.error("can't reach target node"); - return null; - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - logger.error("can't reach target node"); - return null; - } - } - - public Response handleProxyRequest(Request request) { - HttpResponse response = getProxyResponse(request); - if (response == null) { - return null; - } - String statusCode = switch (response.statusCode()) { - case HttpURLConnection.HTTP_OK -> Response.OK; - case HttpURLConnection.HTTP_CREATED -> Response.CREATED; - case HttpURLConnection.HTTP_ACCEPTED -> Response.ACCEPTED; - case HttpURLConnection.HTTP_BAD_REQUEST -> Response.BAD_REQUEST; - case HttpURLConnection.HTTP_NOT_FOUND -> Response.NOT_FOUND; - default -> throw new IllegalStateException("Unexpected value: " + response.statusCode()); - }; - Optional nodeHeader = response.headers().firstValue(NODE_TIMESTAMP_HEADER); - Response finalResponse = new Response(statusCode, response.body()); - if (nodeHeader.isPresent()) { - long time = Long.parseLong(nodeHeader.get()); - finalResponse.addHeader(Client.NODE_TIMESTAMP_HEADER + ":" + time); - } - return finalResponse; - } - - public void setUrl(String url) { - this.url = url; - } - - public void setTimeStamp(long timeStamp) { - this.timeStamp = timeStamp; + private CompletableFuture> getProxyResponse(Request request) { + return httpClient.sendAsync(getProxyRequest(request), + HttpResponse.BodyHandlers.ofByteArray()); } } diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/ServerImplementation.java b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/ServerImplementation.java index b95fac5dd..30ebc54c4 100644 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/ServerImplementation.java +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/ServerImplementation.java @@ -24,19 +24,22 @@ import java.util.Map; import java.util.TreeMap; import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReference; import static one.nio.util.Hash.murmur3; public class ServerImplementation extends HttpServer { - private static final Logger logger = LoggerFactory.getLogger(ServerImplementation.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ServerImplementation.class); private static final String ENTITY_PATH = "/v0/entity"; - private static final String REQUEST_KEY = "id="; private static final String FROM_PARAMETER = "from="; @@ -49,11 +52,15 @@ public class ServerImplementation extends HttpServer { private static final int POOL_KEEP_ALIVE_SECONDS = 10; - private static final int THREAD_POOL_QUEUE_SIZE = 64; + private static final int THREAD_POOL_QUEUE_SIZE = 512; + private static final int INTERNAL_ERROR_STATUS = 500; private final MemorySegmentDao memorySegmentDao; private final ExecutorService executor; + private final ExecutorService aggregator; + + private final ExecutorService proxyExecutor; private final ServiceConfig config; private final Client client; @@ -61,22 +68,38 @@ public class ServerImplementation extends HttpServer { public ServerImplementation(ServiceConfig config, MemorySegmentDao memorySegmentDao) throws IOException { super(createServerConfig(config)); this.config = config; - this.client = new Client(); this.memorySegmentDao = memorySegmentDao; - this.executor = new ThreadPoolExecutor(THREAD_POOL_SIZE, - THREAD_POOL_SIZE, + this.executor = new ThreadPoolExecutor(THREAD_POOL_SIZE / 2, + THREAD_POOL_SIZE / 2, POOL_KEEP_ALIVE_SECONDS, TimeUnit.SECONDS, new ArrayBlockingQueue<>(THREAD_POOL_QUEUE_SIZE), new CustomThreadFactory("worker", true), - new ThreadPoolExecutor.AbortPolicy()); + new ThreadPoolExecutor.CallerRunsPolicy()); ((ThreadPoolExecutor) executor).prestartAllCoreThreads(); + this.proxyExecutor = new ThreadPoolExecutor(THREAD_POOL_SIZE / 2, + THREAD_POOL_SIZE / 2, + POOL_KEEP_ALIVE_SECONDS, + TimeUnit.SECONDS, + new ArrayBlockingQueue<>(THREAD_POOL_QUEUE_SIZE), + new CustomThreadFactory("proxy-worker", true), + new ThreadPoolExecutor.CallerRunsPolicy()); + this.client = new Client(proxyExecutor); + this.aggregator = new ThreadPoolExecutor(2, + 2, + POOL_KEEP_ALIVE_SECONDS, + TimeUnit.SECONDS, + new ArrayBlockingQueue<>(THREAD_POOL_QUEUE_SIZE / 2), + new CustomThreadFactory("aggregator", true), + new ThreadPoolExecutor.AbortPolicy()); } @Override public synchronized void stop() { super.stop(); executor.close(); + proxyExecutor.close(); + aggregator.close(); } @Override @@ -100,25 +123,24 @@ public void handleRequest(Request request, HttpSession session) throws IOExcepti session.sendResponse(response); return; } - int from = getValueFromRequest(request, FROM_PARAMETER, config.clusterUrls().size()); - int ack = getValueFromRequest(request, ACK_PARAMETER, (config.clusterUrls().size() - / 2) + 1); + int from = getValueFromRequest(request, FROM_PARAMETER); + int ack = getValueFromRequest(request, ACK_PARAMETER); if (ack == 0 || ack > from || from > config.clusterUrls().size()) { session.sendResponse(new Response(Response.BAD_REQUEST, Response.EMPTY)); return; } long timeNow = System.currentTimeMillis(); List url = getTargetNodesUrls(id, from); - List responses = collectResponses(request, from, url, id, timeNow); - Response finalResponse = aggregateResponses(responses, ack); - session.sendResponse(finalResponse); + List> responses = collectResponses(request, from, url, id, timeNow); + AtomicReference finalResponse = new AtomicReference<>(null); + aggregateResponses(responses, ack, finalResponse, session); } catch (Exception e) { - logger.error("Exception in request method", e); + LOGGER.error("Exception in request method", e); sendErrorResponse(session, Response.INTERNAL_ERROR); } }); } catch (RejectedExecutionException exception) { - logger.error("ThreadPool queue overflow", exception); + LOGGER.error("ThreadPool queue overflow", exception); sendErrorResponse(session, Response.SERVICE_UNAVAILABLE); } @@ -134,7 +156,7 @@ private static void sendErrorResponse(HttpSession session, String error) { try { session.sendResponse(new Response(error, Response.EMPTY)); } catch (IOException ex) { - logger.error("can't send response", ex); + LOGGER.error("can't send response", ex); session.close(); } } @@ -222,18 +244,28 @@ private int getCustomHashCode(String key, int nodeNumber) { return murmur3(key + nodeNumber); } - private int getValueFromRequest(Request request, String parameter, int defaultValue) { + private int getValueFromRequest(Request request, String parameter) { String value = request.getParameter(parameter); if (value == null) { - return defaultValue; + if (parameter.equals(FROM_PARAMETER)) { + return config.clusterUrls().size(); + } else if (parameter.equals(ACK_PARAMETER)) { + return (config.clusterUrls().size() / 2) + 1; + } } else return Integer.parseInt(value); + return 0; } - private List collectResponses(Request request, int from, List url, String id, long timeNow) { - List responses = new ArrayList<>(from); + private List> collectResponses(Request request, int from, List url, String id, + long timeNow) { + List> responses = new ArrayList<>(from); for (int i = 0; i < from; i++) { if (url.get(i).equals(config.selfUrl())) { - responses.add(handleNodeRequest(request, id, timeNow)); + responses.add(CompletableFuture.supplyAsync(() -> handleNodeRequest(request, id, timeNow), executor) + .exceptionally(throwable -> { + LOGGER.error("future exception", throwable); + return new Response(Response.INTERNAL_ERROR, Response.EMPTY); + })); } else { client.setUrl(url.get(i)); client.setTimeStamp(timeNow); @@ -243,32 +275,67 @@ private List collectResponses(Request request, int from, List return responses; } - private Response aggregateResponses(List responses, int ack) { - int successResponses = 0; - Response finalResponse = null; - long finalTime = 0; - for (Response response : responses) { - if (response == null) { - continue; - } - String dataHeader = response.getHeader(Client.NODE_TIMESTAMP_HEADER + ":"); - if (dataHeader != null) { - long headerTime = Long.parseLong(dataHeader); - if (headerTime >= finalTime) { - finalTime = headerTime; - finalResponse = response; + private void aggregateResponses(List> responses, int ack, + AtomicReference finalResponse, HttpSession session) { + AtomicInteger successResponses = new AtomicInteger(0); + AtomicLong finalTime = new AtomicLong(0); + AtomicInteger completedFuturesCount = new AtomicInteger(0); + for (CompletableFuture responseFuture : responses) { + responseFuture.whenCompleteAsync((response, throwable) -> { + if (throwable != null) { + LOGGER.error("error complete future", throwable); + return; } - } else { - if (finalResponse == null) { - finalResponse = response; + if (ack == successResponses.get()) { + return; } - } - successResponses++; + validateResponse(finalResponse, response, finalTime, successResponses); + handleResponses(responses, ack, finalResponse, session, successResponses, completedFuturesCount); + }, aggregator).exceptionally(throwable -> { + LOGGER.error("future exception", throwable); + return new Response(Response.INTERNAL_ERROR, Response.EMPTY); + }); } - if (successResponses >= ack) { - return finalResponse; + } + + private static void validateResponse(AtomicReference finalResponse, Response response, + AtomicLong finalTime, AtomicInteger successResponses) { + String dataHeader = response.getHeader(Client.NODE_TIMESTAMP_HEADER + ":"); + if (dataHeader != null) { + long headerTime = Long.parseLong(dataHeader); + if (finalTime.compareAndSet(finalTime.get(), headerTime)) { + finalResponse.compareAndSet(finalResponse.get(), response); + } + successResponses.incrementAndGet(); } else { - return new Response(NOT_ENOUGH_REPLICAS, Response.EMPTY); + if (response.getStatus() != INTERNAL_ERROR_STATUS) { + finalResponse.set(response); + successResponses.incrementAndGet(); + } + } + } + + private static void handleResponses(List> responses, int ack, + AtomicReference finalResponse, HttpSession session, + AtomicInteger successResponses, AtomicInteger completedFuture) { + if (successResponses.get() == ack) { + try { + session.sendResponse(finalResponse.get()); + } catch (IOException e) { + LOGGER.error("error sent final response", e); + session.close(); + } + return; + } + completedFuture.incrementAndGet(); + if (successResponses.get() < ack && completedFuture.get() == responses.size()) { + finalResponse.set(new Response(NOT_ENOUGH_REPLICAS, Response.EMPTY)); + try { + session.sendResponse(finalResponse.get()); + } catch (IOException e) { + LOGGER.error("error sent final response", e); + session.close(); + } } } } diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/ServiceImplementation.java b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/ServiceImplementation.java index acb547385..a2bfa9d4a 100644 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/ServiceImplementation.java +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/ServiceImplementation.java @@ -52,7 +52,7 @@ public CompletableFuture stop() throws IOException { return CompletableFuture.completedFuture(null); } - @ServiceFactory(stage = 4) + @ServiceFactory(stage = 5) public static class Factory implements ServiceFactory.Factory { @Override diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_1000rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_1000rs_alloc.html deleted file mode 100644 index 27cadb153..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_1000rs_alloc.html +++ /dev/null @@ -1,547 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_1000rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_1000rs_cpu.html deleted file mode 100644 index 02637c0ab..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_1000rs_cpu.html +++ /dev/null @@ -1,1112 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_3700rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_3700rs_alloc.html deleted file mode 100644 index 768d6ac46..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_3700rs_alloc.html +++ /dev/null @@ -1,560 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_3700rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_3700rs_cpu.html deleted file mode 100644 index 1b8ee31df..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/get_3700rs_cpu.html +++ /dev/null @@ -1,1221 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_19600rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_19600rs_alloc.html deleted file mode 100644 index 79327e9e0..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_19600rs_alloc.html +++ /dev/null @@ -1,412 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_19600rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_19600rs_cpu.html deleted file mode 100644 index 48b02e623..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_19600rs_cpu.html +++ /dev/null @@ -1,1405 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_5000rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_5000rs_alloc.html deleted file mode 100644 index 5f82fd3a7..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_5000rs_alloc.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_5000rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_5000rs_cpu.html deleted file mode 100644 index 69146301b..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage1/put_5000rs_cpu.html +++ /dev/null @@ -1,1009 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_get_18100rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_get_18100rs_alloc.html deleted file mode 100644 index 07ce27fc4..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_get_18100rs_alloc.html +++ /dev/null @@ -1,589 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_get_18100rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_get_18100rs_cpu.html deleted file mode 100644 index d2d04e38d..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_get_18100rs_cpu.html +++ /dev/null @@ -1,2688 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_put_53000rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_put_53000rs_alloc.html deleted file mode 100644 index a909d7319..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_put_53000rs_alloc.html +++ /dev/null @@ -1,476 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_put_53000rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_put_53000rs_cpu.html deleted file mode 100644 index ac961eec6..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/ArrayQueue_sise64_put_53000rs_cpu.html +++ /dev/null @@ -1,2168 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/linkedBlockingQueue_size64_get_17950rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/linkedBlockingQueue_size64_get_17950rs_alloc.html deleted file mode 100644 index b43638eb1..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/linkedBlockingQueue_size64_get_17950rs_alloc.html +++ /dev/null @@ -1,612 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/linkedBlockingQueue_size64_get_17950rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/linkedBlockingQueue_size64_get_17950rs_cpu.html deleted file mode 100644 index d93f53ec8..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/linkedBlockingQueue_size64_get_17950rs_cpu.html +++ /dev/null @@ -1,3036 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/linkedBlockingQueue_size64_put_50050rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/linkedBlockingQueue_size64_put_50050rs_cpu.html deleted file mode 100644 index 6e235f3c1..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/linkedBlockingQueue_size64_put_50050rs_cpu.html +++ /dev/null @@ -1,2632 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue__put_2500rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue__put_2500rs_cpu.html deleted file mode 100644 index e816a6d47..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue__put_2500rs_cpu.html +++ /dev/null @@ -1,1198 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue_put_2000rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue_put_2000rs_alloc.html deleted file mode 100644 index 68cf19aaa..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue_put_2000rs_alloc.html +++ /dev/null @@ -1,604 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue_put_2000rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue_put_2000rs_cpu.html deleted file mode 100644 index b32af111c..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue_put_2000rs_cpu.html +++ /dev/null @@ -1,1649 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue_put_2500rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue_put_2500rs_alloc.html deleted file mode 100644 index e44cbe19a..000000000 --- a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/profiler_results/stage2/synchronousQueue_put_2500rs_alloc.html +++ /dev/null @@ -1,419 +0,0 @@ - - - - - - - -

Flame Graph

-
  
-
Produced by async-profiler
- -
-

-

Matched:

- diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/get_6000rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/get_6000rs_alloc.html new file mode 100644 index 000000000..557b4a384 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/get_6000rs_alloc.html @@ -0,0 +1,3770 @@ + + + + + + + +

Flame Graph

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/get_6000rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/get_6000rs_cpu.html new file mode 100644 index 000000000..5bc3018ee --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/get_6000rs_cpu.html @@ -0,0 +1,15595 @@ + + + + + + + +

Flame Graph

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/get_6000rs_lock.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/get_6000rs_lock.html new file mode 100644 index 000000000..037792ffb --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/get_6000rs_lock.html @@ -0,0 +1,1145 @@ + + + + + + + +

Flame Graph

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/put_6800rs_alloc.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/put_6800rs_alloc.html new file mode 100644 index 000000000..1beba30b4 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/put_6800rs_alloc.html @@ -0,0 +1,3500 @@ + + + + + + + +

Flame Graph

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/put_6800rs_cpu.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/put_6800rs_cpu.html new file mode 100644 index 000000000..8b7c9f91f --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/put_6800rs_cpu.html @@ -0,0 +1,15292 @@ + + + + + + + +

Flame Graph

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/put_6800rs_lock.html b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/put_6800rs_lock.html new file mode 100644 index 000000000..731c3d670 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/profiler_results/stage5/put_6800rs_lock.html @@ -0,0 +1,1018 @@ + + + + + + + +

Flame Graph

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/stage5/get_6000rs_1min.png b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/stage5/get_6000rs_1min.png new file mode 100644 index 000000000..6d2ce97a5 Binary files /dev/null and b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/stage5/get_6000rs_1min.png differ diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/stage5/put_6800rs_1min.png b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/stage5/put_6800rs_1min.png new file mode 100644 index 000000000..695ba64e5 Binary files /dev/null and b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/stage5/put_6800rs_1min.png differ diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/stage5/report.md b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/stage5/report.md new file mode 100644 index 000000000..bd211b6eb --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/reports/stage5/report.md @@ -0,0 +1,132 @@ +## Описание исследований + +Все исследования проводились для кластера из 3 нод. На целевую ноду поступали запросы без указания ack и from. +Таким образом ack = 2 и from = 3. Это симулирует ситуацию, когда пользователю максимально важно сохранить данные и +получить самые свежие из них + +## put + +1. 6800 запросов в секунду в течение 1 минуты: + Найдена точка разладки. Latency всех запросов не превышает 100 мс. Точка разладки не изменилась по сравнению с + прошлым этапом + На последних 10 персентиль наблюдается плавное возрастание latency. + ![put_6800rs_1min.png](put_6800rs_1min.png) + +2. 6900 запросов в секунду в течение 1 минуты: + +``` + 50.000% 32.80ms + 75.000% 135.42ms + 90.000% 211.97ms + 99.000% 305.92ms + 99.900% 355.58ms + 99.990% 390.14ms + 99.999% 397.57ms +100.000% 400.13ms +``` + +На последних 30 персентиль наблюдается резкий скачёк latency, время выполнения всех запросов уже превышает 100мс. + +### cpu profiling + +Теперь на работу сетевых потоков требуется 55% ресурсов процессора вместо 39% для прошлого этапа. Это связано +с добавлением 14% из-за CompletableFuture.asyncSupply.run +На обработку перенаправления запроса уходит 4% ресурсов процессора, 8 % на SelectorManager. Заметно уменьшилось +количество семплов в ключевых методах по обработке запросов за счет их увеличения в сетевых потоках. +![cpu](../profiler_results/stage5/put_6800rs_cpu.html) + +### alloc profiling + +![alloc](../profiler_results/stage5/put_6800rs_alloc.html) +Появилось 37% новых аллокаций в сетевых потоках из-за CompletableFuture.asyncSupply.run +Вместо 62% аллокаций в ключевых методах по обработке запросов их стало 23% + +### lock profiling + +![lock](../profiler_results/stage5/put_6800rs_lock.html) +Большую часть находятся в ожидании сетевые потоки - 96% вместо 52% с прошлого этапа +из-за добавления к SequentialScheduler(60%) ожидания при CompletableFuture.asyncSupply.run (36%) + +## get + +1. 6000 запросов в секунду в течение 1 минуты: + Найдена точка разладки. Latency всех запросов не превышает 100 мс. + На последних 10 персентиль наблюдается резкое возрастание latency. + ![get_6000rs_1min.png](get_6000rs_1min.png) + +2. 6100 запросов в секунду в течение 1 минуты: + +``` + 50.000% 7.38ms + 75.000% 9.48ms + 90.000% 14.29ms + 99.000% 51.04ms + 99.900% 102.72ms + 99.990% 133.25ms + 99.999% 138.11ms +100.000% 140.03ms +``` +На последнем персентиль наблюдается резкий скачёк latency, время выполнения всех запросов уже превышает 100мс. + +### cpu profiling + +![cpu](../profiler_results/stage5/get_6000rs_cpu.html) +Теперь на работу сетевых потоков требуется 45% ресурсов процессора вместо 30% для прошлого этапа. Это связано +с добавлением 12% из-за CompletableFuture.asyncSupply.run +На обработку перенаправления запроса уходит 3% ресурсов процессора, 7 % на SelectorManager. Заметно уменьшилось +количество семплов в ключевых методах по обработке запросов за счет их увеличения в сетевых потоках. +### alloc profiling + +![alloc](../profiler_results/stage5/get_6000rs_alloc.html) +Появилось 19% новых аллокаций в сетевых потоках из-за CompletableFuture.asyncSupply.run +Вместо 83% аллокаций в ключевых методах по обработке запросов их стало 63% +### lock profiling + +![lock](../profiler_results/stage5/get_6000rs_lock.html) +Большую часть находятся в ожидании сетевые потоки - 97% вместо 53% с прошлого этапа +из-за добавления к SequentialScheduler(62%) ожидания при CompletableFuture.asyncSupply.run (35%) + + +## Сравнение с прошлым этапом + +### PUT + +Точка разладки не изменилась и осталась 6800 запросов в секунду +Сравним результаты с прошлым этапом в этой же точке разладки: + +``` + было стало +50.000 8.32ms 3.40ms +75.000 30.13ms 10.46ms +90.000 48.10ms 19.82ms +99.000 72.45ms 41.02ms +99.900 84.03ms 56.29ms +99.990 90.37ms 64.67ms +99.999 94.27ms 69.69ms +100.000 96.13ms 71.61ms +``` + +### GET + +Точка разладки сместилась на 600 запросов в секунду в большую сторону по сравнению с прошлым этапом +(была 5400, а стала 6000). +Возьмем и замерим результаты реализации этого этапа в точке разладки прошлого: + +``` + было стало +50.000 5.11ms 2.62ms +75.000 6.94ms 3.35ms +90.000 9.53ms 4.58ms +99.000 39.78ms 9.00ms +99.900 45.66ms 16.26ms +99.990% 48.70ms 23.22ms +99.999% 50.72ms 29.69ms +100.000% 51.20ms 32.13ms +``` + +## Выводы + +Текущая реализация стала держать больше get и столько же put-запросов и стала быстрее. Из профилей видно, что +процентное соотношение всех семплов значительно изменилось, участки целевых методов по обработке запросов стали +занимать меньше семплов, а эту разницу на себя взяли сетевые потоки при выполнении CompletableFuture. Теперь сервер +может быстрее отправить запрос пользователю, не дожидаясь ответа всех нод - основная причина ускорения get-запросов. \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/get_6000rs_1min.txt b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/get_6000rs_1min.txt new file mode 100644 index 000000000..3d54d14ea --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/get_6000rs_1min.txt @@ -0,0 +1,121 @@ +dmitrij@PC ~/D/j/wrk2 (master)> ./wrk -d 60 -t 1 -c 64 -R 6000 -L -s /home/dmitrij/Documents/javaProjects/2024-highload-dht/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_scripts/get.lua http://localhost:8080 +Running 1m test @ http://localhost:8080 + 1 threads and 64 connections + Thread calibration: mean lat.: 7.121ms, rate sampling interval: 28ms + Thread Stats Avg Stdev Max +/- Stdev + Latency 5.98ms 6.36ms 48.51ms 85.26% + Req/Sec 5.04k 1.20k 9.48k 73.06% + Latency Distribution (HdrHistogram - Recorded Latency) + 50.000% 3.23ms + 75.000% 6.94ms + 90.000% 15.85ms + 99.000% 28.50ms + 99.900% 36.48ms + 99.990% 42.53ms + 99.999% 46.88ms +100.000% 48.54ms + + Detailed Percentile spectrum: + Value Percentile TotalCount 1/(1-Percentile) + + 0.363 0.000000 1 1.00 + 1.430 0.100000 24575 1.11 + 1.905 0.200000 49150 1.25 + 2.303 0.300000 73817 1.43 + 2.707 0.400000 98314 1.67 + 3.229 0.500000 122934 2.00 + 3.591 0.550000 135187 2.22 + 4.071 0.600000 147457 2.50 + 4.715 0.650000 159773 2.86 + 5.619 0.700000 172022 3.33 + 6.939 0.750000 184297 4.00 + 7.847 0.775000 190422 4.44 + 9.039 0.800000 196571 5.00 + 10.511 0.825000 202703 5.71 + 12.175 0.850000 208861 6.67 + 13.959 0.875000 214992 8.00 + 14.887 0.887500 218065 8.89 + 15.855 0.900000 221133 10.00 + 16.943 0.912500 224248 11.43 + 18.063 0.925000 227302 13.33 + 19.311 0.937500 230371 16.00 + 19.983 0.943750 231879 17.78 + 20.703 0.950000 233427 20.00 + 21.471 0.956250 234967 22.86 + 22.367 0.962500 236486 26.67 + 23.343 0.968750 238048 32.00 + 23.855 0.971875 238793 35.56 + 24.463 0.975000 239566 40.00 + 25.135 0.978125 240332 45.71 + 25.823 0.981250 241102 53.33 + 26.623 0.984375 241862 64.00 + 27.071 0.985938 242245 71.11 + 27.551 0.987500 242634 80.00 + 28.143 0.989062 243026 91.43 + 28.751 0.990625 243395 106.67 + 29.487 0.992188 243784 128.00 + 29.855 0.992969 243972 142.22 + 30.319 0.993750 244165 160.00 + 30.895 0.994531 244357 182.86 + 31.487 0.995313 244546 213.33 + 32.175 0.996094 244739 256.00 + 32.495 0.996484 244834 284.44 + 32.895 0.996875 244931 320.00 + 33.343 0.997266 245026 365.71 + 33.759 0.997656 245124 426.67 + 34.303 0.998047 245220 512.00 + 34.591 0.998242 245266 568.89 + 34.975 0.998437 245316 640.00 + 35.487 0.998633 245362 731.43 + 35.999 0.998828 245412 853.33 + 36.607 0.999023 245461 1024.00 + 36.831 0.999121 245485 1137.78 + 37.151 0.999219 245507 1280.00 + 37.631 0.999316 245530 1462.86 + 38.111 0.999414 245554 1706.67 + 38.559 0.999512 245578 2048.00 + 38.815 0.999561 245590 2275.56 + 39.231 0.999609 245603 2560.00 + 39.551 0.999658 245614 2925.71 + 39.903 0.999707 245627 3413.33 + 40.159 0.999756 245638 4096.00 + 40.447 0.999780 245644 4551.11 + 40.863 0.999805 245650 5120.00 + 41.151 0.999829 245656 5851.43 + 41.343 0.999854 245662 6826.67 + 41.823 0.999878 245668 8192.00 + 42.495 0.999890 245671 9102.22 + 42.911 0.999902 245674 10240.00 + 43.167 0.999915 245677 11702.86 + 43.359 0.999927 245681 13653.33 + 43.519 0.999939 245683 16384.00 + 43.583 0.999945 245684 18204.44 + 44.287 0.999951 245686 20480.00 + 44.351 0.999957 245687 23405.71 + 44.575 0.999963 245689 27306.67 + 45.215 0.999969 245690 32768.00 + 45.311 0.999973 245691 36408.89 + 45.343 0.999976 245693 40960.00 + 45.343 0.999979 245693 46811.43 + 45.343 0.999982 245693 54613.33 + 45.695 0.999985 245694 65536.00 + 45.695 0.999986 245694 72817.78 + 46.879 0.999988 245695 81920.00 + 46.879 0.999989 245695 93622.86 + 46.879 0.999991 245695 109226.67 + 47.039 0.999992 245696 131072.00 + 47.039 0.999993 245696 145635.56 + 47.039 0.999994 245696 163840.00 + 47.039 0.999995 245696 187245.71 + 47.039 0.999995 245696 218453.33 + 48.543 0.999996 245697 262144.00 + 48.543 1.000000 245697 inf +#[Mean = 5.983, StdDeviation = 6.364] +#[Max = 48.512, Total count = 245697] +#[Buckets = 27, SubBuckets = 2048] +---------------------------------------------------------- + 306103 requests in 1.00m, 25.02MB read + Socket errors: connect 0, read 0, write 0, timeout 256 + Non-2xx or 3xx responses: 206738 +Requests/sec: 5101.64 +Transfer/sec: 427.06KB diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/get_6100rs_1min.txt b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/get_6100rs_1min.txt new file mode 100644 index 000000000..8c4978d1b --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/get_6100rs_1min.txt @@ -0,0 +1,122 @@ +dmitrij@PC ~/D/j/wrk2 (master)> ./wrk -d 60 -t 1 -c 64 -R 6100 -L -s /home/dmitrij/Documents/javaProjects/2024-highload-dht/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_scripts/get.lua http://localhost:8080 +Running 1m test @ http://localhost:8080 + 1 threads and 64 connections + Thread calibration: mean lat.: 17.602ms, rate sampling interval: 68ms + Thread Stats Avg Stdev Max +/- Stdev + Latency 9.43ms 8.95ms 139.90ms 93.38% + Req/Sec 5.90k 268.23 6.76k 69.33% + Latency Distribution (HdrHistogram - Recorded Latency) + 50.000% 7.38ms + 75.000% 9.48ms + 90.000% 14.29ms + 99.000% 51.04ms + 99.900% 102.72ms + 99.990% 133.25ms + 99.999% 138.11ms +100.000% 140.03ms + + Detailed Percentile spectrum: + Value Percentile TotalCount 1/(1-Percentile) + + 0.673 0.000000 1 1.00 + 4.463 0.100000 29081 1.11 + 5.563 0.200000 58175 1.25 + 6.243 0.300000 87307 1.43 + 6.811 0.400000 116438 1.67 + 7.379 0.500000 145389 2.00 + 7.687 0.550000 160049 2.22 + 8.023 0.600000 174449 2.50 + 8.415 0.650000 189073 2.86 + 8.879 0.700000 203635 3.33 + 9.479 0.750000 218197 4.00 + 9.855 0.775000 225347 4.44 + 10.311 0.800000 232621 5.00 + 10.895 0.825000 239941 5.71 + 11.663 0.850000 247139 6.67 + 12.719 0.875000 254418 8.00 + 13.407 0.887500 258052 8.89 + 14.287 0.900000 261677 10.00 + 15.415 0.912500 265307 11.43 + 16.959 0.925000 268964 13.33 + 19.135 0.937500 272586 16.00 + 20.591 0.943750 274392 17.78 + 22.287 0.950000 276215 20.00 + 24.271 0.956250 278029 22.86 + 26.639 0.962500 279844 26.67 + 29.471 0.968750 281662 32.00 + 31.167 0.971875 282566 35.56 + 33.215 0.975000 283481 40.00 + 35.615 0.978125 284387 45.71 + 38.431 0.981250 285292 53.33 + 41.855 0.984375 286207 64.00 + 43.807 0.985938 286657 71.11 + 46.239 0.987500 287111 80.00 + 49.119 0.989062 287565 91.43 + 52.799 0.990625 288021 106.67 + 57.503 0.992188 288474 128.00 + 59.775 0.992969 288701 142.22 + 62.207 0.993750 288929 160.00 + 65.279 0.994531 289153 182.86 + 68.543 0.995313 289384 213.33 + 72.127 0.996094 289610 256.00 + 74.687 0.996484 289722 284.44 + 77.311 0.996875 289836 320.00 + 80.575 0.997266 289948 365.71 + 85.119 0.997656 290063 426.67 + 89.919 0.998047 290176 512.00 + 91.903 0.998242 290233 568.89 + 94.399 0.998437 290290 640.00 + 97.151 0.998633 290346 731.43 + 100.031 0.998828 290403 853.33 + 103.103 0.999023 290462 1024.00 + 104.511 0.999121 290488 1137.78 + 106.111 0.999219 290516 1280.00 + 108.287 0.999316 290545 1462.86 + 111.295 0.999414 290573 1706.67 + 113.727 0.999512 290602 2048.00 + 115.839 0.999561 290616 2275.56 + 118.975 0.999609 290630 2560.00 + 121.023 0.999658 290644 2925.71 + 123.199 0.999707 290658 3413.33 + 125.759 0.999756 290673 4096.00 + 127.423 0.999780 290680 4551.11 + 128.959 0.999805 290687 5120.00 + 131.199 0.999829 290694 5851.43 + 131.711 0.999854 290701 6826.67 + 132.479 0.999878 290708 8192.00 + 132.735 0.999890 290713 9102.22 + 133.247 0.999902 290715 10240.00 + 133.631 0.999915 290719 11702.86 + 134.399 0.999927 290722 13653.33 + 135.167 0.999939 290726 16384.00 + 135.807 0.999945 290729 18204.44 + 135.807 0.999951 290729 20480.00 + 136.191 0.999957 290732 23405.71 + 136.575 0.999963 290735 27306.67 + 136.575 0.999969 290735 32768.00 + 136.703 0.999973 290736 36408.89 + 136.703 0.999976 290736 40960.00 + 136.831 0.999979 290737 46811.43 + 137.471 0.999982 290738 54613.33 + 137.983 0.999985 290739 65536.00 + 138.111 0.999986 290740 72817.78 + 138.111 0.999988 290740 81920.00 + 138.111 0.999989 290740 93622.86 + 138.751 0.999991 290741 109226.67 + 138.751 0.999992 290741 131072.00 + 139.135 0.999993 290742 145635.56 + 139.135 0.999994 290742 163840.00 + 139.135 0.999995 290742 187245.71 + 139.135 0.999995 290742 218453.33 + 139.135 0.999996 290742 262144.00 + 140.031 0.999997 290743 291271.11 + 140.031 1.000000 290743 inf +#[Mean = 9.428, StdDeviation = 8.950] +#[Max = 139.904, Total count = 290743] +#[Buckets = 27, SubBuckets = 2048] +---------------------------------------------------------- + 347344 requests in 1.00m, 28.44MB read + Socket errors: connect 0, read 0, write 0, timeout 60 + Non-2xx or 3xx responses: 233858 +Requests/sec: 5789.01 +Transfer/sec: 485.31KB diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/put_6800rs_1min.txt b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/put_6800rs_1min.txt new file mode 100644 index 000000000..3e6e5f35d --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/put_6800rs_1min.txt @@ -0,0 +1,122 @@ +dmitrij@PC ~/D/j/wrk2 (master)> ./wrk -d 60 -t 1 -c 64 -R 6800 -L -s /home/dmitrij/Documents/javaProjects/2024-highload-dht/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_scripts/put.lua http://localhost:8080 +Running 1m test @ http://localhost:8080 + 1 threads and 64 connections + Thread calibration: mean lat.: 18.198ms, rate sampling interval: 93ms + Thread Stats Avg Stdev Max +/- Stdev + Latency 7.65ms 8.87ms 71.55ms 85.99% + Req/Sec 5.90k 687.33 8.35k 72.61% + Latency Distribution (HdrHistogram - Recorded Latency) + 50.000% 3.40ms + 75.000% 10.46ms + 90.000% 19.82ms + 99.000% 41.02ms + 99.900% 56.29ms + 99.990% 64.67ms + 99.999% 69.69ms +100.000% 71.61ms + + Detailed Percentile spectrum: + Value Percentile TotalCount 1/(1-Percentile) + + 0.319 0.000000 1 1.00 + 1.396 0.100000 29153 1.11 + 1.827 0.200000 58341 1.25 + 2.225 0.300000 87541 1.43 + 2.663 0.400000 116614 1.67 + 3.403 0.500000 145745 2.00 + 4.053 0.550000 160289 2.22 + 5.063 0.600000 174877 2.50 + 6.563 0.650000 189442 2.86 + 8.367 0.700000 204032 3.33 + 10.463 0.750000 218595 4.00 + 11.639 0.775000 225864 4.44 + 12.903 0.800000 233152 5.00 + 14.263 0.825000 240427 5.71 + 15.847 0.850000 247724 6.67 + 17.631 0.875000 255005 8.00 + 18.671 0.887500 258676 8.89 + 19.823 0.900000 262281 10.00 + 21.151 0.912500 265950 11.43 + 22.671 0.925000 269576 13.33 + 24.447 0.937500 273203 16.00 + 25.487 0.943750 275020 17.78 + 26.623 0.950000 276862 20.00 + 27.935 0.956250 278665 22.86 + 29.439 0.962500 280507 26.67 + 31.135 0.968750 282315 32.00 + 32.095 0.971875 283218 35.56 + 33.119 0.975000 284146 40.00 + 34.367 0.978125 285057 45.71 + 35.679 0.981250 285965 53.33 + 37.279 0.984375 286868 64.00 + 38.239 0.985938 287329 71.11 + 39.167 0.987500 287775 80.00 + 40.319 0.989062 288227 91.43 + 41.535 0.990625 288690 106.67 + 42.975 0.992188 289136 128.00 + 43.679 0.992969 289364 142.22 + 44.543 0.993750 289596 160.00 + 45.343 0.994531 289823 182.86 + 46.591 0.995313 290054 213.33 + 47.839 0.996094 290280 256.00 + 48.511 0.996484 290387 284.44 + 49.279 0.996875 290504 320.00 + 50.111 0.997266 290619 365.71 + 50.943 0.997656 290730 426.67 + 52.351 0.998047 290846 512.00 + 52.991 0.998242 290899 568.89 + 53.727 0.998437 290957 640.00 + 54.495 0.998633 291013 731.43 + 55.487 0.998828 291071 853.33 + 56.351 0.999023 291128 1024.00 + 56.863 0.999121 291155 1137.78 + 57.695 0.999219 291185 1280.00 + 58.271 0.999316 291213 1462.86 + 58.975 0.999414 291241 1706.67 + 59.775 0.999512 291269 2048.00 + 60.447 0.999561 291283 2275.56 + 60.991 0.999609 291298 2560.00 + 61.599 0.999658 291313 2925.71 + 62.271 0.999707 291326 3413.33 + 62.847 0.999756 291341 4096.00 + 63.071 0.999780 291347 4551.11 + 63.295 0.999805 291355 5120.00 + 63.615 0.999829 291364 5851.43 + 63.999 0.999854 291369 6826.67 + 64.447 0.999878 291376 8192.00 + 64.543 0.999890 291379 9102.22 + 64.671 0.999902 291383 10240.00 + 65.119 0.999915 291387 11702.86 + 65.791 0.999927 291390 13653.33 + 66.303 0.999939 291394 16384.00 + 66.431 0.999945 291395 18204.44 + 66.815 0.999951 291397 20480.00 + 67.519 0.999957 291399 23405.71 + 68.223 0.999963 291401 27306.67 + 68.479 0.999969 291403 32768.00 + 68.479 0.999973 291403 36408.89 + 68.543 0.999976 291404 40960.00 + 69.247 0.999979 291405 46811.43 + 69.503 0.999982 291406 54613.33 + 69.631 0.999985 291407 65536.00 + 69.631 0.999986 291407 72817.78 + 69.695 0.999988 291408 81920.00 + 69.695 0.999989 291408 93622.86 + 69.951 0.999991 291409 109226.67 + 69.951 0.999992 291409 131072.00 + 69.951 0.999993 291409 145635.56 + 70.975 0.999994 291410 163840.00 + 70.975 0.999995 291410 187245.71 + 70.975 0.999995 291410 218453.33 + 70.975 0.999996 291410 262144.00 + 70.975 0.999997 291410 291271.11 + 71.615 0.999997 291411 327680.00 + 71.615 1.000000 291411 inf +#[Mean = 7.646, StdDeviation = 8.869] +#[Max = 71.552, Total count = 291411] +#[Buckets = 27, SubBuckets = 2048] +---------------------------------------------------------- + 357759 requests in 1.00m, 22.86MB read + Socket errors: connect 0, read 0, write 0, timeout 214 +Requests/sec: 5962.55 +Transfer/sec: 390.13KB diff --git a/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/put_6900rs_1min.txt b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/put_6900rs_1min.txt new file mode 100644 index 000000000..65c9d3d63 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_results/stage5/put_6900rs_1min.txt @@ -0,0 +1,123 @@ +dmitrij@PC ~/D/j/wrk2 (master)> ./wrk -d 60 -t 1 -c 64 -R 6900 -L -s /home/dmitrij/Documents/javaProjects/2024-highload-dht/src/main/java/ru/vk/itmo/test/tyapuevdmitrij/wrk2_scripts/put.lua http://localhost:8080 +Running 1m test @ http://localhost:8080 + 1 threads and 64 connections + Thread calibration: mean lat.: 114.905ms, rate sampling interval: 445ms + Thread Stats Avg Stdev Max +/- Stdev + Latency 76.58ms 84.55ms 399.87ms 80.55% + Req/Sec 6.63k 315.27 7.47k 75.68% + Latency Distribution (HdrHistogram - Recorded Latency) + 50.000% 32.80ms + 75.000% 135.42ms + 90.000% 211.97ms + 99.000% 305.92ms + 99.900% 355.58ms + 99.990% 390.14ms + 99.999% 397.57ms +100.000% 400.13ms + + Detailed Percentile spectrum: + Value Percentile TotalCount 1/(1-Percentile) + + 0.830 0.000000 1 1.00 + 3.643 0.100000 32876 1.11 + 6.979 0.200000 65748 1.25 + 12.119 0.300000 98627 1.43 + 20.207 0.400000 131497 1.67 + 32.799 0.500000 164406 2.00 + 43.039 0.550000 180792 2.22 + 61.311 0.600000 197207 2.50 + 87.807 0.650000 213674 2.86 + 112.319 0.700000 230090 3.33 + 135.423 0.750000 246526 4.00 + 147.071 0.775000 254745 4.44 + 158.591 0.800000 262996 5.00 + 170.623 0.825000 271213 5.71 + 183.679 0.850000 279406 6.67 + 197.375 0.875000 287621 8.00 + 204.671 0.887500 291731 8.89 + 211.967 0.900000 295799 10.00 + 219.519 0.912500 299907 11.43 + 227.711 0.925000 304025 13.33 + 237.055 0.937500 308132 16.00 + 242.303 0.943750 310217 17.78 + 247.807 0.950000 312244 20.00 + 253.823 0.956250 314328 22.86 + 260.479 0.962500 316349 26.67 + 268.031 0.968750 318435 32.00 + 271.871 0.971875 319439 35.56 + 276.479 0.975000 320500 40.00 + 281.343 0.978125 321515 45.71 + 286.719 0.981250 322502 53.33 + 293.119 0.984375 323567 64.00 + 296.447 0.985938 324066 71.11 + 299.775 0.987500 324571 80.00 + 303.615 0.989062 325092 91.43 + 307.711 0.990625 325604 106.67 + 312.319 0.992188 326114 128.00 + 314.879 0.992969 326363 142.22 + 317.695 0.993750 326626 160.00 + 320.767 0.994531 326880 182.86 + 324.607 0.995313 327123 213.33 + 328.447 0.996094 327383 256.00 + 330.751 0.996484 327522 284.44 + 332.799 0.996875 327643 320.00 + 335.615 0.997266 327774 365.71 + 338.687 0.997656 327902 426.67 + 342.271 0.998047 328025 512.00 + 344.575 0.998242 328087 568.89 + 346.623 0.998437 328154 640.00 + 349.439 0.998633 328215 731.43 + 352.511 0.998828 328284 853.33 + 356.351 0.999023 328344 1024.00 + 358.655 0.999121 328376 1137.78 + 360.703 0.999219 328407 1280.00 + 363.775 0.999316 328443 1462.86 + 366.079 0.999414 328472 1706.67 + 368.383 0.999512 328503 2048.00 + 369.919 0.999561 328521 2275.56 + 370.943 0.999609 328535 2560.00 + 372.735 0.999658 328552 2925.71 + 374.527 0.999707 328568 3413.33 + 376.831 0.999756 328584 4096.00 + 378.111 0.999780 328591 4551.11 + 380.159 0.999805 328600 5120.00 + 382.463 0.999829 328607 5851.43 + 385.023 0.999854 328615 6826.67 + 387.583 0.999878 328624 8192.00 + 389.887 0.999890 328628 9102.22 + 390.399 0.999902 328633 10240.00 + 391.423 0.999915 328635 11702.86 + 392.447 0.999927 328639 13653.33 + 393.983 0.999939 328645 16384.00 + 393.983 0.999945 328645 18204.44 + 394.239 0.999951 328647 20480.00 + 395.007 0.999957 328649 23405.71 + 395.775 0.999963 328651 27306.67 + 396.287 0.999969 328654 32768.00 + 396.287 0.999973 328654 36408.89 + 396.799 0.999976 328657 40960.00 + 396.799 0.999979 328657 46811.43 + 396.799 0.999982 328657 54613.33 + 397.055 0.999985 328659 65536.00 + 397.055 0.999986 328659 72817.78 + 397.055 0.999988 328659 81920.00 + 397.567 0.999989 328660 93622.86 + 397.567 0.999991 328660 109226.67 + 397.823 0.999992 328661 131072.00 + 397.823 0.999993 328661 145635.56 + 397.823 0.999994 328661 163840.00 + 398.847 0.999995 328662 187245.71 + 398.847 0.999995 328662 218453.33 + 398.847 0.999996 328662 262144.00 + 398.847 0.999997 328662 291271.11 + 398.847 0.999997 328662 327680.00 + 400.127 0.999997 328663 374491.43 + 400.127 1.000000 328663 inf +#[Mean = 76.575, StdDeviation = 84.552] +#[Max = 399.872, Total count = 328663] +#[Buckets = 27, SubBuckets = 2048] +---------------------------------------------------------- + 396737 requests in 1.00m, 25.35MB read + Socket errors: connect 0, read 0, write 0, timeout 68 +Requests/sec: 6612.33 +Transfer/sec: 432.64KB