-
Notifications
You must be signed in to change notification settings - Fork 47
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
Stage 1: Emelyanov Vitaliy, SPbSTU #15
Conversation
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 5265 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 5266 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.
Есть один серьезный момент - это отсутствие обработки исключений
Также отсутствие вывода wrk не позволяет проверить полученные выводы и корректность нагрузки. Убедительная просьба в следующих этапах это учесть, чтобы, как минимум, не терять баллы за этап )
10 баллов
public static final byte[] EMPTY_BODY = new byte[0]; | ||
private final ReferenceDao dao; | ||
|
||
public DhtServer(ServiceConfig config) throws IOException { |
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.
Думаю, не очень хорошо, что конфиг сервиса просочился на уровень сервера. Было бы лучше, если бы сервис разобрал данный конфиг, на его основе сформировал бы конфиги зависимостей и инстанцировал их с этими конфигами
import static one.nio.http.Request.METHOD_PUT; | ||
|
||
public class DhtServer extends HttpServer { | ||
public static final byte[] EMPTY_BODY = new byte[0]; |
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.
В one-nio есть Response.EMPTY
|
||
public DhtServer(ServiceConfig config) throws IOException { | ||
super(createConfig(config)); | ||
dao = new ReferenceDao(new Config(config.workingDir(), 1 << 24)); |
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.
Неочевидно, что означает 2^24
} | ||
|
||
@RequestMethod(METHOD_GET) | ||
@Path("/v0/entity") |
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.
Используется в нескольких местах, можно было бы в константу выделить
if (isKeyIncorrect(id)) { | ||
return new Response(Response.BAD_REQUEST, EMPTY_BODY); | ||
} | ||
Entry<MemorySegment> entry = dao.get(keyFor(id)); |
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.
Для всех методов отсутствует обработка исключений от DAO
Что, кстати, будет при выбросе исключения?) Автоматом 500 ответ или, может, отсутствие ответа?)
|
||
public class DhtService implements Service { | ||
private final ServiceConfig serviceConfig; | ||
private DhtServer server; |
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.
Вероятно, будет достаточно HttpServer/Server
# Отчет по модулю 1 | ||
|
||
## Наполнение | ||
Для наполнения был использован следующий скрипт на lua |
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.
В отчёте необходимо приводить вывод wrk, чтобы ревьюер мог проверить полученные выводы
|
||
[Аллокации на чтение](alloc_read.html) | ||
|
||
Все аллокации выполняются исключительно для возврата/получения значения |
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.
Еще же видно, что часть сэмплов (не такая маленькая) - это аллокации при парсинге запроса силами one-nio
В принципе, возможности на них повлиять особой нет. Но можно было упомянуть, что они есть
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 5266 lines exceeds the maximum allowed for the inline comments feature.
Oops
|
@GenryEden хорошо бы отвечать на комментарии |
я прошу прощения, проглазел. в беседе в вк обсуждали, что это флакало у кого-то другого, кого замержили в мейн, сейчас не вопсроизводится |
No description provided.