-
Notifications
You must be signed in to change notification settings - Fork 48
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
Tveritin Alexandr - DWS (Step-1) #30
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 6339 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 6350 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 6354 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 6364 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 6364 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 баллов.
function request() | ||
local headers = {} | ||
headers["Host"] = "localhost" | ||
local id = math.random(1, 2000) |
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.
Всего 2К ключей? Насколько результатам тестирования можно будет доверять?
request = function() | ||
local headers = {} | ||
headers["Host"] = "localhost" | ||
local id = math.random(1, 2000) |
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.
Не слишком мало ключей?
local random_string = "" | ||
local charset_length = string.len(charset) | ||
|
||
math.randomseed(os.time()) |
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.
Зачем выставлять seed на каждый вызов?
#[Buckets = 27, SubBuckets = 2048] | ||
---------------------------------------------------------- | ||
299980 requests in 30.00s, 19.74MB read | ||
Non-2xx or 3xx responses: 160 |
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.
Чем объяснить эти необычные ответы?
---------------------------------------------------------- | ||
299980 requests in 30.00s, 19.74MB read | ||
Non-2xx or 3xx responses: 160 | ||
Requests/sec: 9999.35 |
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.
Почему в отчёте 20К rps?
./wrk -d 30 -t 1 -c 1 -R 20000 -L -s
private static final Response RESPONSE_NOT_FOUND = new Response(Response.NOT_FOUND, Response.EMPTY); | ||
private static final Response RESPONSE_BAD_REQUEST = new Response(Response.BAD_REQUEST, Response.EMPTY); | ||
private static final Response RESPONSE_CREATED = new Response(Response.CREATED, Response.EMPTY); | ||
private static final Response RESPONSE_ACCEPTED = new Response(Response.ACCEPTED, Response.EMPTY); | ||
private static final Response RESPONSE_NOT_ALLOWED = new Response(Response.METHOD_NOT_ALLOWED, Response.EMPTY); |
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.
Причина проблем с большой нагрузкой может быть в этих закешированных объектах Response
-- обсуждали на втором занятии.
if (id.isEmpty()) return RESPONSE_BAD_REQUEST; | ||
MemorySegment key = MemorySegment.ofArray(id.getBytes(StandardCharsets.UTF_8)); | ||
|
||
Entry<MemorySegment> resultEntry = 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.
private static final Response RESPONSE_ACCEPTED = new Response(Response.ACCEPTED, Response.EMPTY); | ||
private static final Response RESPONSE_NOT_ALLOWED = new Response(Response.METHOD_NOT_ALLOWED, Response.EMPTY); | ||
|
||
private final DaoImpl dao; |
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
?
public Response upsert(@Param(value = "id", required = true) String id, Request request) { | ||
if (id.isEmpty()) return RESPONSE_BAD_REQUEST; | ||
MemorySegment key = MemorySegment.ofArray(id.getBytes(StandardCharsets.UTF_8)); | ||
MemorySegment value = MemorySegment.ofArray(request.getBody()); |
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.
Если тела не будет, то PUT
ом выполним DELETE
? Выглядит не совсем корректно.
public synchronized void stop() { | ||
super.stop(); | ||
try { | ||
dao.close(); |
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.
Освобождать ресурсы желательно там же, где их выделили, т.е. в ServiceImpl
-- иначе сложно рассуждать об их жизненном цикле.
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 6364 lines exceeds the maximum allowed for the inline comments feature.
No description provided.