-
Notifications
You must be signed in to change notification settings - Fork 128
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
Kraken: Count number of unprefetched messages in queue + increase prefetch #3968
Conversation
Increasing prefetched messages should improve retrieval speed. Consume messages until this unprefetched+prefetched count (or max) is reached. This allows for larger timeouts when there are unprefetched messages, as Kraken will stop at that number, and avoid continuing as long as messages arrive (which is constantly the case for some contributors). If there are only prefetched messages, rushing is possible. Also: * Add short "prefetch" timeouts config (in additional to "classic" ones) * Common queue declaration (to avoid bad-redeclaration) * Check (only for log currently) that consumer is unique * minor cleanups of useless variables Notes: * DeclareQueue() uses DeclareQueueWithCounts() under the cover in SimpleAmpqClient, which allows for the common queue declaration refactor. * BasicConsume() declares a consumer that prefetches 1 message by default. DeclareQueueWithCounts doesn't count prefetched messages. Hence tricky max_message_to_retrieve. JIRA: https://navitia.atlassian.net/browse/NAV-1879
if (queue_is_empty_or_unreachable) { | ||
LOG4CPLUS_ERROR(logger, | ||
"Could not retrieve all the messages counted for RabbitMQ's RT queue " << queue_name); | ||
// going on with what was retrieved so far | ||
break; |
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.
An idea by @pbench (correct me if needed) to simplify code and params would be:
- put a
continue
here instead of abreak
- only one total_timeout (i.e. 30s), single timeout may be hardcoded
- remove count and just go with what was retrieved during those 30s
This would simplify code, the inconvenient is to have a strict latency even if there is only one message (and tests would need a little parameter adaptation for that reason).
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.
👍 GG
SonarCloud Quality Gate failed. |
As the number of prefetched message is unsure when no ready message is available, avoid logging in this case. improvement after #3968 fix https://github.com/hove-io/navitia-docker-compose/issues/153
Increasing prefetched messages (default to
100
) should improve retrieval speed.Consume messages until this unprefetched+prefetched count (or max - increased to
10000
by default) is reached.This allows for larger timeouts when there are unprefetched messages, as Kraken will stop at that number, and avoid continuing as long as messages arrive (which is constantly the case for some contributors). If there are only prefetched messages, rushing is possible.
Also:
100ms and 10s
(in additional to "classic" ones - increased to1s and 2min
)Notes:
DeclareQueue()
usesDeclareQueueWithCounts()
under the cover in SimpleAmpqClient, which allows for the common queue declaration refactor.BasicConsume()
declares a consumer that prefetches 1 message by default.DeclareQueueWithCounts
doesn't include prefetched messages. Hence trickymax_message_to_retrieve
.JIRA: https://navitia.atlassian.net/browse/NAV-1879