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

New feature "Enqueue-Slowdown" (or -Throttling) #69

Merged
merged 2 commits into from
Mar 27, 2020
Merged

New feature "Enqueue-Slowdown" (or -Throttling) #69

merged 2 commits into from
Mar 27, 2020

Conversation

oli-h
Copy link

@oli-h oli-h commented Mar 25, 2020

Background: Redis-Memory is limited - therefore queue sizes are limited (queue length multiplied with average queue entry size).
So at some point, EN-queuing suddenly fails (presumed that DE-queuing is not possible for a while)

For stability reasons we now can slowly increase a backpressure towards EN-queuing process (http- or EventBus-Clients) by delaying a "success enqueue"-reply more and more. Presuming that the originating EN-queuing process also works sequentially (i.e. it only requests to enqueue a next message when the previous message is successfully enqueued) this simple mechano helps to secure 'our' Redis memory and give us more time (minutes or even hours) to react.

There are now two additonal config options 'per QueueName-pattern':

  • enqueueDelayMillisPerSize
  • enqueueMaxDelayMillis

Closes #70

Addtionally:

  • simplified Config-Object (i.e.: remove the 'Builder'-pattern. Seems to be useless but enforces duplicate code)
  • now using a pre-compiled RegEx-Pattern instead of using method String#matches (which requires to compile the RegEx over and over again)
  • reduced string-concat operation within RedisQues when building Redis-Key-Prefixes over and over again
  • harmonized naming: variable-name "queueName" is now used throughout RedisQues-class

Background: Redis-Memory is limited - therefore queue sizes are limited (queue length multiplied with average queue entry size).
So at some point, EN-queuing suddenly fails (presumed that DE-queuing is not possible for a while)

For stability reasons we now can slowly increase a backpressure towards EN-queuing process (http- or EventBus-Clients) by delaying a "success enqueue"-reply more and more. Presuming that the originating EN-queuing process also works sequentially (i.e. it only requests to enqueue a next message when the previous message is successfully enqueued) this simple mechano helps to secure 'our' Redis memory and give us more time (minutes or even hours) to react.

There are now two additonal config options 'per QueueName-pattern':
- enqueueDelayMillisPerSize
- enqueueMaxDelayMillis

Addtionally:
- simplified Config-Object (i.e.: remove the 'Builder'-pattern. Seems to be useless but enforces duplicate code)
- now using a pre-compiled RegEx-Pattern instead of using method String#matches (which requires to compile the RegEx over and over again)
- reduced string-concat operation within RedisQues when building Redis-Key-Prefixes over and over again
- harmonized naming: variable-name "queueName" is now used throughout RedisQues-class
@mcweba
Copy link
Collaborator

mcweba commented Mar 25, 2020

Could you also put the first comment describing the feature as issue? It's easier to link to in the release notes.

@lbovet
Copy link
Member

lbovet commented Mar 26, 2020

PR ok for me and agree with other comments.
I find a bit ironic that we have to implement such a thing because our system runs too fast :)

@mcweba
Copy link
Collaborator

mcweba commented Mar 26, 2020

PR ok for me and agree with other comments.
I find a bit ironic that we have to implement such a thing because our system runs too fast :)

It's just ISA. NEMO likes it fast :-)

@oli-h
Copy link
Author

oli-h commented Mar 27, 2020

Yes - that's exactly the problem: Our system runs too fast.
Out clients (i.e. entry-side of the overloaded queues) are also RedisQues-Queues.
And when they were offline for a longer time (e.g. network problem in our data center) then those Client-Queues get filled.
As soon as we get online again, all thousands and thousands of Client-Queues start to deliver to our "data center queues". We can handle 3'000 to 4'000 enqueings per second.
But as Bandwith/Throughput to/from Redis-Server is also limited we encountered that the 'DE-queuing' rate suffers heavily under the high EN-queuing rate.
This is also related to #51: We need much more roundtrips with Redis for one DEqueuing than we need for one ENqueuing.

An alternative would be to split RedisQues into two Verticles: one which only does ENqueuing and the other with does only DEqueuing. We then could deploy a differnt number of verticles (i.e. only one ENqueue-verticle but 8 DEqueue-verticles).

Still: a smooth increasing backpressure towards ENqueing clients seems to be a valid option

Copy link

@ljucam ljucam left a comment

Choose a reason for hiding this comment

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

fine for me

@mcweba
Copy link
Collaborator

mcweba commented Mar 27, 2020

Could you also put the first comment describing the feature as issue? It's easier to link to in the release notes.

PR is fine for me now. Could you please add the description as issue.

@oli-h oli-h linked an issue Mar 27, 2020 that may be closed by this pull request
@oli-h oli-h merged commit 4a7e15f into swisspost:develop Mar 27, 2020
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.

Feature "Enqueue-Slowdown" (or -Throttling)
6 participants