Skip to content

Commit

Permalink
stage-6: fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vitekkor committed May 1, 2024
1 parent a9ac77a commit acdc967
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public void handleEntitiesRangeRequest(Request request, LSMCustomSession session
final String start = request.getParameter("start=");
final String end = request.getParameter("end=");
if (start == null || start.isEmpty() || (end != null && end.isEmpty())) {
log.debug("Bad request: empty id parameter");
log.debug("Bad request: start parameter and end parameter (if it present) should not be empty");
session.sendResponse(LSMConstantResponse.badRequest(request));
return;
}
Expand Down
32 changes: 28 additions & 4 deletions src/main/java/ru/vk/itmo/test/viktorkorotkikh/LSMServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
public class LSMServiceImpl implements Service {
private static final long FLUSH_THRESHOLD = 1 << 20; // 1 MB
private static final int TERMINATION_TIMEOUT_SECONDS = 20;
private static final int SERVER_EXECUTOR_SERVICE_THREADS_COUNT = 16;
private static final int SERVER_EXECUTOR_SERVICE_QUEUE_SIZE = 1024;
private static final int CLUSTER_HTTP_CLIENT_EXECUTOR_SERVICE_THREADS_COUNT = 16;
private static final int CLUSTER_HTTP_CLIENT_EXECUTOR_SERVICE_QUEUE_SIZE = 1024;
private static final int CLUSTER_RESPONSE_EXECUTOR_SERVICE_THREADS_COUNT = 16;
private static final int CLUSTER_RESPONSE_EXECUTOR_SERVICE_QUEUE_SIZE = 1024;
private static final int LOCAL_REQUEST_EXECUTOR_SERVICE_THREADS_COUNT = 16;
private static final int LOCAL_REQUEST_EXECUTOR_SERVICE_QUEUE_SIZE = 1024;
private final ServiceConfig serviceConfig;
private LSMServerImpl httpServer;
private boolean isRunning;
Expand Down Expand Up @@ -101,10 +109,26 @@ public LSMServiceImpl(ServiceConfig serviceConfig) {
private LSMServerImpl createServer(
Dao<MemorySegment, TimestampedEntry<MemorySegment>> dao
) throws IOException {
executorService = createExecutorService(16, 1024, "worker");
clusterClientExecutorService = createExecutorService(16, 1024, "cluster-worker");
clusterResponseProcessor = createExecutorService(16, 1024, "cluster-response");
localProcessor = createExecutorService(16, 1024, "local-processor");
executorService = createExecutorService(
SERVER_EXECUTOR_SERVICE_THREADS_COUNT,
SERVER_EXECUTOR_SERVICE_QUEUE_SIZE,
"worker"
);
clusterClientExecutorService = createExecutorService(
CLUSTER_HTTP_CLIENT_EXECUTOR_SERVICE_THREADS_COUNT,
CLUSTER_HTTP_CLIENT_EXECUTOR_SERVICE_QUEUE_SIZE,
"cluster-request"
);
clusterResponseProcessor = createExecutorService(
CLUSTER_RESPONSE_EXECUTOR_SERVICE_THREADS_COUNT,
CLUSTER_RESPONSE_EXECUTOR_SERVICE_QUEUE_SIZE,
"cluster-response-processor"
);
localProcessor = createExecutorService(
LOCAL_REQUEST_EXECUTOR_SERVICE_THREADS_COUNT,
LOCAL_REQUEST_EXECUTOR_SERVICE_QUEUE_SIZE,
"local-processor"
);

clusterClient = HttpClient.newBuilder()
.executor(clusterClientExecutorService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,7 @@ public void sendRangeResponse(LSMRangeWriter lsmRangeWriter) throws IOException
this.lsmRangeWriter = lsmRangeWriter;
sendNextRangeChunks();

if (this.lsmRangeWriter.hasChunks()) {
this.handling = pipeline.pollFirst();
if (handling == FIN) {
scheduleClose();
} else {
server.handleRequest(handling, this);
}
}

}

private void sendNextRangeChunks() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Наполнение одной ноды - 1335Mb (1.3Gb). Все ключи имеют вид `key%d+`.

Запрос: `curl -vvv --location 'http://localhost:8080/v0/entities?start=key'`
Запрос: `curl -vvv 'http://localhost:8080/v0/entities?start=key'`

## CPU profile

Expand Down

0 comments on commit acdc967

Please sign in to comment.