-
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 1 #6
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 7438 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 7443 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 7443 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 7443 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.
Есть ряд вопросов и замечаний. Анализ результатов профилирования очень поверхностный и абстрактный. Требуются исправления перед merge.
9 баллов.
private ServerImpl server; | ||
private final ServiceConfig config; |
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 ServerImpl server; | |
private final ServiceConfig config; | |
private final ServiceConfig config; | |
private ServerImpl server; |
build.gradle
Outdated
run { | ||
maxHeapSize = "128m" | ||
mainClass = "ru.vk.itmo.test.tuzikovalexandr.Server" | ||
jvmArgs += ["--enable-preview"] | ||
} | ||
|
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.
Это мы не можем вмёрджить:
run { | |
maxHeapSize = "128m" | |
mainClass = "ru.vk.itmo.test.tuzikovalexandr.Server" | |
jvmArgs += ["--enable-preview"] | |
} |
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.
Да, упустил этот момент, поправил
public class ServerImpl extends HttpServer { | ||
|
||
private final Dao dao; | ||
static final String[] METHODS = new String[]{"GET", "PUT", "DELETE"}; |
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.
Почему package private?
static final String[] METHODS = new String[]{"GET", "PUT", "DELETE"}; | |
private static final String[] METHODS = new String[]{"GET", "PUT", "DELETE"}; |
@Override | ||
public void handleDefault(Request request, HttpSession session) throws IOException { | ||
Response response; | ||
if (Arrays.asList(METHODS).contains(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.
Зачем аллоцировать список каждый раз? Почему список, а не Set
? Мы весь прошлый семестр бились с аллокациями.
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.
Хм, странно, я читал наоборот, что Arrays.asList() не аллоцирует, поэтому и выбрал такой путь
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.
Как он может не аллоцировать, если принимает на вход объект массив, а возвращает другой объект типа List
? Возможно, JIT соптимизирует, но это нужно проверять. А лучше сделать сразу очевидно эффективно.
} | ||
|
||
MemorySegment key = fromString(id); | ||
Entry<MemorySegment> entry = dao.get(key); |
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.
|
||
Файлы: get_profile_3000_cpu.html и get_profile_10000_cpu.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.
Можно конкретнее? Суть нашего сервиса и заключается в обработке запросов. Нет запросов -- нет работы. На что расходуются ресурсы?
|
||
Файлы: get_profile_3000_alloc.html и get_profile_10000_alloc.html | ||
|
||
Здесь основной момент аллокации происходит, когда для создания ответа нам необходимо из MemorySegment сделать массив байтов. |
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.
Есть и множество других аллокаций. Каких?
|
||
## Предложения по оптимизации | ||
|
||
1. Избегание использования виртуальной машины: Непосредственное использование физического сервера может существенно снизить накладные расходы на виртуализацию и улучшить производительность. |
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.
Мы так и не увидели влияние виртуальной машины, верно?
## Предложения по оптимизации | ||
|
||
1. Избегание использования виртуальной машины: Непосредственное использование физического сервера может существенно снизить накладные расходы на виртуализацию и улучшить производительность. | ||
2. Оптимизация настроек сервера: Ревизия и настройка конфигураций сервера может способствовать более эффективной обработке запросов. |
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.
Так давайте проведём "ревизию"? Это же ваш код. Что именно предлагается?
|
||
1. Избегание использования виртуальной машины: Непосредственное использование физического сервера может существенно снизить накладные расходы на виртуализацию и улучшить производительность. | ||
2. Оптимизация настроек сервера: Ревизия и настройка конфигураций сервера может способствовать более эффективной обработке запросов. | ||
3. Оптимизация работы со строками и данными: Рассмотрение возможности получения и обработки данных сразу в байтовом представлении может уменьшить нагрузку на процессор и время отклика за счет сокращения необходимых преобразований. |
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.
The PR diff size of 7443 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.
Один тест не проходит -- надо пофиксить:
14:58:49.095 [NIO Selector #8] ERROR one.nio.net.Session -- Cannot process session from 127.0.0.1
java.lang.IllegalStateException: Can't keep up with flushing!
at ru.vk.itmo.test.reference.dao.ReferenceDao.upsert(ReferenceDao.java:88)
at ru.vk.itmo.test.tuzikovalexandr.ServerImpl.deleteEntry(ServerImpl.java:99)
at RequestHandler2_deleteEntry.handleRequest(Unknown Source)
at one.nio.http.HttpServer.handleRequest(HttpServer.java:66)
at one.nio.http.HttpSession.handleParsedRequest(HttpSession.java:137)
at one.nio.http.HttpSession.processHttpBuffer(HttpSession.java:198)
at one.nio.http.HttpSession.processRead(HttpSession.java:77)
at one.nio.net.Session.process(Session.java:222)
at one.nio.server.SelectorThread.run(SelectorThread.java:70)
java.io.IOException: HTTP/1.1 header parser received no bytes
at java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:964)
at java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:133)
at ru.vk.itmo.ServiceInfo.delete(ServiceInfo.java:45)
at ru.vk.itmo.SingleNodeTest.lifecycle2keys(SingleNodeTest.java:124)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.io.IOException: HTTP/1.1 header parser received no bytes
at java.net.http/jdk.internal.net.http.common.Utils.wrapWithExtraDetail(Utils.java:388)
at java.net.http/jdk.internal.net.http.Http1Response$HeadersReader.onReadError(Http1Response.java:590)
at java.net.http/jdk.internal.net.http.Http1AsyncReceiver.checkForErrors(Http1AsyncReceiver.java:302)
at java.net.http/jdk.internal.net.http.Http1AsyncReceiver.flush(Http1AsyncReceiver.java:268)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:182)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:207)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.io.EOFException: EOF reached while reading
at java.net.http/jdk.internal.net.http.Http1AsyncReceiver$Http1TubeSubscriber.onComplete(Http1AsyncReceiver.java:601)
at java.net.http/jdk.internal.net.http.SocketTube$InternalReadPublisher$ReadSubscription.signalCompletion(SocketTube.java:648)
at java.net.http/jdk.internal.net.http.SocketTube$InternalReadPublisher$InternalReadSubscription.read(SocketTube.java:853)
at java.net.http/jdk.internal.net.http.SocketTube$SocketFlowTask.run(SocketTube.java:181)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:207)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:280)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:233)
at java.net.http/jdk.internal.net.http.SocketTube$InternalReadPublisher$InternalReadSubscription.signalReadable(SocketTube.java:782)
at java.net.http/jdk.internal.net.http.SocketTube$InternalReadPublisher$ReadEvent.signalEvent(SocketTube.java:965)
at java.net.http/jdk.internal.net.http.SocketTube$SocketFlowEvent.handle(SocketTube.java:253)
at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.handleEvent(HttpClientImpl.java:1467)
at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.lambda$run$3(HttpClientImpl.java:1412)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1412)
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 7443 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 7449 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 7457 lines exceeds the maximum allowed for the inline comments feature.
* Test completed * Add result * Fix code style * Fix code style * Fix code style * Fix code style * Add report * Add report * Add report * Report * Report * Fix with report * Fix with report --------- Co-authored-by: Vadim Tsesko <incubos@users.noreply.github.com>
* Test completed * Add result * Fix code style * Fix code style * Fix code style * Fix code style * Add report * Add report * Add report * Report * Report * Fix with report * Fix with report --------- Co-authored-by: Vadim Tsesko <incubos@users.noreply.github.com>
Отчет в директории result/stage1 report.md