-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fairness across multiple streams #41
Comments
Actually after back-pressure feature has landed, adding |
@Lupus I'm tempted to close this issue as a "won't fix", and instead recommend folks to use |
Yeah, sounds good to me! |
this diff gives running threads a chance to make progress (via `Lwt.pause`) whenever Piaf is reading a message body from the peer. related: anmonteiro/httpun#41
* Body: yield to other threads when reading this diff gives running threads a chance to make progress (via `Lwt.pause`) whenever Piaf is reading a message body from the peer. related: anmonteiro/httpun#41 * tweaks * update
We ran into an issue with fairness when running multiple echo streams on one httpaf-based service. This problem boils down to one stream hogging all CPU power as reads never block on high data rates and event loop does not have a chance to run and schedule others. See ocsigen/lwt#622 for more context.
In our custom Lwt adapter we workaround this by adding
Lwt_main.yield ()
after each read loop iteration along with increase of read buffer size to one megabyte, this way we yield once per each megabyte of data read, which gives good fairness and does not kill performance by endless epolls.May be similar logic could be baked into Lwt adapter behind some configuration parameters?
The text was updated successfully, but these errors were encountered: