-
Notifications
You must be signed in to change notification settings - Fork 176
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
cohttp-eio hangs #953
Comments
Thanks for the report and reproduction mteril. Ping @bikallem |
Ack. |
@craff I am unable to reproduce the error (the hang). In my 2 core PC. I modified
I tried in another with 12 cores.
|
I see this with |
I assume you mean the listener socket, because if it's the actual connection socket, then everything is wong :). Ideally each domain would have its own listener socket, bound to the same address and port using SO_REUSEADDR and SO_REUSEPORT, this way they can all call |
libuv doesn't support Looking a bit closer, I think this is what's happening:
Libuv should resume watching the listening socket when we accept, but I guess it gets confused because the accept is done from a different domain. |
Slightly off topic: I experimented with this approach thinking it would enhance performance (i.e. we would get free load balancing from linux kernel among many of the CPU cores). The benchmarks however didn't reveal any benefits whatsoever. I think using SO_REUSEPORT is only usable/beneficial if you have multiple OS processes. It doesn't seem to matter much if you use it in a single process setting. |
Should we just remove it then? |
Yes. The |
That works, but there are many things involved, multiple sockets with
reuseaddr/port work in a push manner. The kernel round robins the n XT
connection, which means that your next connection might wait if that domain
is busy. If it's selected or epoll/level triggered, it also causes
thundering storm, as in the "file description" not descriptor is considered
readable and everyone wakes up. Scaling all of this requires thinking about
all this little cases and how they play a part.
…On Thu, Jan 12, 2023, 14:41 Bikal Lem ***@***.***> wrote:
Ideally each domain would have its own listener socket, bound to the same
address and port using SO_REUSEADDR and SO_REUSEPORT, this way they can all
call accept on their own descriptors and the kernel should round-robin the
connections. Decades ago support for this was fiddly,
Slightly off topic: I experimented with this approach thinking it would
enhance performance (i.e. we would get free load balancing from linux
kernel among many of the CPU cores). The benchmarks however didn't reveal
any benefits whatsoever.
I think using SO_REUSEPORT is only usable/beneficial if you have multiple
OS processes. It doesn't seem to matter much if you use it in a single
process setting.
—
Reply to this email directly, view it on GitHub
<#953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABR2EFJSJUFCK6HJSML65LWSACX3ANCNFSM6AAAAAASYHI4DM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Eio 0.9 added a new "eio_posix" backend, which should work correctly. I tested it (using |
The simplest example hangs if I do more requests than the number of domains. The bug is against latest opam version with ocaml 5.0.0-beta2.
Step to reproduce:
dune build
dune exec ./bug.exe
./bench.sh http://localhost:8080/ N 0
N should be twice the number of cores (recommended_domain_count)
Attaching a file keep failing on gitbug (sorry github ;-). I put the file inline
The text was updated successfully, but these errors were encountered: