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

Тузиков Александр, ИТМО DWS, Stage 6 #217

Closed
wants to merge 83 commits into from

Conversation

alexBlack01
Copy link
Contributor

@alexBlack01 alexBlack01 commented Apr 24, 2024

Отчет в директории result/stage6 report.md

Хотел реализовать с использованием processWrite, но что-то не работало ничего(

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

@incubos incubos requested review from atimofeyev and removed request for vladimir-bf April 29, 2024 16:01
@incubos incubos assigned atimofeyev and unassigned vladimir-bf Apr 29, 2024
import java.nio.charset.StandardCharsets;
import java.util.Iterator;

public class StreamResponse extends Response {
Copy link
Contributor

Choose a reason for hiding this comment

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

если были на разборе 6го этапа, то наверное уже поняли что в этом решении вы потенциально все данные можете запихать в память, если с сетью какие-то проблемы

Тут надо обратить внимание на то что под капотом у sesion.write() и попробовать реализовать иенно асинхронную запись

Copy link
Contributor Author

Choose a reason for hiding this comment

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

То есть надо было оставаться на том же алгоритме, что и у one.nio? Что мы можем не до конца сразу все записать, а вернуться к этому потом?

Copy link
Contributor

Choose a reason for hiding this comment

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

да, надо запоминать сколько мы записали, а далее по событию о том что сеть опять готова на запись - записать остальное

byte[] entrySize = Integer.toHexString(keyInBytes.length + valueInBytes.length + Constants.NEW_LINE.length)
.getBytes(StandardCharsets.UTF_8);

byte[] resultValue = new byte[keyInBytes.length + valueInBytes.length + Constants.NEW_LINE.length
Copy link
Contributor

Choose a reason for hiding this comment

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

ну и достаточно много лишних аллокаций, которых можно было бы избежать.
Есть два варианта:

  1. Использовать какие-то пулы буфферов
  2. Попробовать писать в сокет прямо из MemorySegment-a

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Да, по аллокациям вообще ужас получился, страшно смотреть. Буду пробовать исправлять

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

@atimofeyev
Copy link
Contributor

поправьте конфликт пожалуйста чтобы смежить

# Conflicts:
#	src/main/java/ru/vk/itmo/test/tuzikovalexandr/ServiceImpl.java
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.

5 participants