diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/CustomHttpSession.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/CustomHttpSession.java new file mode 100644 index 000000000..e1d2ca94e --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/CustomHttpSession.java @@ -0,0 +1,96 @@ +package ru.vk.itmo.test.solnyshkoksenia; + +import one.nio.http.HttpServer; +import one.nio.http.HttpSession; +import one.nio.http.Response; +import one.nio.net.Socket; +import ru.vk.itmo.dao.Entry; + +import java.io.IOException; +import java.lang.foreign.MemorySegment; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.Iterator; + +public class CustomHttpSession extends HttpSession { + private static final byte[] CRLF = "\r\n".getBytes(StandardCharsets.UTF_8); + private static final byte[] LF = "\n".getBytes(StandardCharsets.UTF_8); + private static final byte[] EMPTY_CHUNK = "0\r\n\r\n".getBytes(StandardCharsets.UTF_8); + Iterator> iterator; + + public CustomHttpSession(Socket socket, HttpServer server) { + super(socket, server); + } + + @Override + protected void processWrite() throws Exception { + super.processWrite(); + nextChunk(); + } + + public void stream(Iterator> iterator) throws IOException { + this.iterator = iterator; + Response response = new Response(Response.OK); + response.addHeader("Transfer-Encoding: chunked"); + writeResponse(response, false); + + nextChunk(); + } + + private void nextChunk() throws IOException { + while (iterator.hasNext() && queueHead == null) { + Entry next = iterator.next(); + ByteBuffer key = next.key().asByteBuffer(); + ByteBuffer value = next.value().asByteBuffer(); + int payloadSize = key.remaining() + value.remaining() + LF.length; + String payloadSizeStr = Integer.toHexString(payloadSize); + byte[] payloadSizeStrBytes = payloadSizeStr.getBytes(StandardCharsets.UTF_8); + write(payloadSizeStrBytes, 0, payloadSizeStrBytes.length); + write(CRLF, 0, CRLF.length); + write(new ReferenceQueueItem(key)); + write(LF, 0, LF.length); + write(new ReferenceQueueItem(value)); + write(CRLF, 0, CRLF.length); + } + + if (!iterator.hasNext()) { + write(EMPTY_CHUNK, 0, EMPTY_CHUNK.length); + + if ((this.handling = pipeline.pollFirst()) != null) { + if (handling == FIN) { + scheduleClose(); + } else { + server.handleRequest(handling, this); + } + } + } + } + + public void sendError(Throwable e) { + log.error("Exception during handleRequest", e); + try { + sendResponse(new Response(Response.INTERNAL_ERROR, Response.EMPTY)); + } catch (IOException ex) { + log.error("Exception while sending close connection", e); + scheduleClose(); + } + } + + static class ReferenceQueueItem extends QueueItem { + private final ByteBuffer buffer; + + ReferenceQueueItem(ByteBuffer buffer) { + this.buffer = buffer; + } + + @Override + public int remaining() { + return buffer.remaining(); + } + + @Override + public int write(Socket socket) throws IOException { + return socket.write(buffer); + } + } +} diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/CustomSubscriber.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/CustomSubscriber.java new file mode 100644 index 000000000..22cf6edff --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/CustomSubscriber.java @@ -0,0 +1,126 @@ +package ru.vk.itmo.test.solnyshkoksenia; + +import java.net.http.HttpResponse.BodySubscriber; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.Flow; + +public class CustomSubscriber implements BodySubscriber { + private static final byte DELIMITER = '\n'; + volatile CompletableFuture bodyCF; + Flow.Subscription subscription; + List responseData = new CopyOnWriteArrayList<>(); + + @Override + public CompletionStage getBody() { + while (bodyCF == null) { + Thread.onSpinWait(); + } + return bodyCF; + } + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(List buffers) { + buffers.forEach(ByteBuffer::rewind); + responseData.addAll(buffers); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + bodyCF = CompletableFuture.failedFuture(throwable); + } + + @Override + public void onComplete() { + bodyCF = CompletableFuture.completedFuture(toBytes(responseData)); + } + + private List toArrays(List buffers) { + List chunks = new ArrayList<>(); + for (ByteBuffer buffer : buffers) { + int remaining = buffer.remaining(); + byte[] cur = new byte[remaining]; + buffer.get(cur, 0, remaining); + chunks.add(cur); + } + return chunks; + } + + private boolean containsDelim(byte[] bytes) { + for (int element : bytes) { + if (element == DELIMITER) { + return true; + } + } + return false; + } + + private boolean startsWithDelim(byte[] bytes) { + return DELIMITER == bytes[0]; + } + + private byte[] merge(byte[] src1, byte[] src2) { + byte[] dst = new byte[src1.length + src2.length]; + System.arraycopy(src1, 0, dst, 0, src1.length); + System.arraycopy(src2, 0, dst, src1.length, src2.length); + return dst; + } + + private byte[] toArray(List bytes) { + var size = bytes.stream().mapToInt(b -> b.length).sum() + bytes.size(); + byte[] dst = new byte[size]; + int offset = 0; + for (byte[] src : bytes) { + System.arraycopy(src, 0, dst, offset, src.length); + offset += src.length; + dst[offset] = DELIMITER; + offset++; + } + return dst; + } + + private byte[] toBytes(List buffers) { + List chunks = toArrays(buffers); + List bytes = new ArrayList<>(); + + boolean predEndsWithDelim = false; + boolean predContainsDelim = true; + + byte[] pred = null; + for (int i = 0; i < chunks.size(); i++) { + byte[] cur = chunks.get(i); + byte[] next = i + 1 == chunks.size() ? new byte[0] : chunks.get(i + 1); + if (startsWithDelim(cur) && !predContainsDelim) { + cur = merge(pred, cur); + } else if (!containsDelim(cur) && predEndsWithDelim) { + if (startsWithDelim(next)) { + bytes.add(pred); + } else { + cur = merge(pred, cur); + } + } else if (pred != null) { + bytes.add(pred); + } + + predEndsWithDelim = DELIMITER == cur[cur.length - 1]; + predContainsDelim = containsDelim(cur); + pred = cur; + } + + if (pred != null) { + bytes.add(pred); + } + return toArray(bytes); + } +} diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/MergeRangeResult.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/MergeRangeResult.java new file mode 100644 index 000000000..dd5f0ef00 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/MergeRangeResult.java @@ -0,0 +1,75 @@ +package ru.vk.itmo.test.solnyshkoksenia; + +import one.nio.http.Response; +import ru.vk.itmo.dao.BaseEntry; +import ru.vk.itmo.dao.Entry; +import ru.vk.itmo.test.solnyshkoksenia.dao.MemorySegmentComparator; +import ru.vk.itmo.test.solnyshkoksenia.dao.MergeIterator; + +import java.lang.foreign.MemorySegment; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; + +public final class MergeRangeResult { + private static final Comparator comparator = new MemorySegmentComparator(); + + private MergeRangeResult() { + } + + public static Iterator> range(Iterator> firstIterator, + List responses) { + List>> iterators = new ArrayList<>(responses.size() + 1); + for (var response : responses) { + iterators.add(iterator(response)); + } + iterators.add(firstIterator); + + return new MergeIterator<>(iterators, (e1, e2) -> comparator.compare(e1.key(), e2.key())) { + @Override + protected boolean skip(Entry memorySegmentEntry) { + return memorySegmentEntry.value() == null; + } + }; + } + + private static Iterator> iterator(Response response) { + byte[] body = response.getBody(); + char separator = '\n'; + return new Iterator<>() { + int offset; + + @Override + public boolean hasNext() { + return offset < body.length; + } + + @Override + public Entry next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + MemorySegment key = getMS(); + MemorySegment value = getMS(); + return new BaseEntry<>(key, value); + } + + private MemorySegment getMS() { + int startOffset = offset; + + byte b = body[offset]; + while (b != separator) { + b = body[++offset]; + } + + byte[] tmp = new byte[offset - startOffset]; + System.arraycopy(body, startOffset, tmp, 0, offset - startOffset); + + offset++; + return MemorySegment.ofArray(tmp); + } + }; + } +} diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/MyHttpServer.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/MyHttpServer.java index d3dcd2611..f8a2c5df4 100644 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/MyHttpServer.java +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/MyHttpServer.java @@ -1,5 +1,6 @@ package ru.vk.itmo.test.solnyshkoksenia; +import one.nio.async.CustomThreadFactory; import one.nio.http.HttpServer; import one.nio.http.HttpServerConfig; import one.nio.http.HttpSession; @@ -8,27 +9,48 @@ import one.nio.http.Request; import one.nio.http.RequestMethod; import one.nio.http.Response; +import one.nio.net.Socket; import one.nio.server.AcceptorConfig; +import one.nio.server.RejectedSessionException; import ru.vk.itmo.ServiceConfig; import ru.vk.itmo.dao.BaseEntry; import ru.vk.itmo.dao.Config; import ru.vk.itmo.dao.Entry; import ru.vk.itmo.test.solnyshkoksenia.dao.DaoImpl; +import ru.vk.itmo.test.solnyshkoksenia.dao.EntryExtended; import java.io.IOException; import java.io.UncheckedIOException; import java.lang.foreign.MemorySegment; import java.lang.foreign.ValueLayout; -import java.nio.charset.StandardCharsets; +import java.net.HttpURLConnection; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; public class MyHttpServer extends HttpServer { + private static final long FLUSHING_THRESHOLD_BYTES = Math.round(0.33 * 128 * 1024 * 1024); + private static final String HEADER_TIMESTAMP = "X-timestamp"; + private static final String HEADER_TIMESTAMP_HEADER = HEADER_TIMESTAMP + ": "; + private static final int THREADS = Runtime.getRuntime().availableProcessors(); + private final ServiceConfig config; private final DaoImpl dao; - private final ExecutorService executorService = new ThreadPoolExecutor(8, 16, + private final HttpClient httpClient; + private final ExecutorService executorLocal = new ThreadPoolExecutor(THREADS, THREADS * 2, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(128), + new CustomThreadFactory("local-work"), (r, executor) -> { HttpSession session = ((Task) r).session; try { @@ -40,7 +62,13 @@ public class MyHttpServer extends HttpServer { public MyHttpServer(ServiceConfig config) throws IOException { super(createHttpServerConfig(config)); + this.config = config; this.dao = new DaoImpl(createConfig(config)); + this.httpClient = HttpClient.newBuilder() + .executor(Executors.newFixedThreadPool(THREADS)) + .connectTimeout(Duration.ofMillis(500)) + .version(HttpClient.Version.HTTP_1_1) + .build(); } private static HttpServerConfig createHttpServerConfig(ServiceConfig serviceConfig) { @@ -48,6 +76,7 @@ private static HttpServerConfig createHttpServerConfig(ServiceConfig serviceConf AcceptorConfig acceptorConfig = new AcceptorConfig(); acceptorConfig.port = serviceConfig.selfPort(); acceptorConfig.reusePort = true; + serverConfig.selectors = THREADS / 2; serverConfig.acceptors = new AcceptorConfig[]{acceptorConfig}; serverConfig.closeSessions = true; @@ -55,12 +84,24 @@ private static HttpServerConfig createHttpServerConfig(ServiceConfig serviceConf } private static Config createConfig(ServiceConfig config) { - return new Config(config.workingDir(), Math.round(0.33 * 128 * 1024 * 1024)); + return new Config(config.workingDir(), FLUSHING_THRESHOLD_BYTES); + } + + @Override + public synchronized void stop() { + super.stop(); + executorLocal.close(); + httpClient.close(); + try { + dao.close(); + } catch (IOException e) { + throw new UncheckedIOException(e); + } } @Override public void handleDefault(Request request, HttpSession session) { - executorService.execute(new Task(() -> { + executorLocal.execute(new Task(() -> { try { if (request.getMethod() == Request.METHOD_GET || request.getMethod() == Request.METHOD_PUT @@ -75,83 +116,264 @@ public void handleDefault(Request request, HttpSession session) { }, session)); } - @Override - public synchronized void stop() { - super.stop(); - executorService.close(); - try { - dao.close(); - } catch (IOException e) { - throw new UncheckedIOException(e); + @Path("/v0/entities") + @RequestMethod(Request.METHOD_GET) + public void handleRangeRequest(final Request request, final HttpSession session, + @Param(value = "start", required = true) String start, + @Param(value = "end") String end, @Param(value = "cluster") String cluster) + throws IOException { + if (!ServerUtils.validParameters(session, start, end)) { + return; } - } - @Path("/v0/entity") - @RequestMethod(Request.METHOD_GET) - public void get(final HttpSession session, - @Param(value = "id", required = true) String id) { - executorService.execute(new Task(() -> { + if (cluster != null) { + sendClusterRange((CustomHttpSession) session, request, start, end); + return; + } + + executorLocal.execute(() -> { try { - if (sendResponseIfEmpty(id, session)) { - return; - } + sendLocalRange((CustomHttpSession) session, start, end); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + }); + } - Entry entry = dao.get(toMS(id)); - if (entry == null) { - session.sendResponse(new Response(Response.NOT_FOUND, Response.EMPTY)); - return; - } - session.sendResponse(Response.ok(entry.value().toArray(ValueLayout.JAVA_BYTE))); + private Iterator> invokeLocalRange(String start, String end) { + return dao.get(ServerUtils.toMS(start), end == null || end.isBlank() ? null : ServerUtils.toMS(end)); + } + + private void sendLocalRange(CustomHttpSession session, String start, String end) throws IOException { + Iterator> range = invokeLocalRange(start, end); + session.stream(range); + } + + private void sendClusterRange(CustomHttpSession session, Request request, String start, String end) { + List> responses = getResponses(request, config.clusterUrls(), + request.getURI().replace("&cluster=1", ""), + responseInfo -> new CustomSubscriber()); + Iterator> localIterator = invokeLocalRange(start, end); + + executorLocal.execute(() -> { + List completedResponses = responses + .stream() + .map(cf -> { + try { + return cf.get(5000, TimeUnit.MILLISECONDS); + } catch (ExecutionException | TimeoutException e) { + return new Response(Response.INTERNAL_ERROR, Response.EMPTY); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + return new Response(Response.SERVICE_UNAVAILABLE, Response.EMPTY); + } + }).toList(); + try { + sendRangeResponse(session, localIterator, completedResponses); } catch (IOException e) { throw new UncheckedIOException(e); } - }, session)); + }); + } + + private void sendRangeResponse(CustomHttpSession session, Iterator> firstIterator, + List responses) throws IOException { + Iterator> iterator = MergeRangeResult.range(firstIterator, responses.stream() + .filter(r -> r.getStatus() == HttpURLConnection.HTTP_OK).toList()); + session.stream(iterator); } @Path("/v0/entity") - @RequestMethod(Request.METHOD_PUT) - public void put(final Request request, final HttpSession session, - @Param(value = "id", required = true) String id) { - executorService.execute(new Task(() -> { + public void handleRequest(final Request request, final HttpSession session, + @Param(value = "id", required = true) String id, @Param(value = "ack") String ackString, + @Param(value = "from") String fromString, @Param(value = "local") String local) + throws IOException { + int ack = config.clusterUrls().size() / 2 + 1; + if (ackString != null && !ackString.isBlank()) { try { - if (sendResponseIfEmpty(id, session)) { - return; + ack = Integer.parseInt(ackString); + } catch (NumberFormatException e) { + session.sendError(Response.BAD_REQUEST, "Invalid ack parameter"); + return; + } + } + + int from = config.clusterUrls().size(); + if (fromString != null && !fromString.isBlank()) { + try { + from = Integer.parseInt(fromString); + } catch (NumberFormatException e) { + session.sendError(Response.BAD_REQUEST, "Invalid from parameter"); + return; + } + } + + if (id.isBlank() || ack < 1 || ack > from || from > config.clusterUrls().size()) { + session.sendResponse(new Response(Response.BAD_REQUEST, Response.EMPTY)); + return; + } + + if (local != null) { + Response response = invokeLocal(request, id); + session.sendResponse(response); + return; + } + handle(request, id, session, ack, from); + } + + private List> getResponses(Request request, List executorNodes, String uri, + HttpResponse.BodyHandler responseBodyHandler) { + List> responses = new ArrayList<>(); + for (String node : executorNodes) { + if (!node.equals(config.selfUrl())) { + try { + responses.add(invokeRemote(node, request, uri, responseBodyHandler)); + } catch (IOException e) { + responses.add(CompletableFuture.completedFuture(new Response(Response.INTERNAL_ERROR, + Response.EMPTY))); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + responses.add(CompletableFuture.completedFuture(new Response(Response.SERVICE_UNAVAILABLE, + Response.EMPTY))); } - dao.upsert(new BaseEntry<>(toMS(id), MemorySegment.ofArray(request.getBody()))); - session.sendResponse(new Response(Response.CREATED, Response.EMPTY)); + } + } + return responses; + } + + private void handle(Request request, String id, HttpSession session, Integer ack, Integer from) { + List executorNodes = ServerUtils.getNodesByEntityId(config.clusterUrls(), id, from); + List> responses = getResponses(request, executorNodes, + request.getURI() + "&local=1", HttpResponse.BodyHandlers.ofByteArray()); + if (executorNodes.contains(config.selfUrl())) { + responses.add(CompletableFuture.completedFuture(invokeLocal(request, id))); + } + + executorLocal.execute(() -> { + List completedResponses = responses + .stream() + .map(cf -> { + try { + return cf.get(500, TimeUnit.MILLISECONDS); + } catch (ExecutionException | TimeoutException e) { + return new Response(Response.INTERNAL_ERROR, Response.EMPTY); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + return new Response(Response.SERVICE_UNAVAILABLE, Response.EMPTY); + } + }).toList(); + try { + sendResponse(request, session, completedResponses, ack); } catch (IOException e) { throw new UncheckedIOException(e); } - }, session)); + }); } - @Path("/v0/entity") - @RequestMethod(Request.METHOD_DELETE) - public void delete(final HttpSession session, - @Param(value = "id", required = true) String id) { - executorService.execute(new Task(() -> { - try { - if (sendResponseIfEmpty(id, session)) { + private void sendResponse(Request request, HttpSession session, List responses, int ack) + throws IOException { + List statuses = responses.stream().map(Response::getStatus).toList(); + switch (request.getMethod()) { + case Request.METHOD_GET -> { + if (statuses.stream().filter(s -> s == HttpURLConnection.HTTP_OK + || s == HttpURLConnection.HTTP_NOT_FOUND).count() < ack) { + session.sendResponse(new Response(Response.GATEWAY_TIMEOUT, Response.EMPTY)); + return; + } + + if (statuses.stream().noneMatch(s -> s == HttpURLConnection.HTTP_OK)) { + session.sendResponse(new Response(Response.NOT_FOUND, Response.EMPTY)); + return; + } + + session.sendResponse(getBestResponse(responses)); + } + case Request.METHOD_PUT -> { + if (statuses.stream().filter(s -> s == HttpURLConnection.HTTP_CREATED).count() < ack) { + session.sendResponse(new Response(Response.GATEWAY_TIMEOUT, Response.EMPTY)); + return; + } + session.sendResponse(new Response(Response.CREATED, Response.EMPTY)); + } + case Request.METHOD_DELETE -> { + if (statuses.stream().filter(s -> s == HttpURLConnection.HTTP_ACCEPTED).count() < ack) { + session.sendResponse(new Response(Response.GATEWAY_TIMEOUT, Response.EMPTY)); return; } - dao.upsert(new BaseEntry<>(toMS(id), null)); session.sendResponse(new Response(Response.ACCEPTED, Response.EMPTY)); - } catch (IOException e) { - throw new UncheckedIOException(e); } - }, session)); + default -> session.sendResponse(new Response(Response.METHOD_NOT_ALLOWED, Response.EMPTY)); + } } - private boolean sendResponseIfEmpty(String input, final HttpSession session) throws IOException { - if (input.isBlank()) { - session.sendResponse(new Response(Response.BAD_REQUEST, Response.EMPTY)); - return true; + private static Response getBestResponse(List responses) { + responses = responses.stream().filter(r -> r.getStatus() == HttpURLConnection.HTTP_OK + || r.getStatus() == HttpURLConnection.HTTP_NOT_FOUND).toList(); + + Response bestResp = responses.getFirst(); + for (int i = 1; i < responses.size(); i++) { + String bestRespTime = bestResp.getHeader(HEADER_TIMESTAMP_HEADER); + if (responses.get(i).getHeader(HEADER_TIMESTAMP) != null && (bestRespTime == null + || Long.parseLong(responses.get(i).getHeader(HEADER_TIMESTAMP_HEADER)) + > Long.parseLong(bestRespTime))) { + bestResp = responses.get(i); + } } - return false; + return bestResp; } - private MemorySegment toMS(String input) { - return MemorySegment.ofArray(input.getBytes(StandardCharsets.UTF_8)); + @SuppressWarnings("FutureReturnValueIgnored") + private CompletableFuture invokeRemote(String executorNode, Request request, String uri, + HttpResponse.BodyHandler responseBodyHandler) + throws IOException, InterruptedException { + HttpRequest httpRequest = ServerUtils.buildHttpRequest(executorNode, request, uri); + CompletableFuture response = new CompletableFuture<>(); + httpClient.sendAsync(httpRequest, responseBodyHandler) + .whenComplete((httpResponse, throwable) -> response.complete(ServerUtils.makeResponse(httpResponse))); + return response; + } + + private Response invokeLocal(Request request, String id) { + switch (request.getMethod()) { + case Request.METHOD_GET -> { + MemorySegment key = ServerUtils.toMS(id); + Entry entry = dao.get(key); + if (entry == null) { + return new Response(Response.NOT_FOUND, Response.EMPTY); + } + + if (entry.value() == null) { + Response response = new Response(Response.NOT_FOUND, Response.EMPTY); + response.addHeader(HEADER_TIMESTAMP_HEADER + ((EntryExtended) entry) + .timestamp().get(ValueLayout.JAVA_LONG_UNALIGNED, 0)); + return response; + } + + Response response = Response.ok(entry.value().toArray(ValueLayout.JAVA_BYTE)); + response.addHeader(HEADER_TIMESTAMP_HEADER + ((EntryExtended) entry) + .timestamp().get(ValueLayout.JAVA_LONG_UNALIGNED, 0)); + return response; + } + case Request.METHOD_PUT -> { + MemorySegment key = ServerUtils.toMS(id); + MemorySegment value = MemorySegment.ofArray(request.getBody()); + dao.upsert(new BaseEntry<>(key, value)); + return new Response(Response.CREATED, Response.EMPTY); + } + case Request.METHOD_DELETE -> { + MemorySegment key = ServerUtils.toMS(id); + dao.upsert(new BaseEntry<>(key, null)); + return new Response(Response.ACCEPTED, Response.EMPTY); + } + default -> { + return new Response(Response.METHOD_NOT_ALLOWED, Response.EMPTY); + } + } + } + + @Override + public HttpSession createSession(Socket socket) throws RejectedSessionException { + return new CustomHttpSession(socket, this); } public static class Task implements Runnable { diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/ServerUtils.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/ServerUtils.java new file mode 100644 index 000000000..9a5ec26ed --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/ServerUtils.java @@ -0,0 +1,111 @@ +package ru.vk.itmo.test.solnyshkoksenia; + +import one.nio.http.HttpSession; +import one.nio.http.Request; +import one.nio.http.Response; +import one.nio.util.Hash; +import ru.vk.itmo.dao.Entry; + +import java.io.IOException; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; +import java.net.URI; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +public class ServerUtils { + private static final String HEADER_TIMESTAMP = "X-timestamp"; + private static final String HEADER_TIMESTAMP_HEADER = HEADER_TIMESTAMP + ": "; + + protected static MemorySegment toMS(String input) { + return MemorySegment.ofArray(input.getBytes(StandardCharsets.UTF_8)); + } + + protected static HttpRequest buildHttpRequest(String executorNode, Request request, String uri) { + return HttpRequest.newBuilder(URI.create(executorNode + uri)) + .method( + request.getMethodName(), + request.getBody() == null + ? HttpRequest.BodyPublishers.noBody() + : HttpRequest.BodyPublishers.ofByteArray(request.getBody()) + ) + .timeout(Duration.ofMillis(500)) + .build(); + } + + protected static Response makeResponse(HttpResponse httpResponse) { + Optional header = httpResponse.headers().firstValue(HEADER_TIMESTAMP); + long timestamp; + if (header.isPresent()) { + try { + timestamp = Long.parseLong(header.get()); + } catch (Exception e) { + timestamp = 0; + } + } else { + timestamp = 0; + } + Response response = new Response(Integer.toString(httpResponse.statusCode()), httpResponse.body()); + response.addHeader(HEADER_TIMESTAMP_HEADER + timestamp); + return response; + } + + protected static boolean validParameters(final HttpSession session, String start, String end) throws IOException { + if (start == null || start.isBlank()) { + session.sendError(Response.BAD_REQUEST, "Start parameter required"); + return false; + } + + if (end != null && !end.isBlank() && start.compareTo(end) >= 0) { + session.sendError(Response.BAD_REQUEST, "Start parameter should be less than end parameter"); + return false; + } + + return true; + } + + protected static List getNodesByEntityId(List urls, String id, Integer from) { + List executorNodes = new ArrayList<>(); + + for (int i = 0; i < from; i++) { + int hash = Hash.murmur3(urls.get(i) + id); + executorNodes.add(new Node(i, hash)); + executorNodes.sort(Node::compareTo); + } + + for (int i = from; i < urls.size(); i++) { + int hash = Hash.murmur3(urls.get(i) + id); + if (executorNodes.getFirst().hash < hash) { + executorNodes.remove(executorNodes.getFirst()); + executorNodes.add(new Node(i, hash)); + executorNodes.sort(Node::compareTo); + break; + } + } + + return executorNodes.stream().map(node -> urls.get(node.id)).toList(); + } + + @SuppressWarnings("unused") + protected static String printEntry(Entry entry) { + return "Key: " + toString(entry.key()) + " Value: " + toString(entry.value()); + } + + private static String toString(MemorySegment memorySegment) { + return memorySegment == null ? "" : new String(memorySegment.toArray(ValueLayout.JAVA_BYTE), + StandardCharsets.UTF_8); + } + + @SuppressWarnings("unused") + private record Node(int id, int hash) implements Comparable { + @Override + public int compareTo(Node o) { + return Integer.compare(hash, o.hash); + } + } +} diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/ServiceImpl.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/ServiceImpl.java index d4cbd9d63..253f90c6e 100644 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/ServiceImpl.java +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/ServiceImpl.java @@ -10,25 +10,31 @@ public class ServiceImpl implements Service { private final ServiceConfig config; private MyHttpServer server; + private boolean stopped; public ServiceImpl(ServiceConfig config) { - this.config = config; + this.config = config; } @Override public CompletableFuture start() throws IOException { server = new MyHttpServer(config); server.start(); + stopped = false; return CompletableFuture.completedFuture(null); } @Override public CompletableFuture stop() throws IOException { + if (stopped) { + return CompletableFuture.completedFuture(null); + } server.stop(); + stopped = true; return CompletableFuture.completedFuture(null); } - @ServiceFactory(stage = 2) + @ServiceFactory(stage = 6) public static class Factory implements ServiceFactory.Factory { @Override public Service create(ServiceConfig config) { diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/DaoImpl.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/DaoImpl.java index 70b88b626..24d980322 100644 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/DaoImpl.java +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/DaoImpl.java @@ -67,7 +67,7 @@ public void upsert(Entry entry, Long ttl) { lock.readLock().lock(); try { - state.putInMemory(entry, ttl); + state.putInMemory(entry, System.currentTimeMillis(), ttl); } finally { lock.readLock().unlock(); } diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/EntryExtended.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/EntryExtended.java index 3d53ca879..786cec813 100644 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/EntryExtended.java +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/EntryExtended.java @@ -2,9 +2,9 @@ import ru.vk.itmo.dao.Entry; -public record EntryExtended(Data key, Data value, Data expiration) implements Entry { +public record EntryExtended(Data key, Data value, Data timestamp, Data expiration) implements Entry { @Override public String toString() { - return "{" + key + ":" + value + ":" + expiration + "}"; + return "{" + key + ":" + value + ":" + timestamp + ":" + expiration + "}"; } } diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/State.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/State.java index 2541936a6..13e6bd649 100644 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/State.java +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/State.java @@ -44,13 +44,10 @@ public State(Config config, this.diskStorage = diskStorage; } - public void putInMemory(Entry entry, Long ttl) { - MemorySegment expiration = null; - if (ttl != null) { - long[] ar = {System.currentTimeMillis() + ttl}; - expiration = MemorySegment.ofArray(ar); - } - EntryExtended entryExtended = new EntryExtended<>(entry.key(), entry.value(), expiration); + public void putInMemory(Entry entry, Long timestamp, Long ttl) { + MemorySegment time = longToMS(timestamp); + MemorySegment expiration = ttl == null ? null : longToMS(timestamp + ttl); + EntryExtended entryExtended = new EntryExtended<>(entry.key(), entry.value(), time, expiration); EntryExtended previousEntry = storage.put(entryExtended.key(), entryExtended); if (previousEntry != null) { @@ -69,7 +66,8 @@ public void save() throws IOException { private static long getSize(EntryExtended entry) { long valueSize = entry.value() == null ? 0 : entry.value().byteSize(); long expirationSize = entry.expiration() == null ? 0 : entry.expiration().byteSize(); - return Long.BYTES + entry.key().byteSize() + Long.BYTES + valueSize + Long.BYTES + expirationSize; + return Long.BYTES + entry.key().byteSize() + Long.BYTES + valueSize + Long.BYTES + entry.timestamp().byteSize() + + Long.BYTES + expirationSize; } @CanIgnoreReturnValue @@ -109,12 +107,12 @@ public State close() { public Entry get(MemorySegment key, Comparator comparator) { EntryExtended entry = storage.get(key); if (isValidEntry(entry)) { - return entry.value() == null ? null : entry; + return entry; } entry = flushingStorage.get(key); if (isValidEntry(entry)) { - return entry.value() == null ? null : entry; + return entry; } Iterator> iterator = diskStorage.range(Collections.emptyIterator(), key, null); @@ -134,6 +132,11 @@ private boolean isValidEntry(EntryExtended entry) { || entry.expiration().toArray(ValueLayout.JAVA_LONG_UNALIGNED)[0] > System.currentTimeMillis()); } + private MemorySegment longToMS(Long value) { + long[] ar = {value}; + return MemorySegment.ofArray(ar); + } + protected Iterator> getInMemory( NavigableMap> memory, MemorySegment from, MemorySegment to) { diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/storage/DiskStorage.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/storage/DiskStorage.java index 0410f3c9e..1e5b29570 100644 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/storage/DiskStorage.java +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/storage/DiskStorage.java @@ -73,20 +73,15 @@ public void save(Iterable> iterable) final long currentTime = System.currentTimeMillis(); - Entry sizes = new BaseEntry<>(0L, 0L); - for (EntryExtended entry : iterable) { - MemorySegment expiration = entry.expiration(); - if (expiration == null || utils.checkTTL(expiration, currentTime)) { - sizes = utils.countEntrySize(entry, sizes); - } - } + Entry sizes = utils.countSizes(iterable, currentTime); + long dataSize = sizes.key(); long count = sizes.value(); if (count == 0) { return; } - long indexSize = count * 3 * Long.BYTES; + long indexSize = count * 4 * Long.BYTES; try ( FileChannel fileChannel = FileChannel.open( @@ -152,13 +147,14 @@ public void compact() throws IOException { long dataSize = 0; long indexSize = 0; while (iterator.hasNext()) { - indexSize += Long.BYTES * 3; + indexSize += Long.BYTES * 4; EntryExtended entry = iterator.next(); dataSize += entry.key().byteSize(); MemorySegment value = entry.value(); if (value != null) { dataSize += value.byteSize(); } + dataSize += entry.timestamp().byteSize(); MemorySegment expiration = entry.expiration(); if (expiration != null) { dataSize += expiration.byteSize(); @@ -254,19 +250,26 @@ public EntryExtended next() { if (!hasNext()) { throw new NoSuchElementException(); } + MemorySegment key = utils.slice(page, utils.startOfKey(page, index), utils.endOfKey(page, index)); + long startOfValue = utils.startOfValue(page, index); MemorySegment value = startOfValue < 0 ? null : utils.slice(page, startOfValue, utils.endOfValue(page, index)); + + MemorySegment timestamp = utils.slice(page, utils.startOfTimestamp(page, index), + utils.endOfTimestamp(page, index)); + long startOfExp = utils.startOfExpiration(page, index); MemorySegment expiration = startOfExp < 0 ? null : utils.slice(page, startOfExp, utils.endOfExpiration(page, index, recordsCount)); + index++; - return new EntryExtended<>(key, value, expiration); + return new EntryExtended<>(key, value, timestamp, expiration); } }; } diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/storage/StorageUtils.java b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/storage/StorageUtils.java index 0447d51f2..1823c63e2 100644 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/storage/StorageUtils.java +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/dao/storage/StorageUtils.java @@ -16,7 +16,7 @@ protected MemorySegment slice(MemorySegment page, long start, long end) { } protected long startOfKey(MemorySegment segment, long recordIndex) { - return segment.get(ValueLayout.JAVA_LONG_UNALIGNED, recordIndex * 3 * Long.BYTES); + return segment.get(ValueLayout.JAVA_LONG_UNALIGNED, recordIndex * 4 * Long.BYTES); } protected long endOfKey(MemorySegment segment, long recordIndex) { @@ -24,15 +24,23 @@ protected long endOfKey(MemorySegment segment, long recordIndex) { } protected long startOfValue(MemorySegment segment, long recordIndex) { - return segment.get(ValueLayout.JAVA_LONG_UNALIGNED, recordIndex * 3 * Long.BYTES + Long.BYTES); + return segment.get(ValueLayout.JAVA_LONG_UNALIGNED, recordIndex * 4 * Long.BYTES + Long.BYTES); } protected long endOfValue(MemorySegment segment, long recordIndex) { + return normalizedStartOfTimestamp(segment, recordIndex); + } + + protected long startOfTimestamp(MemorySegment segment, long recordIndex) { + return segment.get(ValueLayout.JAVA_LONG_UNALIGNED, recordIndex * 4 * Long.BYTES + Long.BYTES * 2); + } + + protected long endOfTimestamp(MemorySegment segment, long recordIndex) { return normalizedStartOfExpiration(segment, recordIndex); } protected long startOfExpiration(MemorySegment segment, long recordIndex) { - return segment.get(ValueLayout.JAVA_LONG_UNALIGNED, recordIndex * 3 * Long.BYTES + Long.BYTES * 2); + return segment.get(ValueLayout.JAVA_LONG_UNALIGNED, recordIndex * 4 * Long.BYTES + Long.BYTES * 3); } protected long endOfExpiration(MemorySegment segment, long recordIndex, long recordsCount) { @@ -51,8 +59,8 @@ protected long normalize(long value) { } protected long recordsCount(MemorySegment segment) { - long indexSize = indexSize(segment); - return indexSize / Long.BYTES / 3; + long indexSize = segment.get(ValueLayout.JAVA_LONG_UNALIGNED, 0); + return indexSize / Long.BYTES / 4; } protected MemorySegment mapFile(FileChannel fileChannel, long size, Arena arena) throws IOException { @@ -64,26 +72,12 @@ protected MemorySegment mapFile(FileChannel fileChannel, long size, Arena arena) ); } - protected Entry countEntrySize(EntryExtended entry, Entry sizes) { - long dataSize = sizes.key(); - dataSize += entry.key().byteSize(); - MemorySegment value = entry.value(); - if (value != null) { - dataSize += value.byteSize(); - } - MemorySegment expiration = entry.expiration(); - if (expiration != null) { - dataSize += expiration.byteSize(); - } - return new BaseEntry<>(dataSize, sizes.value() + 1); - } - protected Entry putEntry(MemorySegment fileSegment, Entry offsets, EntryExtended entry) { long dataOffset = offsets.key(); long indexOffset = offsets.value(); + fileSegment.set(ValueLayout.JAVA_LONG_UNALIGNED, indexOffset, dataOffset); indexOffset += Long.BYTES; - MemorySegment key = entry.key(); MemorySegment.copy(key, 0, fileSegment, dataOffset, key.byteSize()); dataOffset += key.byteSize(); @@ -98,6 +92,12 @@ protected Entry putEntry(MemorySegment fileSegment, Entry offsets, E } indexOffset += Long.BYTES; + fileSegment.set(ValueLayout.JAVA_LONG_UNALIGNED, indexOffset, dataOffset); + indexOffset += Long.BYTES; + MemorySegment timestamp = entry.timestamp(); + MemorySegment.copy(timestamp, 0, fileSegment, dataOffset, timestamp.byteSize()); + dataOffset += timestamp.byteSize(); + MemorySegment expiration = entry.expiration(); if (expiration == null) { fileSegment.set(ValueLayout.JAVA_LONG_UNALIGNED, indexOffset, tombstone(dataOffset)); @@ -115,12 +115,33 @@ private long normalizedStartOfValue(MemorySegment segment, long recordIndex) { return normalize(startOfValue(segment, recordIndex)); } + private long normalizedStartOfTimestamp(MemorySegment segment, long recordIndex) { + return normalize(startOfTimestamp(segment, recordIndex)); + } + private long normalizedStartOfExpiration(MemorySegment segment, long recordIndex) { return normalize(startOfExpiration(segment, recordIndex)); } - private static long indexSize(MemorySegment segment) { - return segment.get(ValueLayout.JAVA_LONG_UNALIGNED, 0); + protected Entry countSizes(Iterable> iterable, long currentTime) { + long dataSize = 0L; + long count = 0L; + for (EntryExtended entry : iterable) { + MemorySegment expiration = entry.expiration(); + if (expiration == null || checkTTL(expiration, currentTime)) { + dataSize += entry.key().byteSize(); + MemorySegment value = entry.value(); + if (value != null) { + dataSize += value.byteSize(); + } + dataSize += entry.timestamp().byteSize(); + if (expiration != null) { + dataSize += expiration.byteSize(); + } + count++; + } + } + return new BaseEntry<>(dataSize, count); } protected long indexOf(MemorySegment segment, MemorySegment key) { diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/get_cpu.html b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage1/get_cpu.html similarity index 100% rename from src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/get_cpu.html rename to src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage1/get_cpu.html diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/put_alloc.html b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage1/put_alloc.html similarity index 100% rename from src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/put_alloc.html rename to src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage1/put_alloc.html diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/put_cpu.html b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage1/put_cpu.html similarity index 100% rename from src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/put_cpu.html rename to src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage1/put_cpu.html diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/alloc/async-put-alloc.html b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/alloc/async-put-alloc.html new file mode 100644 index 000000000..e1d4dca13 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/alloc/async-put-alloc.html @@ -0,0 +1,738 @@ + + + + + + + +

Allocation profile

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/alloc/sync-put-alloc.html b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/alloc/sync-put-alloc.html new file mode 100644 index 000000000..c95b38392 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/alloc/sync-put-alloc.html @@ -0,0 +1,661 @@ + + + + + + + +

Allocation profile

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/cpu/async-put-cpu.html b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/cpu/async-put-cpu.html new file mode 100644 index 000000000..21f85dde6 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/cpu/async-put-cpu.html @@ -0,0 +1,1526 @@ + + + + + + + +

CPU profile

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/cpu/sync-put-cpu.html b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/cpu/sync-put-cpu.html new file mode 100644 index 000000000..d964fe237 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/cpu/sync-put-cpu.html @@ -0,0 +1,1132 @@ + + + + + + + +

CPU profile

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/lock/async-put-lock.html b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/lock/async-put-lock.html new file mode 100644 index 000000000..784c5098f --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/lock/async-put-lock.html @@ -0,0 +1,345 @@ + + + + + + + +

Lock profile

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/lock/sync-put-lock.html b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/lock/sync-put-lock.html new file mode 100644 index 000000000..aecb6cec5 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/flame_graphs/stage5/lock/sync-put-lock.html @@ -0,0 +1,340 @@ + + + + + + + +

Lock profile

+
  
+
Produced by async-profiler
+ +
+

+

Matched:

+ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R100.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R100.png deleted file mode 100644 index 2fa10aff1..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R100.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R10000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R10000.png deleted file mode 100644 index 73ede86c9..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R10000.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R40000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R40000.png deleted file mode 100644 index edcd8c964..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R40000.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R50000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R50000.png deleted file mode 100644 index d94fcac33..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d10-t1-c1-R50000.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d120-t1-c1-R40000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d120-t1-c1-R40000.png deleted file mode 100644 index 9fa628c59..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d120-t1-c1-R40000.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d60-t1-c1-R40000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d60-t1-c1-R40000.png deleted file mode 100644 index 4a0377f4b..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/get-d60-t1-c1-R40000.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d10-t1-c1-R100.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d10-t1-c1-R100.png deleted file mode 100644 index dba2df02b..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d10-t1-c1-R100.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d10-t1-c1-R10000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d10-t1-c1-R10000.png deleted file mode 100644 index fc94be9c9..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d10-t1-c1-R10000.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d10-t1-c1-R40000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d10-t1-c1-R40000.png deleted file mode 100644 index 9b5ab886f..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d10-t1-c1-R40000.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d120-t1-c1-R40000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d120-t1-c1-R40000.png deleted file mode 100644 index 71e979df5..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d120-t1-c1-R40000.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d60-t1-c1-R40000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d60-t1-c1-R40000.png deleted file mode 100644 index d7f35c9d3..000000000 Binary files a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/put-d60-t1-c1-R40000.png and /dev/null differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/stage5/get-20000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/stage5/get-20000.png new file mode 100644 index 000000000..93a7bd8e6 Binary files /dev/null and b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/stage5/get-20000.png differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/stage5/put-20000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/stage5/put-20000.png new file mode 100644 index 000000000..f3dd22176 Binary files /dev/null and b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/stage5/put-20000.png differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/stage5/put-40000.png b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/stage5/put-40000.png new file mode 100644 index 000000000..3873d4b8b Binary files /dev/null and b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/images/stage5/put-40000.png differ diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/report-stage1.md b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/report-stage1.md index 0ce9959fc..8b39207d9 100644 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/report-stage1.md +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/report-stage1.md @@ -149,7 +149,7 @@ ### Профилирование под нагрузкой `GET` запросами -Рассмотрим [flame graph для CPU](flame_graphs/get_cpu.html). Больше всего CPU используется при поиске `entry` в памяти, +Рассмотрим [flame graph для CPU](flame_graphs/stage1/get_cpu.html). Больше всего CPU используется при поиске `entry` в памяти, а именно во время сравнения `MemorySegment`-ов. Рассмотрим [flame graph для аллокаций](flame_graphs/get_alloc.html). Большинство @@ -158,10 +158,10 @@ ### Профилирование под нагрузкой `PUT` запросами -Рассмотрим [flame graph для CPU](flame_graphs/put_cpu.html). Здесь у нас много CPU используется для обработки +Рассмотрим [flame graph для CPU](flame_graphs/stage1/put_cpu.html). Здесь у нас много CPU используется для обработки `PUT`-запроса: примерно поровну между методами `dao.upsert()` и `sendResponse()`. -Рассмотрим [flame graph для аллокаций](flame_graphs/put_alloc.html). Тут у нас нет такого большого и ярко-выраженного +Рассмотрим [flame graph для аллокаций](flame_graphs/stage1/put_alloc.html). Тут у нас нет такого большого и ярко-выраженного количества аллокаций, как при `GET`-запросах, так как в при `PUT` запросе мы аллоцируем только 2 `MemorySegment`-а для `key` и `value`. diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/report-stage5.md b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/report-stage5.md new file mode 100644 index 000000000..48f15ec4f --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/reports/report-stage5.md @@ -0,0 +1,42 @@ +# Report stage 5 +## Нагрузочное тестирование в несколько соединений, сравнение с предыдущей неасинхронной версией + +Посмотрим, стал ли сервер работать лучше после того, как мы сделали все потоки неблокируещимися. Будем сравнивать с +предыдущим этапом с помощью нагрузочного тестирования. На момент начала тестирования база заполнена +примерно на 100mb. Для тестирования используем скрипт [`put.lua`](../wrk_scripts/put.lua). В качестве `id` используются +рандомные строки длины 3, в качестве `body` - рандомные строки длины 300. Рандомные строки генерируются из словаря +длины 62, т.е. у нас примерно 240.000 возможных ключей. + +#### PUT запросы, RPS: 20000, Connections: 64, Threads: 64, Duration: 60s + +Неожиданно, асинхронный сервер обрабатывает запросы медленнее неасинхронного. + +![image](images/stage5/put-20000.png) + +#### GET запросы, RPS: 20000, Connections: 64, Threads: 64, Duration: 60s + +На GET-запросах ситуация обратная. + +![image](images/stage5/get-20000.png) + +#### PUT запросы, RPS: 40000, Connections: 64, Threads: 64, Duration: 60s + +Посмотрим на максимальную нагрузку, которую выдерживал сервер на предыдущих этапах. +На точке разладки асинхронный сервер работает гораздо быстрее неасинхронного. + +![image](images/stage5/put-40000.png) + +## Профилирование под нагрузкой, сравнение с предыдущей неасинхронной версией + +#### PUT запросы, RPS: 30000, Connections: 64, Threads: 64, Duration: 30s + +На профилях CPU можем заметить, что в асинхронной версии доставание тасок из очереди, их выполнение и отсылку респонсов +делает другой поток (PayloadThread). Это логично: ведь SelectorThread-ы сразу возвращаются с Future +([async-put-cpu.html](flame_graphs/stage5/cpu/async-put-cpu.html), [sync-put-cpu.html](flame_graphs/stage5/cpu/sync-put-cpu.html)) + +Профили аллокаций показали такую же ситуацию ([async-put-alloc.html](flame_graphs/stage5/alloc/async-put-alloc.html), [sync-put-alloc.html](flame_graphs/stage5/alloc/sync-put-alloc.html)). +В остальном кажется, что ресурсы (что ресурсы процессора, что выделение памяти) распределены так же как в неасинхронном +сервере, разве что методы распределились между разными типами тредов. + +Главное различие заметно на профилях блокировок: асинхронный сервер почти не блокирует потоки, когда задача попадает в +`ThreadPoolExecutor`, это доказательство того, что всё сделано правильно ([async-put-lock.html](flame_graphs/stage5/lock/async-put-lock.html), [sync-put-lock.html](flame_graphs/stage5/lock/sync-put-lock.html)) \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R100.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R100.txt deleted file mode 100644 index b90cac965..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R100.txt +++ /dev/null @@ -1,54 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.316 0.000000 1 1.00 - 1.049 0.100000 100 1.11 - 1.285 0.200000 200 1.25 - 1.401 0.300000 301 1.43 - 1.512 0.400000 401 1.67 - 1.637 0.500000 500 2.00 - 1.694 0.550000 550 2.22 - 1.754 0.600000 600 2.50 - 1.821 0.650000 652 2.86 - 1.869 0.700000 700 3.33 - 1.920 0.750000 751 4.00 - 1.958 0.775000 775 4.44 - 1.983 0.800000 800 5.00 - 2.016 0.825000 825 5.71 - 2.061 0.850000 852 6.67 - 2.087 0.875000 875 8.00 - 2.101 0.887500 888 8.89 - 2.113 0.900000 901 10.00 - 2.129 0.912500 914 11.43 - 2.143 0.925000 926 13.33 - 2.155 0.937500 938 16.00 - 2.167 0.943750 945 17.78 - 2.171 0.950000 952 20.00 - 2.177 0.956250 957 22.86 - 2.187 0.962500 963 26.67 - 2.197 0.968750 969 32.00 - 2.209 0.971875 972 35.56 - 2.213 0.975000 975 40.00 - 2.221 0.978125 979 45.71 - 2.233 0.981250 984 53.33 - 2.241 0.984375 985 64.00 - 2.243 0.985938 987 71.11 - 2.245 0.987500 988 80.00 - 2.257 0.989062 990 91.43 - 2.261 0.990625 991 106.67 - 2.271 0.992188 993 128.00 - 2.271 0.992969 993 142.22 - 2.279 0.993750 994 160.00 - 2.281 0.994531 995 182.86 - 2.297 0.995313 997 213.33 - 2.297 0.996094 997 256.00 - 2.297 0.996484 997 284.44 - 2.297 0.996875 997 320.00 - 2.307 0.997266 998 365.71 - 2.307 0.997656 998 426.67 - 2.349 0.998047 999 512.00 - 2.349 0.998242 999 568.89 - 2.349 0.998437 999 640.00 - 2.349 0.998633 999 731.43 - 2.349 0.998828 999 853.33 - 2.355 0.999023 1000 1024.00 - 2.355 1.000000 1000 inf \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R10000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R10000.txt deleted file mode 100644 index 42a90eedc..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R10000.txt +++ /dev/null @@ -1,88 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.024 0.000000 1 1.00 - 0.192 0.100000 10027 1.11 - 0.310 0.200000 20044 1.25 - 0.427 0.300000 30000 1.43 - 0.545 0.400000 40051 1.67 - 0.662 0.500000 50057 2.00 - 0.720 0.550000 55021 2.22 - 0.779 0.600000 60030 2.50 - 0.837 0.650000 64998 2.86 - 0.895 0.700000 70027 3.33 - 0.953 0.750000 75015 4.00 - 0.983 0.775000 77543 4.44 - 1.012 0.800000 80055 5.00 - 1.041 0.825000 82564 5.71 - 1.070 0.850000 85072 6.67 - 1.098 0.875000 87503 8.00 - 1.113 0.887500 88819 8.89 - 1.127 0.900000 90035 10.00 - 1.142 0.912500 91320 11.43 - 1.156 0.925000 92516 13.33 - 1.171 0.937500 93811 16.00 - 1.178 0.943750 94409 17.78 - 1.186 0.950000 95047 20.00 - 1.193 0.956250 95640 22.86 - 1.200 0.962500 96253 26.67 - 1.208 0.968750 96875 32.00 - 1.214 0.971875 97196 35.56 - 1.221 0.975000 97487 40.00 - 1.243 0.978125 97798 45.71 - 1.324 0.981250 98112 53.33 - 1.469 0.984375 98426 64.00 - 1.562 0.985938 98579 71.11 - 1.653 0.987500 98739 80.00 - 1.743 0.989062 98892 91.43 - 1.837 0.990625 99049 106.67 - 1.934 0.992188 99206 128.00 - 1.978 0.992969 99284 142.22 - 2.033 0.993750 99364 160.00 - 2.083 0.994531 99439 182.86 - 2.137 0.995313 99517 213.33 - 2.195 0.996094 99596 256.00 - 2.241 0.996484 99636 284.44 - 2.433 0.996875 99673 320.00 - 2.913 0.997266 99712 365.71 - 3.173 0.997656 99751 426.67 - 3.365 0.998047 99790 512.00 - 3.483 0.998242 99810 568.89 - 3.535 0.998437 99829 640.00 - 3.555 0.998633 99852 731.43 - 3.593 0.998828 99868 853.33 - 3.853 0.999023 99888 1024.00 - 4.387 0.999121 99898 1137.78 - 4.487 0.999219 99907 1280.00 - 4.523 0.999316 99920 1462.86 - 4.539 0.999414 99928 1706.67 - 4.579 0.999512 99937 2048.00 - 4.603 0.999561 99942 2275.56 - 4.639 0.999609 99946 2560.00 - 4.747 0.999658 99951 2925.71 - 4.927 0.999707 99956 3413.33 - 5.051 0.999756 99962 4096.00 - 5.087 0.999780 99964 4551.11 - 5.115 0.999805 99967 5120.00 - 5.119 0.999829 99969 5851.43 - 5.143 0.999854 99971 6826.67 - 5.167 0.999878 99973 8192.00 - 5.207 0.999890 99975 9102.22 - 5.215 0.999902 99976 10240.00 - 5.223 0.999915 99977 11702.86 - 5.227 0.999927 99978 13653.33 - 5.239 0.999939 99979 16384.00 - 5.251 0.999945 99980 18204.44 - 5.259 0.999951 99982 20480.00 - 5.259 0.999957 99982 23405.71 - 5.259 0.999963 99982 27306.67 - 5.259 0.999969 99982 32768.00 - 5.295 0.999973 99983 36408.89 - 5.295 0.999976 99983 40960.00 - 5.295 0.999979 99983 46811.43 - 5.299 0.999982 99984 54613.33 - 5.299 0.999985 99984 65536.00 - 5.299 0.999986 99984 72817.78 - 5.299 0.999988 99984 81920.00 - 5.299 0.999989 99984 93622.86 - 5.303 0.999991 99985 109226.67 - 5.303 1.000000 99985 inf \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R40000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R40000.txt deleted file mode 100644 index 724d3f413..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R40000.txt +++ /dev/null @@ -1,89 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.016 0.000000 2 1.00 - 0.241 0.100000 40034 1.11 - 0.394 0.200000 80009 1.25 - 0.526 0.300000 120077 1.43 - 0.662 0.400000 160212 1.67 - 0.801 0.500000 200020 2.00 - 0.865 0.550000 220078 2.22 - 0.930 0.600000 240165 2.50 - 0.992 0.650000 260093 2.86 - 1.055 0.700000 280175 3.33 - 1.122 0.750000 300158 4.00 - 1.157 0.775000 310036 4.44 - 1.211 0.800000 319932 5.00 - 1.278 0.825000 329935 5.71 - 1.364 0.850000 339953 6.67 - 1.494 0.875000 349965 8.00 - 1.597 0.887500 354946 8.89 - 1.725 0.900000 359944 10.00 - 1.857 0.912500 364935 11.43 - 2.028 0.925000 369930 13.33 - 2.295 0.937500 374928 16.00 - 2.507 0.943750 377420 17.78 - 2.727 0.950000 379937 20.00 - 2.921 0.956250 382452 22.86 - 3.117 0.962500 384940 26.67 - 3.401 0.968750 387422 32.00 - 3.693 0.971875 388669 35.56 - 3.973 0.975000 389924 40.00 - 4.347 0.978125 391174 45.71 - 5.019 0.981250 392419 53.33 - 6.523 0.984375 393669 64.00 - 7.295 0.985938 394292 71.11 - 7.863 0.987500 394923 80.00 - 8.115 0.989062 395545 91.43 - 8.423 0.990625 396180 106.67 - 8.751 0.992188 396796 128.00 - 9.031 0.992969 397104 142.22 - 9.247 0.993750 397417 160.00 - 10.151 0.994531 397729 182.86 - 10.935 0.995313 398041 213.33 - 11.855 0.996094 398354 256.00 - 12.367 0.996484 398510 284.44 - 12.775 0.996875 398666 320.00 - 13.183 0.997266 398823 365.71 - 13.535 0.997656 398985 426.67 - 13.887 0.998047 399136 512.00 - 14.127 0.998242 399213 568.89 - 14.343 0.998437 399292 640.00 - 14.551 0.998633 399370 731.43 - 14.671 0.998828 399448 853.33 - 14.847 0.999023 399526 1024.00 - 14.911 0.999121 399565 1137.78 - 15.031 0.999219 399605 1280.00 - 15.119 0.999316 399642 1462.86 - 15.199 0.999414 399683 1706.67 - 15.391 0.999512 399720 2048.00 - 15.495 0.999561 399741 2275.56 - 15.591 0.999609 399759 2560.00 - 15.719 0.999658 399779 2925.71 - 15.831 0.999707 399798 3413.33 - 15.943 0.999756 399818 4096.00 - 16.007 0.999780 399828 4551.11 - 16.063 0.999805 399838 5120.00 - 16.119 0.999829 399848 5851.43 - 16.167 0.999854 399857 6826.67 - 16.199 0.999878 399868 8192.00 - 16.215 0.999890 399872 9102.22 - 16.239 0.999902 399877 10240.00 - 16.255 0.999915 399884 11702.86 - 16.263 0.999927 399892 13653.33 - 16.263 0.999939 399892 16384.00 - 16.271 0.999945 399895 18204.44 - 16.279 0.999951 399897 20480.00 - 16.287 0.999957 399898 23405.71 - 16.303 0.999963 399902 27306.67 - 16.311 0.999969 399903 32768.00 - 16.319 0.999973 399907 36408.89 - 16.319 0.999976 399907 40960.00 - 16.319 0.999979 399907 46811.43 - 16.327 0.999982 399908 54613.33 - 16.335 0.999985 399910 65536.00 - 16.335 0.999986 399910 72817.78 - 16.343 0.999988 399915 81920.00 - 16.343 1.000000 399915 inf -#[Mean = 1.048, StdDeviation = 1.367] -#[Max = 16.336, Total count = 399915] -#[Buckets = 27, SubBuckets = 2048] \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R50000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R50000.txt deleted file mode 100644 index d23beafb8..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d10-t1-c1-R50000.txt +++ /dev/null @@ -1,62 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.330 0.000000 1 1.00 - 128.191 0.100000 42548 1.11 - 258.559 0.200000 85107 1.25 - 402.175 0.300000 127689 1.43 - 552.959 0.400000 170536 1.67 - 707.583 0.500000 212744 2.00 - 794.111 0.550000 234219 2.22 - 855.039 0.600000 255291 2.50 - 948.223 0.650000 276598 2.86 - 1010.175 0.700000 297846 3.33 - 1115.135 0.750000 319252 4.00 - 1134.591 0.775000 330193 4.44 - 1179.647 0.800000 340610 5.00 - 1228.799 0.825000 351008 5.71 - 1276.927 0.850000 362231 6.67 - 1295.359 0.875000 372544 8.00 - 1307.647 0.887500 377666 8.89 - 1336.319 0.900000 382981 10.00 - 1362.943 0.912500 388256 11.43 - 1391.615 0.925000 393576 13.33 - 1417.215 0.937500 398940 16.00 - 1430.527 0.943750 401532 17.78 - 1436.671 0.950000 404243 20.00 - 1440.767 0.956250 406941 22.86 - 1446.911 0.962500 410022 26.67 - 1452.031 0.968750 412202 32.00 - 1457.151 0.971875 414208 35.56 - 1458.175 0.975000 415061 40.00 - 1460.223 0.978125 416630 45.71 - 1462.271 0.981250 417497 53.33 - 1465.343 0.984375 418886 64.00 - 1467.391 0.985938 419674 71.11 - 1470.463 0.987500 420171 80.00 - 1474.559 0.989062 421027 91.43 - 1477.631 0.990625 421524 106.67 - 1479.679 0.992188 422371 128.00 - 1480.703 0.992969 422793 142.22 - 1480.703 0.993750 422793 160.00 - 1481.727 0.994531 423241 182.86 - 1482.751 0.995313 423687 213.33 - 1483.775 0.996094 424096 256.00 - 1483.775 0.996484 424096 284.44 - 1484.799 0.996875 424310 320.00 - 1484.799 0.997266 424310 365.71 - 1485.823 0.997656 424495 426.67 - 1486.847 0.998047 424660 512.00 - 1487.871 0.998242 424822 568.89 - 1487.871 0.998437 424822 640.00 - 1488.895 0.998633 425035 731.43 - 1488.895 0.998828 425035 853.33 - 1488.895 0.999023 425035 1024.00 - 1489.919 0.999121 425285 1137.78 - 1489.919 0.999219 425285 1280.00 - 1489.919 0.999316 425285 1462.86 - 1489.919 0.999414 425285 1706.67 - 1489.919 0.999512 425285 2048.00 - 1489.919 0.999561 425285 2275.56 - 1489.919 0.999609 425285 2560.00 - 1490.943 0.999658 425442 2925.71 - 1490.943 1.000000 425442 inf \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d120-t1-c1-R40000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d120-t1-c1-R40000.txt deleted file mode 100644 index c4d65e06d..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d120-t1-c1-R40000.txt +++ /dev/null @@ -1,91 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.016 0.000000 20 1.00 - 0.213 0.100000 440996 1.11 - 0.386 0.200000 880258 1.25 - 0.552 0.300000 1320437 1.43 - 0.714 0.400000 1760160 1.67 - 0.873 0.500000 2202619 2.00 - 0.950 0.550000 2420198 2.22 - 1.029 0.600000 2640876 2.50 - 1.106 0.650000 2860785 2.86 - 1.217 0.700000 3080127 3.33 - 1.753 0.750000 3299932 4.00 - 2.867 0.775000 3409923 4.44 - 5.035 0.800000 3519941 5.00 - 7.051 0.825000 3629980 5.71 - 9.023 0.850000 3739970 6.67 - 11.007 0.875000 3850064 8.00 - 12.071 0.887500 3905125 8.89 - 13.311 0.900000 3959899 10.00 - 15.199 0.912500 4014974 11.43 - 21.423 0.925000 4069880 13.33 - 30.815 0.937500 4124911 16.00 - 37.119 0.943750 4152563 17.78 - 42.239 0.950000 4179903 20.00 - 48.895 0.956250 4207403 22.86 - 61.151 0.962500 4234840 26.67 - 69.759 0.968750 4262435 32.00 - 75.327 0.971875 4276077 35.56 - 82.751 0.975000 4289845 40.00 - 88.831 0.978125 4303684 45.71 - 93.567 0.981250 4317395 53.33 - 99.007 0.984375 4331079 64.00 - 103.039 0.985938 4337980 71.11 - 105.983 0.987500 4344949 80.00 - 107.583 0.989062 4351875 91.43 - 111.295 0.990625 4358601 106.67 - 120.447 0.992188 4365467 128.00 - 124.095 0.992969 4368885 142.22 - 128.703 0.993750 4372365 160.00 - 132.095 0.994531 4375787 182.86 - 134.527 0.995313 4379225 213.33 - 137.215 0.996094 4382656 256.00 - 139.007 0.996484 4384631 284.44 - 140.159 0.996875 4386105 320.00 - 141.439 0.997266 4387894 365.71 - 142.847 0.997656 4389533 426.67 - 145.023 0.998047 4391285 512.00 - 146.175 0.998242 4392154 568.89 - 147.199 0.998437 4393013 640.00 - 148.223 0.998633 4393883 731.43 - 150.399 0.998828 4394693 853.33 - 152.319 0.999023 4395534 1024.00 - 152.959 0.999121 4396012 1137.78 - 153.215 0.999219 4396487 1280.00 - 153.471 0.999316 4396904 1462.86 - 153.983 0.999414 4397290 1706.67 - 154.367 0.999512 4397905 2048.00 - 154.367 0.999561 4397905 2275.56 - 154.623 0.999609 4398218 2560.00 - 154.751 0.999658 4398604 2925.71 - 154.751 0.999707 4398604 3413.33 - 155.007 0.999756 4398924 4096.00 - 155.007 0.999780 4398924 4551.11 - 155.135 0.999805 4399000 5120.00 - 155.263 0.999829 4399075 5851.43 - 155.391 0.999854 4399186 6826.67 - 155.519 0.999878 4399312 8192.00 - 155.647 0.999890 4399623 9102.22 - 155.647 0.999902 4399623 10240.00 - 155.647 0.999915 4399623 11702.86 - 155.647 0.999927 4399623 13653.33 - 155.647 0.999939 4399623 16384.00 - 155.647 0.999945 4399623 18204.44 - 155.647 0.999951 4399623 20480.00 - 155.775 0.999957 4399700 23405.71 - 155.775 0.999963 4399700 27306.67 - 155.775 0.999969 4399700 32768.00 - 155.775 0.999973 4399700 36408.89 - 155.903 0.999976 4399778 40960.00 - 155.903 0.999979 4399778 46811.43 - 155.903 0.999982 4399778 54613.33 - 155.903 0.999985 4399778 65536.00 - 155.903 0.999986 4399778 72817.78 - 155.903 0.999988 4399778 81920.00 - 155.903 0.999989 4399778 93622.86 - 156.031 0.999991 4399819 109226.67 - 156.031 1.000000 4399819 inf -#[Mean = 7.034, StdDeviation = 20.115] -#[Max = 155.904, Total count = 4399819] -#[Buckets = 27, SubBuckets = 2048] \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d60-t1-c1-R40000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d60-t1-c1-R40000.txt deleted file mode 100644 index dd675c537..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/get-d60-t1-c1-R40000.txt +++ /dev/null @@ -1,107 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.016 0.000000 1 1.00 - 0.253 0.100000 200555 1.11 - 0.414 0.200000 401066 1.25 - 0.557 0.300000 601379 1.43 - 0.695 0.400000 800860 1.67 - 0.837 0.500000 1000624 2.00 - 0.906 0.550000 1101307 2.22 - 0.971 0.600000 1200141 2.50 - 1.034 0.650000 1300240 2.86 - 1.098 0.700000 1401436 3.33 - 1.157 0.750000 1500192 4.00 - 1.197 0.775000 1550893 4.44 - 1.243 0.800000 1600017 5.00 - 1.296 0.825000 1650197 5.71 - 1.357 0.850000 1700513 6.67 - 1.426 0.875000 1750395 8.00 - 1.464 0.887500 1775416 8.89 - 1.510 0.900000 1800270 10.00 - 1.564 0.912500 1825128 11.43 - 1.626 0.925000 1850039 13.33 - 1.709 0.937500 1874919 16.00 - 1.758 0.943750 1887409 17.78 - 1.819 0.950000 1899822 20.00 - 1.901 0.956250 1912437 22.86 - 2.007 0.962500 1924883 26.67 - 2.151 0.968750 1937397 32.00 - 2.239 0.971875 1943630 35.56 - 2.349 0.975000 1949819 40.00 - 2.457 0.978125 1956171 45.71 - 2.575 0.981250 1962343 53.33 - 2.709 0.984375 1968645 64.00 - 2.783 0.985938 1971733 71.11 - 2.889 0.987500 1974830 80.00 - 3.041 0.989062 1977958 91.43 - 3.163 0.990625 1981068 106.67 - 3.259 0.992188 1984252 128.00 - 3.305 0.992969 1985804 142.22 - 3.351 0.993750 1987349 160.00 - 3.399 0.994531 1988907 182.86 - 3.457 0.995313 1990450 213.33 - 3.519 0.996094 1992003 256.00 - 3.555 0.996484 1992812 284.44 - 3.593 0.996875 1993577 320.00 - 3.637 0.997266 1994356 365.71 - 3.677 0.997656 1995134 426.67 - 3.729 0.998047 1995913 512.00 - 3.761 0.998242 1996317 568.89 - 3.801 0.998437 1996693 640.00 - 3.845 0.998633 1997085 731.43 - 3.885 0.998828 1997480 853.33 - 3.925 0.999023 1997861 1024.00 - 3.955 0.999121 1998060 1137.78 - 3.983 0.999219 1998257 1280.00 - 4.021 0.999316 1998444 1462.86 - 4.065 0.999414 1998636 1706.67 - 4.099 0.999512 1998836 2048.00 - 4.119 0.999561 1998950 2275.56 - 4.131 0.999609 1999047 2560.00 - 4.147 0.999658 1999136 2925.71 - 4.179 0.999707 1999226 3413.33 - 4.199 0.999756 1999323 4096.00 - 4.211 0.999780 1999374 4551.11 - 4.235 0.999805 1999418 5120.00 - 4.255 0.999829 1999472 5851.43 - 4.271 0.999854 1999517 6826.67 - 4.291 0.999878 1999564 8192.00 - 4.303 0.999890 1999588 9102.22 - 4.319 0.999902 1999615 10240.00 - 4.339 0.999915 1999640 11702.86 - 4.375 0.999927 1999662 13653.33 - 4.391 0.999939 1999690 16384.00 - 4.399 0.999945 1999707 18204.44 - 4.403 0.999951 1999715 20480.00 - 4.407 0.999957 1999722 23405.71 - 4.415 0.999963 1999735 27306.67 - 4.423 0.999969 1999749 32768.00 - 4.431 0.999973 1999760 36408.89 - 4.431 0.999976 1999760 40960.00 - 4.435 0.999979 1999767 46811.43 - 4.443 0.999982 1999772 54613.33 - 4.455 0.999985 1999778 65536.00 - 4.459 0.999986 1999780 72817.78 - 4.463 0.999988 1999785 81920.00 - 4.467 0.999989 1999789 93622.86 - 4.467 0.999991 1999789 109226.67 - 4.471 0.999992 1999792 131072.00 - 4.475 0.999993 1999796 145635.56 - 4.475 0.999994 1999796 163840.00 - 4.479 0.999995 1999797 187245.71 - 4.483 0.999995 1999799 218453.33 - 4.487 0.999996 1999803 262144.00 - 4.487 0.999997 1999803 291271.11 - 4.487 0.999997 1999803 327680.00 - 4.487 0.999997 1999803 374491.43 - 4.487 0.999998 1999803 436906.67 - 4.491 0.999998 1999805 524288.00 - 4.491 0.999998 1999805 582542.22 - 4.491 0.999998 1999805 655360.00 - 4.491 0.999999 1999805 748982.86 - 4.491 0.999999 1999805 873813.33 - 4.495 0.999999 1999807 1048576.00 - 4.495 1.000000 1999807 inf -#[Mean = 0.890, StdDeviation = 0.568] -#[Max = 4.492, Total count = 1999807] -#[Buckets = 27, SubBuckets = 2048] \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R100.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R100.txt deleted file mode 100644 index ac84996f8..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R100.txt +++ /dev/null @@ -1,54 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.166 0.000000 1 1.00 - 0.905 0.100000 100 1.11 - 1.194 0.200000 200 1.25 - 1.324 0.300000 301 1.43 - 1.420 0.400000 400 1.67 - 1.543 0.500000 501 2.00 - 1.598 0.550000 550 2.22 - 1.659 0.600000 600 2.50 - 1.709 0.650000 650 2.86 - 1.767 0.700000 700 3.33 - 1.840 0.750000 750 4.00 - 1.880 0.775000 776 4.44 - 1.916 0.800000 800 5.00 - 1.952 0.825000 825 5.71 - 1.999 0.850000 850 6.67 - 2.041 0.875000 875 8.00 - 2.059 0.887500 888 8.89 - 2.075 0.900000 901 10.00 - 2.097 0.912500 914 11.43 - 2.113 0.925000 925 13.33 - 2.137 0.937500 939 16.00 - 2.141 0.943750 945 17.78 - 2.153 0.950000 951 20.00 - 2.163 0.956250 958 22.86 - 2.171 0.962500 963 26.67 - 2.185 0.968750 969 32.00 - 2.191 0.971875 973 35.56 - 2.197 0.975000 976 40.00 - 2.215 0.978125 979 45.71 - 2.225 0.981250 982 53.33 - 2.243 0.984375 985 64.00 - 2.253 0.985938 986 71.11 - 2.255 0.987500 989 80.00 - 2.259 0.989062 990 91.43 - 2.271 0.990625 991 106.67 - 2.287 0.992188 993 128.00 - 2.287 0.992969 993 142.22 - 2.289 0.993750 994 160.00 - 2.295 0.994531 995 182.86 - 2.319 0.995313 997 213.33 - 2.319 0.996094 997 256.00 - 2.319 0.996484 997 284.44 - 2.319 0.996875 997 320.00 - 2.415 0.997266 998 365.71 - 2.415 0.997656 998 426.67 - 2.653 0.998047 999 512.00 - 2.653 0.998242 999 568.89 - 2.653 0.998437 999 640.00 - 2.653 0.998633 999 731.43 - 2.653 0.998828 999 853.33 - 5.323 0.999023 1000 1024.00 - 5.323 1.000000 1000 inf \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R10000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R10000.txt deleted file mode 100644 index 051151f72..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R10000.txt +++ /dev/null @@ -1,88 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.031 0.000000 1 1.00 - 0.193 0.100000 10058 1.11 - 0.312 0.200000 20041 1.25 - 0.429 0.300000 30059 1.43 - 0.546 0.400000 39996 1.67 - 0.664 0.500000 50071 2.00 - 0.722 0.550000 55029 2.22 - 0.781 0.600000 60073 2.50 - 0.839 0.650000 65018 2.86 - 0.897 0.700000 70063 3.33 - 0.955 0.750000 75040 4.00 - 0.984 0.775000 77535 4.44 - 1.013 0.800000 80040 5.00 - 1.041 0.825000 82569 5.71 - 1.069 0.850000 85007 6.67 - 1.098 0.875000 87587 8.00 - 1.112 0.887500 88829 8.89 - 1.125 0.900000 90030 10.00 - 1.139 0.912500 91334 11.43 - 1.152 0.925000 92577 13.33 - 1.166 0.937500 93785 16.00 - 1.173 0.943750 94414 17.78 - 1.180 0.950000 95059 20.00 - 1.187 0.956250 95663 22.86 - 1.194 0.962500 96303 26.67 - 1.201 0.968750 96913 32.00 - 1.205 0.971875 97213 35.56 - 1.209 0.975000 97531 40.00 - 1.214 0.978125 97838 45.71 - 1.220 0.981250 98135 53.33 - 1.232 0.984375 98434 64.00 - 1.247 0.985938 98587 71.11 - 1.274 0.987500 98741 80.00 - 1.345 0.989062 98895 91.43 - 1.533 0.990625 99053 106.67 - 1.830 0.992188 99207 128.00 - 2.051 0.992969 99285 142.22 - 2.403 0.993750 99364 160.00 - 2.857 0.994531 99442 182.86 - 3.427 0.995313 99520 213.33 - 3.937 0.996094 99598 256.00 - 4.107 0.996484 99637 284.44 - 4.311 0.996875 99676 320.00 - 4.523 0.997266 99715 365.71 - 4.723 0.997656 99754 426.67 - 4.959 0.998047 99793 512.00 - 5.195 0.998242 99813 568.89 - 5.371 0.998437 99832 640.00 - 5.539 0.998633 99852 731.43 - 5.671 0.998828 99871 853.33 - 5.835 0.999023 99891 1024.00 - 5.971 0.999121 99901 1137.78 - 6.139 0.999219 99910 1280.00 - 6.319 0.999316 99920 1462.86 - 6.519 0.999414 99930 1706.67 - 6.675 0.999512 99940 2048.00 - 6.723 0.999561 99945 2275.56 - 6.775 0.999609 99949 2560.00 - 6.843 0.999658 99954 2925.71 - 6.899 0.999707 99959 3413.33 - 6.931 0.999756 99964 4096.00 - 6.947 0.999780 99967 4551.11 - 6.955 0.999805 99969 5120.00 - 6.967 0.999829 99971 5851.43 - 7.003 0.999854 99974 6826.67 - 7.015 0.999878 99976 8192.00 - 7.031 0.999890 99978 9102.22 - 7.039 0.999902 99979 10240.00 - 7.047 0.999915 99980 11702.86 - 7.059 0.999927 99981 13653.33 - 7.079 0.999939 99983 16384.00 - 7.079 0.999945 99983 18204.44 - 7.083 0.999951 99984 20480.00 - 7.083 0.999957 99984 23405.71 - 7.115 0.999963 99985 27306.67 - 7.115 0.999969 99985 32768.00 - 7.147 0.999973 99986 36408.89 - 7.147 0.999976 99986 40960.00 - 7.147 0.999979 99986 46811.43 - 7.175 0.999982 99987 54613.33 - 7.175 0.999985 99987 65536.00 - 7.175 0.999986 99987 72817.78 - 7.175 0.999988 99987 81920.00 - 7.175 0.999989 99987 93622.86 - 7.179 0.999991 99988 109226.67 - 7.179 1.000000 99988 inf \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R40000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R40000.txt deleted file mode 100644 index 6c71e8b8d..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R40000.txt +++ /dev/null @@ -1,79 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.017 0.000000 2 1.00 - 0.420 0.100000 40014 1.11 - 0.759 0.200000 79979 1.25 - 1.056 0.300000 120001 1.43 - 1.594 0.400000 159952 1.67 - 2.499 0.500000 199928 2.00 - 3.115 0.550000 219915 2.22 - 3.761 0.600000 239910 2.50 - 4.471 0.650000 259905 2.86 - 5.139 0.700000 279978 3.33 - 6.063 0.750000 299912 4.00 - 6.503 0.775000 309921 4.44 - 6.927 0.800000 319872 5.00 - 7.387 0.825000 329861 5.71 - 7.891 0.850000 339899 6.67 - 8.407 0.875000 349911 8.00 - 8.687 0.887500 354963 8.89 - 9.015 0.900000 359906 10.00 - 9.359 0.912500 364971 11.43 - 9.655 0.925000 369838 13.33 - 10.039 0.937500 374839 16.00 - 10.359 0.943750 377330 17.78 - 10.695 0.950000 379840 20.00 - 11.007 0.956250 382388 22.86 - 11.391 0.962500 384868 26.67 - 12.143 0.968750 387330 32.00 - 13.063 0.971875 388586 35.56 - 14.023 0.975000 389826 40.00 - 15.007 0.978125 391075 45.71 - 16.335 0.981250 392318 53.33 - 18.255 0.984375 393569 64.00 - 19.903 0.985938 394196 71.11 - 21.455 0.987500 394820 80.00 - 22.847 0.989062 395443 91.43 - 24.271 0.990625 396070 106.67 - 25.615 0.992188 396701 128.00 - 26.127 0.992969 397010 142.22 - 26.719 0.993750 397330 160.00 - 27.263 0.994531 397633 182.86 - 27.807 0.995313 397948 213.33 - 27.983 0.996094 398261 256.00 - 28.031 0.996484 398434 284.44 - 28.079 0.996875 398611 320.00 - 28.159 0.997266 398764 365.71 - 28.191 0.997656 398879 426.67 - 28.255 0.998047 399069 512.00 - 28.271 0.998242 399149 568.89 - 28.287 0.998437 399222 640.00 - 28.319 0.998633 399283 731.43 - 28.351 0.998828 399378 853.33 - 28.367 0.999023 399426 1024.00 - 28.383 0.999121 399482 1137.78 - 28.399 0.999219 399503 1280.00 - 28.447 0.999316 399556 1462.86 - 28.479 0.999414 399588 1706.67 - 28.527 0.999512 399632 2048.00 - 28.543 0.999561 399662 2275.56 - 28.543 0.999609 399662 2560.00 - 28.559 0.999658 399689 2925.71 - 28.591 0.999707 399710 3413.33 - 28.607 0.999756 399746 4096.00 - 28.607 0.999780 399746 4551.11 - 28.607 0.999805 399746 5120.00 - 28.607 0.999829 399746 5851.43 - 28.623 0.999854 399794 6826.67 - 28.623 0.999878 399794 8192.00 - 28.623 0.999890 399794 9102.22 - 28.623 0.999902 399794 10240.00 - 28.623 0.999915 399794 11702.86 - 28.623 0.999927 399794 13653.33 - 28.623 0.999939 399794 16384.00 - 28.623 0.999945 399794 18204.44 - 28.639 0.999951 399814 20480.00 - 28.639 1.000000 399814 inf -#[Mean = 3.967, StdDeviation = 4.269] -#[Max = 28.624, Total count = 399814] -#[Buckets = 27, SubBuckets = 2048] \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R50000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R50000.txt deleted file mode 100644 index a7680f3c3..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d10-t1-c1-R50000.txt +++ /dev/null @@ -1,63 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.421 0.000000 1 1.00 - 380.159 0.100000 31922 1.11 - 762.367 0.200000 63882 1.25 - 1139.711 0.300000 95810 1.43 - 1519.615 0.400000 127707 1.67 - 1851.391 0.500000 159659 2.00 - 2028.543 0.550000 175608 2.22 - 2191.359 0.600000 191660 2.50 - 2371.583 0.650000 207584 2.86 - 2545.663 0.700000 223534 3.33 - 2727.935 0.750000 239530 4.00 - 2811.903 0.775000 247393 4.44 - 2891.775 0.800000 255541 5.00 - 2979.839 0.825000 263435 5.71 - 3067.903 0.850000 271345 6.67 - 3160.063 0.875000 279409 8.00 - 3205.119 0.887500 283385 8.89 - 3250.175 0.900000 287322 10.00 - 3297.279 0.912500 291436 11.43 - 3342.335 0.925000 295353 13.33 - 3389.439 0.937500 299263 16.00 - 3411.967 0.943750 301311 17.78 - 3434.495 0.950000 303268 20.00 - 3459.071 0.956250 305319 22.86 - 3481.599 0.962500 307241 26.67 - 3504.127 0.968750 309357 32.00 - 3514.367 0.971875 310263 35.56 - 3526.655 0.975000 311351 40.00 - 3536.895 0.978125 312205 45.71 - 3549.183 0.981250 313306 53.33 - 3561.471 0.984375 314338 64.00 - 3565.567 0.985938 314720 71.11 - 3571.711 0.987500 315325 80.00 - 3577.855 0.989062 315828 91.43 - 3583.999 0.990625 316375 106.67 - 3588.095 0.992188 316737 128.00 - 3592.191 0.992969 317104 142.22 - 3594.239 0.993750 317280 160.00 - 3596.287 0.994531 317473 182.86 - 3600.383 0.995313 317839 213.33 - 3602.431 0.996094 318015 256.00 - 3604.479 0.996484 318186 284.44 - 3606.527 0.996875 318372 320.00 - 3606.527 0.997266 318372 365.71 - 3608.575 0.997656 318562 426.67 - 3608.575 0.998047 318562 512.00 - 3610.623 0.998242 318739 568.89 - 3610.623 0.998437 318739 640.00 - 3612.671 0.998633 318925 731.43 - 3612.671 0.998828 318925 853.33 - 3612.671 0.999023 318925 1024.00 - 3612.671 0.999121 318925 1137.78 - 3614.719 0.999219 319083 1280.00 - 3614.719 0.999316 319083 1462.86 - 3614.719 0.999414 319083 1706.67 - 3614.719 0.999512 319083 2048.00 - 3614.719 0.999561 319083 2275.56 - 3614.719 0.999609 319083 2560.00 - 3614.719 0.999658 319083 2925.71 - 3616.767 0.999707 319185 3413.33 - 3616.767 1.000000 319185 inf \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d120-t1-c1-R40000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d120-t1-c1-R40000.txt deleted file mode 100644 index 8bb025166..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d120-t1-c1-R40000.txt +++ /dev/null @@ -1,78 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.016 0.000000 5 1.00 - 0.259 0.100000 441215 1.11 - 0.473 0.200000 881924 1.25 - 0.677 0.300000 1321517 1.43 - 0.872 0.400000 1760839 1.67 - 1.065 0.500000 2202054 2.00 - 1.161 0.550000 2420222 2.22 - 1.549 0.600000 2640476 2.50 - 2.227 0.650000 2860146 2.86 - 3.195 0.700000 3080457 3.33 - 4.447 0.750000 3300370 4.00 - 5.179 0.775000 3410544 4.44 - 6.003 0.800000 3520343 5.00 - 6.951 0.825000 3630357 5.71 - 8.303 0.850000 3740342 6.67 - 10.383 0.875000 3850302 8.00 - 12.175 0.887500 3905235 8.89 - 15.295 0.900000 3960270 10.00 - 18.639 0.912500 4015331 11.43 - 22.623 0.925000 4070287 13.33 - 30.943 0.937500 4125314 16.00 - 39.519 0.943750 4152743 17.78 - 49.407 0.950000 4180178 20.00 - 61.599 0.956250 4207769 22.86 - 78.527 0.962500 4235201 26.67 - 93.375 0.968750 4262743 32.00 - 100.287 0.971875 4276483 35.56 - 110.463 0.975000 4290234 40.00 - 116.991 0.978125 4303956 45.71 - 120.511 0.981250 4317732 53.33 - 124.031 0.984375 4331509 64.00 - 128.319 0.985938 4338306 71.11 - 131.199 0.987500 4345263 80.00 - 133.247 0.989062 4352516 91.43 - 133.887 0.990625 4359119 106.67 - 135.167 0.992188 4366835 128.00 - 135.551 0.992969 4369848 142.22 - 137.087 0.993750 4372749 160.00 - 145.535 0.994531 4376148 182.86 - 154.111 0.995313 4379638 213.33 - 161.535 0.996094 4382991 256.00 - 165.503 0.996484 4384724 284.44 - 169.087 0.996875 4386444 320.00 - 171.519 0.997266 4388334 365.71 - 174.335 0.997656 4389901 426.67 - 177.279 0.998047 4391608 512.00 - 178.431 0.998242 4392482 568.89 - 179.967 0.998437 4393347 640.00 - 181.503 0.998633 4394284 731.43 - 182.783 0.998828 4395063 853.33 - 183.935 0.999023 4395899 1024.00 - 184.319 0.999121 4396379 1137.78 - 184.831 0.999219 4396757 1280.00 - 185.471 0.999316 4397247 1462.86 - 185.983 0.999414 4397642 1706.67 - 186.367 0.999512 4398087 2048.00 - 186.495 0.999561 4398299 2275.56 - 186.623 0.999609 4398555 2560.00 - 186.751 0.999658 4398894 2925.71 - 186.751 0.999707 4398894 3413.33 - 186.879 0.999756 4399165 4096.00 - 187.007 0.999780 4399505 4551.11 - 187.007 0.999805 4399505 5120.00 - 187.007 0.999829 4399505 5851.43 - 187.135 0.999854 4399569 6826.67 - 187.391 0.999878 4399672 8192.00 - 187.519 0.999890 4399916 9102.22 - 187.519 0.999902 4399916 10240.00 - 187.519 0.999915 4399916 11702.86 - 187.519 0.999927 4399916 13653.33 - 187.519 0.999939 4399916 16384.00 - 187.647 0.999945 4400179 18204.44 - 187.647 1.000000 4400179 inf -#[Mean = 8.598, StdDeviation = 24.583] -#[Max = 187.520, Total count = 4400179] -#[Buckets = 27, SubBuckets = 2048] \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d60-t1-c1-R40000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d60-t1-c1-R40000.txt deleted file mode 100644 index 1a2517845..000000000 --- a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/put-d60-t1-c1-R40000.txt +++ /dev/null @@ -1,77 +0,0 @@ - Value Percentile TotalCount 1/(1-Percentile) - - 0.016 0.000000 2 1.00 - 0.286 0.100000 200429 1.11 - 0.523 0.200000 400474 1.25 - 0.753 0.300000 600809 1.43 - 0.969 0.400000 800367 1.67 - 1.233 0.500000 999949 2.00 - 2.005 0.550000 1099852 2.22 - 3.645 0.600000 1199824 2.50 - 6.699 0.650000 1299825 2.86 - 13.223 0.700000 1399761 3.33 - 19.327 0.750000 1499818 4.00 - 23.039 0.775000 1549729 4.44 - 26.847 0.800000 1599887 5.00 - 30.399 0.825000 1649819 5.71 - 37.407 0.850000 1699878 6.67 - 45.823 0.875000 1749695 8.00 - 49.791 0.887500 1774938 8.89 - 53.855 0.900000 1799829 10.00 - 57.311 0.912500 1824690 11.43 - 61.855 0.925000 1849786 13.33 - 68.031 0.937500 1874742 16.00 - 72.063 0.943750 1887506 17.78 - 76.479 0.950000 1899670 20.00 - 84.543 0.956250 1912165 22.86 - 89.855 0.962500 1924932 26.67 - 93.119 0.968750 1937230 32.00 - 96.511 0.971875 1943425 35.56 - 100.223 0.975000 1949661 40.00 - 104.575 0.978125 1955901 45.71 - 118.207 0.981250 1962171 53.33 - 132.095 0.984375 1968398 64.00 - 136.959 0.985938 1971548 71.11 - 144.639 0.987500 1974693 80.00 - 151.039 0.989062 1977831 91.43 - 152.575 0.990625 1981187 106.67 - 154.111 0.992188 1984069 128.00 - 154.879 0.992969 1985704 142.22 - 155.263 0.993750 1987248 160.00 - 155.647 0.994531 1989050 182.86 - 158.079 0.995313 1990395 213.33 - 160.639 0.996094 1991865 256.00 - 162.047 0.996484 1992644 284.44 - 163.583 0.996875 1993479 320.00 - 165.119 0.997266 1994276 365.71 - 166.655 0.997656 1994978 426.67 - 168.191 0.998047 1995745 512.00 - 168.831 0.998242 1996133 568.89 - 169.343 0.998437 1996520 640.00 - 170.111 0.998633 1996948 731.43 - 170.751 0.998828 1997367 853.33 - 171.135 0.999023 1997716 1024.00 - 171.647 0.999121 1997899 1137.78 - 172.159 0.999219 1998290 1280.00 - 172.159 0.999316 1998290 1462.86 - 172.287 0.999414 1998722 1706.67 - 172.287 0.999512 1998722 2048.00 - 172.415 0.999561 1998936 2275.56 - 172.415 0.999609 1998936 2560.00 - 172.543 0.999658 1999102 2925.71 - 172.543 0.999707 1999102 3413.33 - 172.671 0.999756 1999344 4096.00 - 172.671 0.999780 1999344 4551.11 - 172.671 0.999805 1999344 5120.00 - 172.671 0.999829 1999344 5851.43 - 172.799 0.999854 1999505 6826.67 - 172.799 0.999878 1999505 8192.00 - 172.799 0.999890 1999505 9102.22 - 172.799 0.999902 1999505 10240.00 - 172.799 0.999915 1999505 11702.86 - 172.799 0.999927 1999505 13653.33 - 172.927 0.999939 1999639 16384.00 - 172.927 1.000000 1999639 inf -#[Mean = 15.927, StdDeviation = 28.967] -#[Max = 172.800, Total count = 1999639] -#[Buckets = 27, SubBuckets = 2048] \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/async/get/async-get-d60-t64-c64-R20000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/async/get/async-get-d60-t64-c64-R20000.txt new file mode 100644 index 000000000..1a4c70eec --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/async/get/async-get-d60-t64-c64-R20000.txt @@ -0,0 +1,107 @@ + Value Percentile TotalCount 1/(1-Percentile) + + 0.076 0.000000 1 1.00 + 0.465 0.100000 100705 1.11 + 0.582 0.200000 200325 1.25 + 0.692 0.300000 300737 1.43 + 0.801 0.400000 400496 1.67 + 0.911 0.500000 500028 2.00 + 0.967 0.550000 550661 2.22 + 1.022 0.600000 600744 2.50 + 1.077 0.650000 650755 2.86 + 1.131 0.700000 699969 3.33 + 1.187 0.750000 750550 4.00 + 1.214 0.775000 774858 4.44 + 1.243 0.800000 799935 5.00 + 1.273 0.825000 825133 5.71 + 1.304 0.850000 850120 6.67 + 1.337 0.875000 875289 8.00 + 1.354 0.887500 887455 8.89 + 1.372 0.900000 900224 10.00 + 1.390 0.912500 912488 11.43 + 1.410 0.925000 925164 13.33 + 1.431 0.937500 937841 16.00 + 1.442 0.943750 943980 17.78 + 1.453 0.950000 949860 20.00 + 1.466 0.956250 956433 22.86 + 1.479 0.962500 962556 26.67 + 1.494 0.968750 968718 32.00 + 1.502 0.971875 971698 35.56 + 1.512 0.975000 975019 40.00 + 1.522 0.978125 978091 45.71 + 1.534 0.981250 981255 53.33 + 1.547 0.984375 984296 64.00 + 1.554 0.985938 985742 71.11 + 1.563 0.987500 987422 80.00 + 1.572 0.989062 988990 91.43 + 1.583 0.990625 990522 106.67 + 1.595 0.992188 991992 128.00 + 1.603 0.992969 992846 142.22 + 1.611 0.993750 993619 160.00 + 1.620 0.994531 994392 182.86 + 1.630 0.995313 995125 213.33 + 1.644 0.996094 995921 256.00 + 1.652 0.996484 996313 284.44 + 1.661 0.996875 996709 320.00 + 1.672 0.997266 997092 365.71 + 1.686 0.997656 997457 426.67 + 1.705 0.998047 997856 512.00 + 1.719 0.998242 998052 568.89 + 1.737 0.998437 998246 640.00 + 1.774 0.998633 998435 731.43 + 1.863 0.998828 998628 853.33 + 2.123 0.999023 998823 1024.00 + 2.327 0.999121 998922 1137.78 + 2.661 0.999219 999018 1280.00 + 3.231 0.999316 999116 1462.86 + 4.057 0.999414 999214 1706.67 + 5.167 0.999512 999311 2048.00 + 5.719 0.999561 999360 2275.56 + 6.359 0.999609 999409 2560.00 + 7.111 0.999658 999459 2925.71 + 7.675 0.999707 999508 3413.33 + 8.167 0.999756 999555 4096.00 + 8.399 0.999780 999580 4551.11 + 8.815 0.999805 999604 5120.00 + 9.159 0.999829 999629 5851.43 + 9.559 0.999854 999654 6826.67 + 9.807 0.999878 999678 8192.00 + 10.063 0.999890 999690 9102.22 + 10.271 0.999902 999702 10240.00 + 10.511 0.999915 999715 11702.86 + 10.719 0.999927 999726 13653.33 + 11.039 0.999939 999738 16384.00 + 11.311 0.999945 999745 18204.44 + 11.391 0.999951 999751 20480.00 + 11.527 0.999957 999757 23405.71 + 11.791 0.999963 999763 27306.67 + 11.887 0.999969 999769 32768.00 + 11.935 0.999973 999772 36408.89 + 12.055 0.999976 999776 40960.00 + 12.143 0.999979 999778 46811.43 + 12.263 0.999982 999781 54613.33 + 12.375 0.999985 999784 65536.00 + 12.791 0.999986 999786 72817.78 + 12.839 0.999988 999787 81920.00 + 12.951 0.999989 999789 93622.86 + 13.143 0.999991 999790 109226.67 + 13.311 0.999992 999792 131072.00 + 13.343 0.999993 999793 145635.56 + 13.343 0.999994 999793 163840.00 + 13.671 0.999995 999794 187245.71 + 13.783 0.999995 999795 218453.33 + 14.039 0.999996 999796 262144.00 + 14.039 0.999997 999796 291271.11 + 14.039 0.999997 999796 327680.00 + 14.047 0.999997 999797 374491.43 + 14.047 0.999998 999797 436906.67 + 14.119 0.999998 999798 524288.00 + 14.119 0.999998 999798 582542.22 + 14.119 0.999998 999798 655360.00 + 14.119 0.999999 999798 748982.86 + 14.119 0.999999 999798 873813.33 + 14.935 0.999999 999799 1048576.00 + 14.935 1.000000 999799 inf +#[Mean = 0.918, StdDeviation = 0.382] +#[Max = 14.928, Total count = 999799] +#[Buckets = 27, SubBuckets = 2048] diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/async/put/async-put-d60-t64-c64-R20000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/async/put/async-put-d60-t64-c64-R20000.txt new file mode 100644 index 000000000..cbbdf03bb --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/async/put/async-put-d60-t64-c64-R20000.txt @@ -0,0 +1,107 @@ + Value Percentile TotalCount 1/(1-Percentile) + + 0.087 0.000000 1 1.00 + 0.493 0.100000 100661 1.11 + 0.611 0.200000 200020 1.25 + 0.722 0.300000 300795 1.43 + 0.832 0.400000 400580 1.67 + 0.943 0.500000 500765 2.00 + 0.997 0.550000 550002 2.22 + 1.052 0.600000 600151 2.50 + 1.107 0.650000 650539 2.86 + 1.161 0.700000 700036 3.33 + 1.217 0.750000 750322 4.00 + 1.246 0.775000 775513 4.44 + 1.275 0.800000 800107 5.00 + 1.306 0.825000 825354 5.71 + 1.338 0.850000 850516 6.67 + 1.371 0.875000 875073 8.00 + 1.389 0.887500 887976 8.89 + 1.407 0.900000 900261 10.00 + 1.426 0.912500 912615 11.43 + 1.446 0.925000 925225 13.33 + 1.467 0.937500 937627 16.00 + 1.478 0.943750 943850 17.78 + 1.489 0.950000 949796 20.00 + 1.503 0.956250 956453 22.86 + 1.517 0.962500 962543 26.67 + 1.534 0.968750 968689 32.00 + 1.544 0.971875 971867 35.56 + 1.555 0.975000 975062 40.00 + 1.567 0.978125 978099 45.71 + 1.581 0.981250 981236 53.33 + 1.597 0.984375 984190 64.00 + 1.607 0.985938 985800 71.11 + 1.618 0.987500 987378 80.00 + 1.630 0.989062 988876 91.43 + 1.645 0.990625 990464 106.67 + 1.663 0.992188 991981 128.00 + 1.674 0.992969 992752 142.22 + 1.688 0.993750 993532 160.00 + 1.707 0.994531 994332 182.86 + 1.733 0.995313 995096 213.33 + 1.780 0.996094 995866 256.00 + 1.824 0.996484 996258 284.44 + 1.937 0.996875 996646 320.00 + 2.097 0.997266 997039 365.71 + 2.329 0.997656 997429 426.67 + 2.607 0.998047 997819 512.00 + 2.775 0.998242 998018 568.89 + 2.965 0.998437 998210 640.00 + 3.171 0.998633 998404 731.43 + 3.417 0.998828 998600 853.33 + 3.711 0.999023 998796 1024.00 + 3.881 0.999121 998893 1137.78 + 4.051 0.999219 998989 1280.00 + 4.243 0.999316 999089 1462.86 + 4.483 0.999414 999185 1706.67 + 4.799 0.999512 999284 2048.00 + 4.983 0.999561 999331 2275.56 + 5.227 0.999609 999381 2560.00 + 5.427 0.999658 999429 2925.71 + 5.763 0.999707 999479 3413.33 + 6.079 0.999756 999527 4096.00 + 6.255 0.999780 999552 4551.11 + 6.447 0.999805 999575 5120.00 + 6.723 0.999829 999600 5851.43 + 7.051 0.999854 999624 6826.67 + 7.379 0.999878 999648 8192.00 + 7.615 0.999890 999662 9102.22 + 7.807 0.999902 999673 10240.00 + 8.087 0.999915 999685 11702.86 + 8.327 0.999927 999697 13653.33 + 8.655 0.999939 999709 16384.00 + 9.183 0.999945 999716 18204.44 + 9.319 0.999951 999722 20480.00 + 9.591 0.999957 999728 23405.71 + 10.031 0.999963 999734 27306.67 + 10.311 0.999969 999740 32768.00 + 10.431 0.999973 999743 36408.89 + 10.527 0.999976 999746 40960.00 + 10.743 0.999979 999749 46811.43 + 10.831 0.999982 999752 54613.33 + 10.911 0.999985 999755 65536.00 + 10.975 0.999986 999757 72817.78 + 11.071 0.999988 999758 81920.00 + 11.135 0.999989 999760 93622.86 + 11.327 0.999991 999761 109226.67 + 11.383 0.999992 999763 131072.00 + 11.495 0.999993 999764 145635.56 + 11.495 0.999994 999764 163840.00 + 11.519 0.999995 999765 187245.71 + 11.687 0.999995 999766 218453.33 + 11.951 0.999996 999767 262144.00 + 11.951 0.999997 999767 291271.11 + 11.951 0.999997 999767 327680.00 + 12.119 0.999997 999768 374491.43 + 12.119 0.999998 999768 436906.67 + 12.351 0.999998 999769 524288.00 + 12.351 0.999998 999769 582542.22 + 12.351 0.999998 999769 655360.00 + 12.351 0.999999 999769 748982.86 + 12.351 0.999999 999769 873813.33 + 13.263 0.999999 999770 1048576.00 + 13.263 1.000000 999770 inf +#[Mean = 0.951, StdDeviation = 0.379] +#[Max = 13.256, Total count = 999770] +#[Buckets = 27, SubBuckets = 2048] diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/async/put/async-put-d60-t64-c64-R40000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/async/put/async-put-d60-t64-c64-R40000.txt new file mode 100644 index 000000000..13b3685f0 --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/async/put/async-put-d60-t64-c64-R40000.txt @@ -0,0 +1,112 @@ + Value Percentile TotalCount 1/(1-Percentile) + + 0.050 0.000000 1 1.00 + 0.461 0.100000 199964 1.11 + 0.602 0.200000 401171 1.25 + 0.722 0.300000 600971 1.43 + 0.834 0.400000 800454 1.67 + 0.944 0.500000 1000765 2.00 + 1.000 0.550000 1100740 2.22 + 1.058 0.600000 1200904 2.50 + 1.116 0.650000 1300697 2.86 + 1.174 0.700000 1400669 3.33 + 1.233 0.750000 1500674 4.00 + 1.263 0.775000 1549790 4.44 + 1.295 0.800000 1601075 5.00 + 1.327 0.825000 1649874 5.71 + 1.366 0.850000 1700230 6.67 + 1.414 0.875000 1750287 8.00 + 1.442 0.887500 1774644 8.89 + 1.475 0.900000 1799702 10.00 + 1.513 0.912500 1824920 11.43 + 1.558 0.925000 1849914 13.33 + 1.612 0.937500 1874486 16.00 + 1.645 0.943750 1887006 17.78 + 1.683 0.950000 1899513 20.00 + 1.730 0.956250 1912142 22.86 + 1.787 0.962500 1924456 26.67 + 1.866 0.968750 1936994 32.00 + 1.923 0.971875 1943222 35.56 + 2.000 0.975000 1949492 40.00 + 2.121 0.978125 1955727 45.71 + 2.351 0.981250 1961949 53.33 + 2.849 0.984375 1968195 64.00 + 3.211 0.985938 1971313 71.11 + 3.695 0.987500 1974437 80.00 + 4.551 0.989062 1977566 91.43 + 6.303 0.990625 1980683 106.67 + 8.463 0.992188 1983810 128.00 + 9.919 0.992969 1985372 142.22 + 12.351 0.993750 1986934 160.00 + 15.111 0.994531 1988494 182.86 + 17.759 0.995313 1990055 213.33 + 22.815 0.996094 1991621 256.00 + 25.055 0.996484 1992400 284.44 + 26.543 0.996875 1993183 320.00 + 28.543 0.997266 1993963 365.71 + 32.319 0.997656 1994742 426.67 + 36.255 0.998047 1995528 512.00 + 38.495 0.998242 1995913 568.89 + 40.767 0.998437 1996309 640.00 + 42.847 0.998633 1996694 731.43 + 45.023 0.998828 1997087 853.33 + 47.615 0.999023 1997475 1024.00 + 48.991 0.999121 1997670 1137.78 + 50.207 0.999219 1997870 1280.00 + 51.551 0.999316 1998065 1462.86 + 52.991 0.999414 1998257 1706.67 + 54.751 0.999512 1998455 2048.00 + 55.775 0.999561 1998550 2275.56 + 56.799 0.999609 1998646 2560.00 + 58.207 0.999658 1998744 2925.71 + 60.799 0.999707 1998844 3413.33 + 63.807 0.999756 1998940 4096.00 + 65.023 0.999780 1998988 4551.11 + 66.175 0.999805 1999038 5120.00 + 67.455 0.999829 1999087 5851.43 + 68.671 0.999854 1999136 6826.67 + 70.463 0.999878 1999183 8192.00 + 71.999 0.999890 1999208 9102.22 + 73.087 0.999902 1999232 10240.00 + 74.815 0.999915 1999257 11702.86 + 76.863 0.999927 1999281 13653.33 + 78.975 0.999939 1999305 16384.00 + 79.615 0.999945 1999318 18204.44 + 80.191 0.999951 1999330 20480.00 + 80.703 0.999957 1999342 23405.71 + 81.215 0.999963 1999355 27306.67 + 81.727 0.999969 1999367 32768.00 + 82.175 0.999973 1999373 36408.89 + 82.431 0.999976 1999379 40960.00 + 83.519 0.999979 1999385 46811.43 + 84.415 0.999982 1999391 54613.33 + 85.055 0.999985 1999397 65536.00 + 85.503 0.999986 1999400 72817.78 + 85.695 0.999988 1999405 81920.00 + 85.823 0.999989 1999406 93622.86 + 86.847 0.999991 1999409 109226.67 + 87.295 0.999992 1999412 131072.00 + 87.615 0.999993 1999414 145635.56 + 87.743 0.999994 1999415 163840.00 + 88.191 0.999995 1999417 187245.71 + 88.575 0.999995 1999418 218453.33 + 89.279 0.999996 1999420 262144.00 + 89.535 0.999997 1999421 291271.11 + 89.535 0.999997 1999421 327680.00 + 89.855 0.999997 1999422 374491.43 + 90.175 0.999998 1999423 436906.67 + 90.303 0.999998 1999424 524288.00 + 90.303 0.999998 1999424 582542.22 + 90.303 0.999998 1999424 655360.00 + 90.495 0.999999 1999425 748982.86 + 90.495 0.999999 1999425 873813.33 + 90.943 0.999999 1999426 1048576.00 + 90.943 0.999999 1999426 1165084.44 + 90.943 0.999999 1999426 1310720.00 + 90.943 0.999999 1999426 1497965.71 + 90.943 0.999999 1999426 1747626.67 + 91.199 1.000000 1999427 2097152.00 + 91.199 1.000000 1999427 inf +#[Mean = 1.183, StdDeviation = 2.717] +#[Max = 91.136, Total count = 1999427] +#[Buckets = 27, SubBuckets = 2048] diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/sync/get/sync-get-d60-t64-c64-R20000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/sync/get/sync-get-d60-t64-c64-R20000.txt new file mode 100644 index 000000000..e19a7d7db --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/sync/get/sync-get-d60-t64-c64-R20000.txt @@ -0,0 +1,107 @@ + Value Percentile TotalCount 1/(1-Percentile) + + 0.067 0.000000 1 1.00 + 0.458 0.100000 100605 1.11 + 0.575 0.200000 200210 1.25 + 0.685 0.300000 300235 1.43 + 0.796 0.400000 400134 1.67 + 0.907 0.500000 499872 2.00 + 0.963 0.550000 550338 2.22 + 1.018 0.600000 599965 2.50 + 1.074 0.650000 650585 2.86 + 1.128 0.700000 699985 3.33 + 1.184 0.750000 750646 4.00 + 1.212 0.775000 775540 4.44 + 1.240 0.800000 799801 5.00 + 1.270 0.825000 824874 5.71 + 1.301 0.850000 849840 6.67 + 1.334 0.875000 875005 8.00 + 1.351 0.887500 887367 8.89 + 1.369 0.900000 900045 10.00 + 1.387 0.912500 912239 11.43 + 1.407 0.925000 925101 13.33 + 1.428 0.937500 937642 16.00 + 1.439 0.943750 943791 17.78 + 1.451 0.950000 950155 20.00 + 1.463 0.956250 956158 22.86 + 1.477 0.962500 962572 26.67 + 1.492 0.968750 968547 32.00 + 1.501 0.971875 971750 35.56 + 1.511 0.975000 974750 40.00 + 1.523 0.978125 977934 45.71 + 1.537 0.981250 981091 53.33 + 1.554 0.984375 984175 64.00 + 1.564 0.985938 985710 71.11 + 1.576 0.987500 987298 80.00 + 1.589 0.989062 988765 91.43 + 1.606 0.990625 990333 106.67 + 1.630 0.992188 991873 128.00 + 1.646 0.992969 992653 142.22 + 1.675 0.993750 993447 160.00 + 1.726 0.994531 994207 182.86 + 1.976 0.995313 994988 213.33 + 2.927 0.996094 995769 256.00 + 4.073 0.996484 996160 284.44 + 5.315 0.996875 996550 320.00 + 7.459 0.997266 996940 365.71 + 10.607 0.997656 997333 426.67 + 13.679 0.998047 997722 512.00 + 15.247 0.998242 997916 568.89 + 17.231 0.998437 998113 640.00 + 19.487 0.998633 998308 731.43 + 21.567 0.998828 998503 853.33 + 23.503 0.999023 998697 1024.00 + 24.559 0.999121 998795 1137.78 + 25.503 0.999219 998894 1280.00 + 26.383 0.999316 998991 1462.86 + 27.215 0.999414 999089 1706.67 + 28.111 0.999512 999186 2048.00 + 28.687 0.999561 999235 2275.56 + 29.263 0.999609 999283 2560.00 + 29.855 0.999658 999332 2925.71 + 30.655 0.999707 999381 3413.33 + 31.551 0.999756 999430 4096.00 + 32.063 0.999780 999455 4551.11 + 32.431 0.999805 999479 5120.00 + 33.087 0.999829 999503 5851.43 + 33.759 0.999854 999532 6826.67 + 34.367 0.999878 999551 8192.00 + 34.687 0.999890 999564 9102.22 + 35.327 0.999902 999576 10240.00 + 35.903 0.999915 999588 11702.86 + 36.351 0.999927 999600 13653.33 + 37.535 0.999939 999612 16384.00 + 38.207 0.999945 999619 18204.44 + 38.495 0.999951 999625 20480.00 + 38.687 0.999957 999631 23405.71 + 39.391 0.999963 999637 27306.67 + 40.031 0.999969 999643 32768.00 + 40.511 0.999973 999646 36408.89 + 40.607 0.999976 999650 40960.00 + 40.831 0.999979 999652 46811.43 + 41.631 0.999982 999655 54613.33 + 42.111 0.999985 999658 65536.00 + 42.175 0.999986 999661 72817.78 + 42.175 0.999988 999661 81920.00 + 42.367 0.999989 999663 93622.86 + 42.431 0.999991 999664 109226.67 + 42.911 0.999992 999666 131072.00 + 42.943 0.999993 999667 145635.56 + 42.943 0.999994 999667 163840.00 + 43.263 0.999995 999668 187245.71 + 43.391 0.999995 999669 218453.33 + 43.839 0.999996 999670 262144.00 + 43.839 0.999997 999670 291271.11 + 43.839 0.999997 999670 327680.00 + 44.351 0.999997 999671 374491.43 + 44.351 0.999998 999671 436906.67 + 45.183 0.999998 999672 524288.00 + 45.183 0.999998 999672 582542.22 + 45.183 0.999998 999672 655360.00 + 45.183 0.999999 999672 748982.86 + 45.183 0.999999 999672 873813.33 + 45.727 0.999999 999673 1048576.00 + 45.727 1.000000 999673 inf +#[Mean = 0.965, StdDeviation = 1.147] +#[Max = 45.696, Total count = 999673] +#[Buckets = 27, SubBuckets = 2048] \ No newline at end of file diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/sync/put/sync-put-d60-t64-c64-R20000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/sync/put/sync-put-d60-t64-c64-R20000.txt new file mode 100644 index 000000000..dd519c75b --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/sync/put/sync-put-d60-t64-c64-R20000.txt @@ -0,0 +1,107 @@ + Value Percentile TotalCount 1/(1-Percentile) + + 0.066 0.000000 1 1.00 + 0.476 0.100000 100322 1.11 + 0.595 0.200000 200163 1.25 + 0.705 0.300000 300222 1.43 + 0.816 0.400000 400633 1.67 + 0.926 0.500000 500033 2.00 + 0.981 0.550000 550162 2.22 + 1.036 0.600000 600570 2.50 + 1.091 0.650000 650600 2.86 + 1.145 0.700000 699918 3.33 + 1.201 0.750000 750539 4.00 + 1.229 0.775000 775075 4.44 + 1.258 0.800000 799840 5.00 + 1.289 0.825000 825447 5.71 + 1.320 0.850000 850274 6.67 + 1.353 0.875000 875307 8.00 + 1.370 0.887500 887504 8.89 + 1.388 0.900000 899961 10.00 + 1.407 0.912500 912746 11.43 + 1.426 0.925000 924900 13.33 + 1.447 0.937500 937594 16.00 + 1.458 0.943750 943796 17.78 + 1.469 0.950000 949806 20.00 + 1.482 0.956250 956411 22.86 + 1.495 0.962500 962512 26.67 + 1.510 0.968750 968572 32.00 + 1.519 0.971875 971728 35.56 + 1.529 0.975000 974782 40.00 + 1.541 0.978125 978035 45.71 + 1.554 0.981250 981117 53.33 + 1.569 0.984375 984183 64.00 + 1.578 0.985938 985746 71.11 + 1.588 0.987500 987239 80.00 + 1.600 0.989062 988872 91.43 + 1.614 0.990625 990398 106.67 + 1.631 0.992188 991947 128.00 + 1.641 0.992969 992691 142.22 + 1.653 0.993750 993485 160.00 + 1.668 0.994531 994255 182.86 + 1.688 0.995313 995046 213.33 + 1.719 0.996094 995818 256.00 + 1.743 0.996484 996191 284.44 + 1.784 0.996875 996585 320.00 + 1.848 0.997266 996976 365.71 + 1.975 0.997656 997363 426.67 + 2.177 0.998047 997753 512.00 + 2.291 0.998242 997949 568.89 + 2.421 0.998437 998146 640.00 + 2.547 0.998633 998341 731.43 + 2.747 0.998828 998536 853.33 + 2.919 0.999023 998729 1024.00 + 3.027 0.999121 998827 1137.78 + 3.145 0.999219 998924 1280.00 + 3.277 0.999316 999022 1462.86 + 3.507 0.999414 999120 1706.67 + 3.811 0.999512 999218 2048.00 + 3.991 0.999561 999267 2275.56 + 4.147 0.999609 999315 2560.00 + 4.411 0.999658 999364 2925.71 + 4.663 0.999707 999415 3413.33 + 4.887 0.999756 999461 4096.00 + 5.007 0.999780 999486 4551.11 + 5.159 0.999805 999511 5120.00 + 5.407 0.999829 999535 5851.43 + 5.655 0.999854 999559 6826.67 + 5.915 0.999878 999584 8192.00 + 6.055 0.999890 999596 9102.22 + 6.303 0.999902 999608 10240.00 + 6.503 0.999915 999620 11702.86 + 6.751 0.999927 999632 13653.33 + 6.947 0.999939 999644 16384.00 + 7.051 0.999945 999651 18204.44 + 7.147 0.999951 999657 20480.00 + 7.327 0.999957 999663 23405.71 + 7.431 0.999963 999669 27306.67 + 7.619 0.999969 999675 32768.00 + 7.683 0.999973 999678 36408.89 + 7.723 0.999976 999681 40960.00 + 7.843 0.999979 999685 46811.43 + 7.899 0.999982 999687 54613.33 + 8.035 0.999985 999690 65536.00 + 8.127 0.999986 999692 72817.78 + 8.139 0.999988 999693 81920.00 + 8.223 0.999989 999695 93622.86 + 8.279 0.999991 999696 109226.67 + 8.343 0.999992 999698 131072.00 + 8.391 0.999993 999699 145635.56 + 8.391 0.999994 999699 163840.00 + 8.447 0.999995 999701 187245.71 + 8.447 0.999995 999701 218453.33 + 8.919 0.999996 999703 262144.00 + 8.919 0.999997 999703 291271.11 + 8.919 0.999997 999703 327680.00 + 8.919 0.999997 999703 374491.43 + 8.919 0.999998 999703 436906.67 + 9.191 0.999998 999704 524288.00 + 9.191 0.999998 999704 582542.22 + 9.191 0.999998 999704 655360.00 + 9.191 0.999999 999704 748982.86 + 9.191 0.999999 999704 873813.33 + 9.215 0.999999 999705 1048576.00 + 9.215 1.000000 999705 inf +#[Mean = 0.932, StdDeviation = 0.360] +#[Max = 9.208, Total count = 999705] +#[Buckets = 27, SubBuckets = 2048] diff --git a/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/sync/put/sync-put-d60-t64-c64-R40000.txt b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/sync/put/sync-put-d60-t64-c64-R40000.txt new file mode 100644 index 000000000..2aac2ae8a --- /dev/null +++ b/src/main/java/ru/vk/itmo/test/solnyshkoksenia/wrk_results/stage5/sync/put/sync-put-d60-t64-c64-R40000.txt @@ -0,0 +1,107 @@ + Value Percentile TotalCount 1/(1-Percentile) + + 0.042 0.000000 1 1.00 + 0.410 0.100000 201139 1.11 + 0.547 0.200000 400791 1.25 + 0.670 0.300000 601157 1.43 + 0.784 0.400000 799981 1.67 + 0.895 0.500000 1000432 2.00 + 0.952 0.550000 1100931 2.22 + 1.010 0.600000 1200326 2.50 + 1.069 0.650000 1301227 2.86 + 1.126 0.700000 1400526 3.33 + 1.183 0.750000 1499753 4.00 + 1.213 0.775000 1551153 4.44 + 1.243 0.800000 1600789 5.00 + 1.274 0.825000 1649968 5.71 + 1.308 0.850000 1700128 6.67 + 1.348 0.875000 1749612 8.00 + 1.374 0.887500 1774972 8.89 + 1.404 0.900000 1799699 10.00 + 1.440 0.912500 1824593 11.43 + 1.485 0.925000 1849779 13.33 + 1.543 0.937500 1874730 16.00 + 1.579 0.943750 1887115 17.78 + 1.621 0.950000 1899649 20.00 + 1.674 0.956250 1912029 22.86 + 1.747 0.962500 1924548 26.67 + 1.858 0.968750 1937086 32.00 + 1.952 0.971875 1943294 35.56 + 2.127 0.975000 1949536 40.00 + 2.507 0.978125 1955765 45.71 + 3.131 0.981250 1962006 53.33 + 4.215 0.984375 1968256 64.00 + 5.235 0.985938 1971379 71.11 + 7.443 0.987500 1974508 80.00 + 15.047 0.989062 1977628 91.43 + 25.407 0.990625 1980751 106.67 + 35.263 0.992188 1983878 128.00 + 40.671 0.992969 1985444 142.22 + 46.783 0.993750 1987003 160.00 + 52.543 0.994531 1988569 182.86 + 56.671 0.995313 1990137 213.33 + 60.255 0.996094 1991695 256.00 + 62.079 0.996484 1992475 284.44 + 65.151 0.996875 1993249 320.00 + 71.167 0.997266 1994030 365.71 + 77.375 0.997656 1994814 426.67 + 83.007 0.998047 1995597 512.00 + 85.759 0.998242 1995986 568.89 + 88.831 0.998437 1996378 640.00 + 92.223 0.998633 1996765 731.43 + 96.639 0.998828 1997153 853.33 + 100.927 0.999023 1997547 1024.00 + 102.847 0.999121 1997740 1137.78 + 105.151 0.999219 1997938 1280.00 + 107.391 0.999316 1998136 1462.86 + 110.143 0.999414 1998329 1706.67 + 113.023 0.999512 1998523 2048.00 + 114.623 0.999561 1998619 2275.56 + 116.031 0.999609 1998717 2560.00 + 117.503 0.999658 1998816 2925.71 + 119.039 0.999707 1998911 3413.33 + 120.447 0.999756 1999011 4096.00 + 121.151 0.999780 1999059 4551.11 + 122.047 0.999805 1999109 5120.00 + 122.751 0.999829 1999158 5851.43 + 123.647 0.999854 1999206 6826.67 + 124.735 0.999878 1999253 8192.00 + 125.631 0.999890 1999278 9102.22 + 127.039 0.999902 1999301 10240.00 + 128.383 0.999915 1999327 11702.86 + 129.599 0.999927 1999350 13653.33 + 131.327 0.999939 1999374 16384.00 + 132.991 0.999945 1999387 18204.44 + 134.143 0.999951 1999399 20480.00 + 135.679 0.999957 1999411 23405.71 + 136.575 0.999963 1999423 27306.67 + 138.111 0.999969 1999435 32768.00 + 139.391 0.999973 1999442 36408.89 + 140.543 0.999976 1999449 40960.00 + 141.311 0.999979 1999456 46811.43 + 142.079 0.999982 1999460 54613.33 + 143.359 0.999985 1999467 65536.00 + 143.743 0.999986 1999469 72817.78 + 144.127 0.999988 1999473 81920.00 + 145.023 0.999989 1999475 93622.86 + 145.407 0.999991 1999478 109226.67 + 145.919 0.999992 1999481 131072.00 + 146.303 0.999993 1999483 145635.56 + 146.943 0.999994 1999484 163840.00 + 147.455 0.999995 1999486 187245.71 + 147.711 0.999995 1999487 218453.33 + 148.479 0.999996 1999489 262144.00 + 148.991 0.999997 1999490 291271.11 + 148.991 0.999997 1999490 327680.00 + 149.375 0.999997 1999491 374491.43 + 149.631 0.999998 1999492 436906.67 + 149.759 0.999998 1999493 524288.00 + 149.759 0.999998 1999493 582542.22 + 149.759 0.999998 1999493 655360.00 + 150.015 0.999999 1999494 748982.86 + 150.015 0.999999 1999494 873813.33 + 150.271 0.999999 1999496 1048576.00 + 150.271 1.000000 1999496 inf +#[Mean = 1.535, StdDeviation = 6.410] +#[Max = 150.144, Total count = 1999496] +#[Buckets = 27, SubBuckets = 2048] diff --git a/src/test/java/ru/vk/itmo/ClusterRangeTest.java b/src/test/java/ru/vk/itmo/ClusterRangeTest.java new file mode 100644 index 000000000..e9cded4c4 --- /dev/null +++ b/src/test/java/ru/vk/itmo/ClusterRangeTest.java @@ -0,0 +1,194 @@ +package ru.vk.itmo; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import ru.vk.itmo.test.solnyshkoksenia.ServiceImpl; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.http.HttpClient; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Unit tests for cluster node range API. + * + * @author Ksenia Solnyshko + */ +class ClusterRangeTest { + private static final String LOCALHOST_PREFIX = "http://localhost:"; + private static final String DAO_PREFIX = "dao/tmp/test/"; + private static final int CLUSTER_SIZE = 5; + private static final List services = new ArrayList<>(CLUSTER_SIZE); + private static final HttpClient HTTP_CLIENT = HttpClient.newHttpClient(); + + @SuppressWarnings("FutureReturnValueIgnored") + @BeforeAll + public static void before() throws IOException { + Map nodes = new HashMap<>(); + int nodePort = 8080; + for (int i = 0; i < CLUSTER_SIZE; i++) { + nodes.put(nodePort, LOCALHOST_PREFIX + nodePort); + nodePort += 10; + } + + List clusterUrls = new ArrayList<>(nodes.values()); + for (Map.Entry entry : nodes.entrySet()) { + int port = entry.getKey(); + String url = entry.getValue(); + + Path path = Paths.get(DAO_PREFIX + port); + Files.createDirectories(path); + + ServiceConfig serviceConfig = new ServiceConfig(port, url, clusterUrls, path); + ServiceImpl instance = new ServiceImpl(serviceConfig); + services.add(new ServiceInfoExtended(instance, serviceConfig, HTTP_CLIENT)); + instance.start(); + } + } + + @AfterAll + public static void after() throws Exception { + for (ServiceInfoExtended service : services) { + service.cleanUp(); + } + } + + private static byte[] chunkOf( + String key, + String value) { + return (key + '\n' + value).getBytes(StandardCharsets.UTF_8); + } + + private ServiceInfoExtended getRandomService() { + return services.get((int) (Math.random() * services.size())); + } + + @Test + void getAbsent() throws Exception { + ServiceInfoExtended service = getRandomService(); + HttpResponse response = service.clusterRange("absent0", "absent1"); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertEquals(0, response.body().length); + } + + @Test + void single() throws Exception { + var service = getRandomService(); + String prefix = "single"; + String key = prefix + 1; + String value = "value1"; + + // Insert + assertEquals(HttpURLConnection.HTTP_CREATED, service.upsert(key, value.getBytes(StandardCharsets.UTF_8), + CLUSTER_SIZE - 2, CLUSTER_SIZE - 2).statusCode()); + + // Check + { + service = getRandomService(); + HttpResponse response = service.clusterRange(key, prefix + 2); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertArrayEquals(chunkOf(key, value), response.body()); + } + + // Excluding the key + { + service = getRandomService(); + HttpResponse response = service.clusterRange("a", key); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertEquals(0, response.body().length); + } + + // After the key + { + service = getRandomService(); + HttpResponse response = service.clusterRange(prefix + 2, prefix + 3); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertEquals(0, response.body().length); + } + } + + @Test + void triple() throws Exception { + String prefix = "triple"; + String value1 = "value1"; + String value2 = ""; + String value3 = "value3"; + + // Insert reversed + assertEquals(HttpURLConnection.HTTP_CREATED, getRandomService().upsert(prefix + 3, + value3.getBytes(StandardCharsets.UTF_8), CLUSTER_SIZE - 2, CLUSTER_SIZE - 2).statusCode()); + assertEquals(HttpURLConnection.HTTP_CREATED, getRandomService().upsert(prefix + 2, + value2.getBytes(StandardCharsets.UTF_8), CLUSTER_SIZE - 2, CLUSTER_SIZE - 2).statusCode()); + assertEquals(HttpURLConnection.HTTP_CREATED, getRandomService().upsert(prefix + 1, + value1.getBytes(StandardCharsets.UTF_8), CLUSTER_SIZE - 2, CLUSTER_SIZE - 2).statusCode()); + + // Check all + { + byte[] chunk1 = chunkOf(prefix + 1, value1); + byte[] chunk2 = chunkOf(prefix + 2, value2); + byte[] chunk3 = chunkOf(prefix + 3, value3); + byte[] expected = new byte[chunk1.length + chunk2.length + chunk3.length]; + System.arraycopy(chunk1, 0, expected, 0, chunk1.length); + System.arraycopy(chunk2, 0, expected, chunk1.length, chunk2.length); + System.arraycopy(chunk3, 0, expected, expected.length - chunk3.length, chunk3.length); + + HttpResponse response = getRandomService().clusterRange(prefix + 1, prefix + 4); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertArrayEquals(expected, response.body()); + } + + // To the left + { + HttpResponse response = getRandomService().clusterRange(prefix + 0, prefix + 1); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertEquals(0, response.body().length); + } + + // First left + { + HttpResponse response = getRandomService().clusterRange(prefix + 0, prefix + 2); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertArrayEquals(chunkOf(prefix + 1, value1), response.body()); + } + + // First point + { + HttpResponse response = getRandomService().clusterRange(prefix + 1, prefix + 2); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertArrayEquals(chunkOf(prefix + 1, value1), response.body()); + } + + // Second point + { + HttpResponse response = getRandomService().clusterRange(prefix + 2, prefix + 3); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertArrayEquals(chunkOf(prefix + 2, value2), response.body()); + } + + // Third point + { + HttpResponse response = getRandomService().clusterRange(prefix + 3, prefix + 4); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertArrayEquals(chunkOf(prefix + 3, value3), response.body()); + } + + // To the right + { + HttpResponse response = getRandomService().clusterRange(prefix + 4, null); + assertEquals(HttpURLConnection.HTTP_OK, response.statusCode()); + assertEquals(0, response.body().length); + } + } +} diff --git a/src/test/java/ru/vk/itmo/ServiceInfoExtended.java b/src/test/java/ru/vk/itmo/ServiceInfoExtended.java new file mode 100644 index 000000000..c89ef100a --- /dev/null +++ b/src/test/java/ru/vk/itmo/ServiceInfoExtended.java @@ -0,0 +1,25 @@ +package ru.vk.itmo; + +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; + +public class ServiceInfoExtended extends ServiceInfo { + private final HttpClient client; + + public ServiceInfoExtended(Service service, ServiceConfig config, HttpClient client) { + super(service, config, client); + this.client = client; + } + + public HttpResponse clusterRange(String start, String end) throws Exception { + return client.send( + requestForClusterRange(start, end).GET().build(), + HttpResponse.BodyHandlers.ofByteArray() + ); + } + + private HttpRequest.Builder requestForClusterRange(String start, String end) { + return request(STR."/v0/entities?start=\{start}\{end == null ? "" : (STR."&end=\{end}")}&cluster=1"); + } +}