-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Супрядкина Дарья ИТМО DWS stage 5 #180
Conversation
# Conflicts: # src/main/java/ru/vk/itmo/test/dariasupriadkina/Server.java # src/main/java/ru/vk/itmo/test/dariasupriadkina/ServiceIml.java # src/main/java/ru/vk/itmo/test/dariasupriadkina/ServiceImlFactory.java # src/main/java/ru/vk/itmo/test/dariasupriadkina/TestServer.java
# Conflicts: # src/main/java/ru/vk/itmo/test/dariasupriadkina/Server.java # src/main/java/ru/vk/itmo/test/dariasupriadkina/ServiceIml.java # src/main/java/ru/vk/itmo/test/dariasupriadkina/ServiceImlFactory.java # src/main/java/ru/vk/itmo/test/dariasupriadkina/TestServer.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 22460 lines exceeds the maximum allowed for the inline comments feature.
f2c0ff6
to
6be3d39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 22460 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 22460 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 22460 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Есть ряд замечаний и вопросов -- ждём ответов/исправлений.
@@ -31,6 +32,20 @@ public Response handleRequest(Request request) { | |||
}; | |||
} | |||
|
|||
public CompletableFuture<Response> handleAsyncRequest(Request request) { | |||
String id = utils.getIdParameter(request); | |||
return switch (request.getMethodName()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему не getMethod()
? switch
по числам потенциально эффективнее.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправила
@@ -31,6 +32,20 @@ public Response handleRequest(Request request) { | |||
}; | |||
} | |||
|
|||
public CompletableFuture<Response> handleAsyncRequest(Request request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему не просто composeFuture(handleRequest(request))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправила
Map<String, Integer> ackFrom = getFromAndAck(request); | ||
int from = ackFrom.get("from"); | ||
int ack = ackFrom.get("ack"); | ||
if (!permittedMethods.contains(request.getMethod()) || checkBadRequest(ack, from)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может, проверку на разрешённые HTTP методы тоже убрать в checkBadRequest()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Перенесла
handleDefault(request, session); | ||
return; | ||
} | ||
if (request.getHeader(FROM_HEADER) == null) { | ||
request.addHeader(FROM_HEADER + selfUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Заголовки обычно в формате name: value
, а тут будет X-FROMhttp://...
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем мы здесь добавляем заголовок в исходный запрос, если он потом не используется?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в случае, если у нас запрос пришел от пользователя, мы не имеем заголовка X-FROM, поэтому осуществляем broadcast
(рассылку по нодам, которые были получены в ходе выполнения метода getNodesById), если же этот заголовок уже установлен,
значит, мы понимаем, что запрос пришел от другой ноды, а следовательно, предполагается, что значение по данному ключу
находится у нас, поэтому - отправляем на своего обработчика
Изначально, я планировала не только проверять наличие этого заголовка, но и в случае, когда он установлен, убеждаться в том, что этот URL входит в clusterUrls, чтобы избежать ситуации, когда данный заголовок был установлен кем-то вручную и вызывал неправильное поведение системы. Но, когда реализовывавлась 4я лабораторная работа этот момент для скорости написано сначала был опущен, а потом и вовсе забыт
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я понял изначальную идею, но заголовок FROM_HEADER
из данного объекта request
дальше никак не используется, потому что мы формируем запросы для Java HTTP client.
|
||
Также бросается в глаза, что в процентном соотношении метод `handleRequest` стал занимать 12% вместо 18%, как в прошлом этапе, снижение произошло как раз благодаря тому, что мы не ждем ответа всех нод, | ||
а отправляем все запросы параллельно и ждем только `ack` ответов (стоит отметить, что снижении было бы еще более значительным, если бы профиль в 4ой лабораторной был снят, | ||
когда я не экспериментировала с возможностью при получении ack ответов выходить из программы) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Но по спеке мы обязаны отправить запросы всем from
нодам. ack
исключительно про формирование ответа клиенту. Или что именно имеется в виду?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не по спеке, когда делала 4ю лабораторную, хотела посмотреть как меняются профили, если отправлять только ack ответов, чтобы посмотреть, как количество пересылок влияют на их
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 22463 lines exceeds the maximum allowed for the inline comments feature.
e41e58a
to
595df0a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 22461 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 22467 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 22467 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 22464 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 22664 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
13 баллов.
No description provided.