-
Notifications
You must be signed in to change notification settings - Fork 112
pss: Limit the number of workers forwarding messages in outbox #1860
Conversation
… pss to accommodate changes
Should #1744 be closed in favour to this PR? As this PR is based on it. |
Yes, that PR could be closed if this is reviewed instead ot it. |
And #1861 is based from the same branch and shares most of the changes. Which one of three PRs is correct to review? |
In that case of dependent PRs, maybe it is better to remove |
Ok, done |
#1744 branch is not in etheresphere/swarm but in epiclabs-io/swarm, so the PR would need to be created in a different repository and you could not review it. |
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.
Thanks for addressing my comments. I think that the code is fine, the comments can be formatted a bit better (full sentences, with a space after //), which would be very nice as already is in most of the codebase.
We should sync about next steps as there is another track with @nonsense @acud trying to tackle the same problems in parallel. I see that some work has already been done over the weekend on #1867.
pss/outbox/outbox.go
Outdated
Forward forwardFunction //Function that executes the actual forwarding | ||
} | ||
|
||
//Outbox type |
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.
This comment can be improved.
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.
Whenever a message is taken from the outbox a new go routine is fired. There used to be no limit of parallel goroutines (only the size of the outbox queue that was 100000). Now a new channel of size
numWorkers
has been implemented to limit parallel processing.This results in a new limit when adding a message to the outbox. If the numbers of parallel workers has been reached the routine trying to enqueue it will block.
Additionally, the size of the queue has been decreased to 10000.
This PR solves issue #1802, and point 2 in #1855. Is built on top of pending PR #1744 (refactor pss outbox).