Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

GenryEden
Copy link
Contributor

No description provided.

Copy link

@codeclimate codeclimate bot left a 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.

Signed-off-by: vitaliy.emelyanov <vitaliy.emelyanov@yadro.com>
Copy link

@codeclimate codeclimate bot left a 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.

Copy link
Member

@lamtev lamtev left a 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 {
Copy link
Member

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];
Copy link
Member

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));
Copy link
Member

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")
Copy link
Member

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));
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вероятно, будет достаточно HttpServer/Server

# Отчет по модулю 1

## Наполнение
Для наполнения был использован следующий скрипт на lua
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В отчёте необходимо приводить вывод wrk, чтобы ревьюер мог проверить полученные выводы


[Аллокации на чтение](alloc_read.html)

Все аллокации выполняются исключительно для возврата/получения значения
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Еще же видно, что часть сэмплов (не такая маленькая) - это аллокации при парсинге запроса силами one-nio
В принципе, возможности на них повлиять особой нет. Но можно было упомянуть, что они есть

Copy link

@codeclimate codeclimate bot left a 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.

@lamtev
Copy link
Member

lamtev commented Feb 29, 2024

Oops

SingleNodeTest > lifecycle2keys(ServiceInfo) > [11] ru.vk.itmo.ServiceInfo@2e8ab815 FAILED
java.io.IOException at SingleNodeTest.java:124
Caused by: java.io.IOException at Utils.java:388
Caused by: java.io.EOFException at Http1AsyncReceiver.java:601
196 tests completed, 1 failed

@GenryEden

@lamtev
Copy link
Member

lamtev commented Apr 1, 2024

Oops

SingleNodeTest > lifecycle2keys(ServiceInfo) > [11] ru.vk.itmo.ServiceInfo@2e8ab815 FAILED
java.io.IOException at SingleNodeTest.java:124
Caused by: java.io.IOException at Utils.java:388
Caused by: java.io.EOFException at Http1AsyncReceiver.java:601
196 tests completed, 1 failed

@GenryEden

@GenryEden хорошо бы отвечать на комментарии

@lamtev lamtev closed this Apr 1, 2024
@GenryEden
Copy link
Contributor Author

я прошу прощения, проглазел. в беседе в вк обсуждали, что это флакало у кого-то другого, кого замержили в мейн, сейчас не вопсроизводится

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants