-
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
Плясов Климентий, ИТМО DWS, stage 6 #228
Conversation
# Conflicts: # src/main/java/ru/vk/itmo/test/klimplyasov/PlyasovServer.java # src/main/java/ru/vk/itmo/test/klimplyasov/PlyasovService.java # src/main/java/ru/vk/itmo/test/klimplyasov/Server.java
PR открыт после soft deadline, поэтому максимум 5 баллов. |
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 15917 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 16914 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 16933 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.
Стриминг получился жадным, а не ленивым. Есть вопросы к реализации и результатам профилирования.
if ("/v0/entities".equals(path)) { | ||
handleEntitiesRequest(request, session); | ||
} else { | ||
handleOtherRequest(request, session); |
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.
Не очень удачное имя метода.
while (iterator.hasNext()) { | ||
ChunkGenerator.writeDataChunk(session, iterator.next()); | ||
} |
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.
В случае медленного клиента мы затянем все данные в память и упадём по OOM, верно? Вся суть задания в том, чтобы этого избежать. Будете переделывать?
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.
Данные не отправляются сразу, с ставятся в очередь на отправку -- см. Session.write()
. Но в очередь добавляется всё содержимое Iterator
, т.е. никакого streaming нет.
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/net/Session.write | ||
занимает 46% всей выделенной памяти. Внутри этого метода распределение памяти выглядит следующим образом: | ||
|
||
- writeDataChunk - 70% |
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.
Откуда на профиле аллокаций Class.getSimpleName()
с почти 20%?
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.
private <Z> Z toArray(Class<Z> arrayClass, ValueLayout elemLayout, IntFunction<Z> arrayFactory, Function<Z, MemorySegment> segmentFactory) {
int size = checkArraySize(arrayClass.getSimpleName(), (int)elemLayout.byteSize());
Z arr = arrayFactory.apply(size);
MemorySegment arrSegment = segmentFactory.apply(arr);
MemorySegment.copy(this, elemLayout, 0, arrSegment, elemLayout.withOrder(ByteOrder.nativeOrder()), 0, size);
return arr;
}
когда мы вызываем toArray в MemorySegment, он вызывает этот метод, чтобы проверить размер массива
### one/nio/net/Session.write | ||
занимает 46% всей выделенной памяти. Внутри этого метода распределение памяти выглядит следующим образом: | ||
|
||
- writeDataChunk - 70% |
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.
Откуда аллокация HeapByteBuffer
? Можно её избежать?
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.
Насколько я понимаю он начинает использоваться в SocketChannel.write, где на вход идет bytebuffer и там где-то внутри обрабатывается.
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 16933 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.
Функционально реализовано неверно, потому что отправка жадная. Будете исправлять? Напоминаю, что максимум 5 баллов, потому что после soft deadline.
@incubos Не буду. К сожалению, мне уже не хватает баллов до 50( |
Тогда 1 балл за попытку :( |
No description provided.