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

Optimize Lwt_io.establish_server(_with_client_socket) #600

Open
aantron opened this issue Jun 20, 2018 · 0 comments
Open

Optimize Lwt_io.establish_server(_with_client_socket) #600

aantron opened this issue Jun 20, 2018 · 0 comments
Milestone

Comments

@aantron
Copy link
Collaborator

aantron commented Jun 20, 2018

Found by @bluddy in inhabitedtype/httpaf#54 (comment):

OK, I redid the test with the single yield () modification above. For the record, it involves turning line 1608 in lwt_io.ml to

 Lwt_main.yield () >>= fun () -> accept_loop ()

This results in a huge latency improvement for the HTTP server benchmark being discussed in inhabitedtype/httpaf#54 (comment); see surrounding comments for details. However, it also decreases throughput.

There may be some variant of this optimization that gives both low latency and high throughput. There is a risk of over-optimizing for the specific benchmark, however.

One suggestion is to take the accept_n branch, and yield between every N accepts.

@aantron aantron added this to the libuv milestone Jul 27, 2019
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

No branches or pull requests

1 participant