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 5, Андрей Чешев, Политех #167

Merged
merged 123 commits into from
May 19, 2024

Conversation

Queenore
Copy link
Contributor

@Queenore Queenore commented Apr 7, 2024

No description provided.

@Queenore
Copy link
Contributor Author

Queenore commented Apr 14, 2024

Необходимо зарезолвить конфликты.

Зарезолвил конфликты.

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 89458 lines exceeds the maximum allowed for the inline comments feature.

Copy link
Contributor

@Marashov-Alexander Marashov-Alexander left a comment

Choose a reason for hiding this comment

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

11/15
Выглядит неплохо. Из замечаний - маловато аналитики по отчёту при профилировании, а если про код - сильно расплылась ответственность за отправку ответа, еще есть несколько вопросов к лишним выделениям

private int counter;

public WorkerThreadFactory(String prefix) {
this.prefix = prefix + "-";
Copy link
Contributor

Choose a reason for hiding this comment

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

кажется, теперь это уже лишнее

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WorkerThreadFactory до сих пор используется мною для конфигурирования executor`ов.


@Override
public int compareTo(ResponseElements o) {
long diff = this.getTimestamp() - o.getTimestamp();
Copy link
Contributor

Choose a reason for hiding this comment

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

кажется, можно не через геттеры, а по полям обращаться? В обоих кейсах

}

public byte[] getBody() {
return Arrays.copyOf(body, body.length); // CodeClimate requirement.
Copy link
Contributor

Choose a reason for hiding this comment

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

целиком копировать массив - выглядит дорого. Может быть есть способ выдавать его read-only вариацию?

Copy link
Contributor Author

@Queenore Queenore May 3, 2024

Choose a reason for hiding this comment

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

В стандартной библиотеке Java нет прямого способа сделать массив read-only без копирования.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Сделал с использованием обертки ByteBuffer, но копирование все равно осталось при получении.

}

private static boolean isResponseSucceeded(int status) {
return status == 404 || status == 410
Copy link
Contributor

Choose a reason for hiding this comment

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

мб статический сет с допустимыми статусами? Вместо множества условий с магическими константами)

return (method == Request.METHOD_GET && collector.size() >= ack) || responseCount.get() >= from;
}

public void sendResponse() {
Copy link
Contributor

Choose a reason for hiding this comment

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

класс очень много за что отвечает. Из-за этого понять его логику очень трудно. Если класс является сборщиком ответов, то метод sendResponse в нем явно удивляет)


List<Integer> nodes = distributor.getQuorumNodes(id, from);
List<Response> responses = new ArrayList<>();
List<Integer> nodesIndices = distributor.getQuorumNodes(id, from);
Copy link
Contributor

Choose a reason for hiding this comment

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

а почему метод называется getQuorumNodes, если он возвращает ноды не по количеству кворумов, а столько, сколько запрошено через параметр from?)



При реализации было использовано 5 экзекьюторов:
* Distributor - для распределения задач по CompletableFuture (6 потоков core, 6 потоков максимум);
Copy link
Contributor

Choose a reason for hiding this comment

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

А почему было использовано именно такое кол-во потоков на каждом из экзекьюторов? Было бы здорово пояснить, почему было выбрано именно так, поскольку на первый взгляд кажется, что у Distributor'а может быть меньше работы, чем у некоторых из ниже указанных

![](./screens/put_cmp.png)
При 90м, 99м, 99.9м персентилях задержка при новой реализация меньше примерно в два раза. Наблюдает значительное улучшение производительности.

И get и put запросы выдали меньшую задержку, чем ранее, но для get запросов после 99го персентиля замечен тренд резкого увеличения задержки.
Copy link
Contributor

Choose a reason for hiding this comment

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

с чем он может быть связан?

* PUT
![](./screens/img_6.png)
![](./screens/img_7.png)
* Поскольку решение было переведено на использование java.net.HttpClient, то появились сопутствующие аллокации.
Copy link
Contributor

Choose a reason for hiding this comment

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

Маловато аналитики будет)

![](./screens/img_8.png)
![](./screens/img_9.png)
* Нагрузка действительно распределилась по потокам. Наибольшее количество процессорного времени занимает RemoteCall протоки.
* LocalCall, Distributor потоки занимают в среднем от 0.5 до 1 проценту процессорного времени.
Copy link
Contributor

Choose a reason for hiding this comment

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

Тоже маловато)

@Queenore
Copy link
Contributor Author

Queenore commented May 2, 2024

Завтра смогу прислать дополненный отчет и исправления.

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 89566 lines exceeds the maximum allowed for the inline comments feature.

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 89563 lines exceeds the maximum allowed for the inline comments feature.

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 89579 lines exceeds the maximum allowed for the inline comments feature.

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 89583 lines exceeds the maximum allowed for the inline comments feature.

@Queenore
Copy link
Contributor Author

Queenore commented May 3, 2024

@Marashov-Alexander, внес правки.

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 89586 lines exceeds the maximum allowed for the inline comments feature.

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 89588 lines exceeds the maximum allowed for the inline comments feature.

@Queenore
Copy link
Contributor Author

Необходимо зарезолвить конфликты.

Конфликты были зарезолвлены.

Copy link
Member

@incubos incubos left a comment

Choose a reason for hiding this comment

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

Добавляю approve после merge upstream.

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 89588 lines exceeds the maximum allowed for the inline comments feature.

@incubos incubos merged commit 0b3a04e into polis-vk:main May 19, 2024
2 checks passed
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.

4 participants