-
Notifications
You must be signed in to change notification settings - Fork 284
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
regression requests on keep-alive HTTP connections only served after 40ms #338
Conversation
The missing write event is probably because of the write watermark, which is now set to 4k instead of zero (was done while avoiding infinite data stack up due to #191). However, it's the read event that seems to get deferred somehow here. In my tests with Opera I see even a 600ms delay. Hm... or maybe it's actually the data that doesn't get flushed for the previous response. I'll dig a bit further... |
- A deadlock is caused by Nagle's algorithm + delayed ACK and the write+write+read pattern (resp header + body + next req) when serving 2 HTTP requests on a keep-alive connection. - Resolved by buffering smaller writes so that responses don't get split unnecessary, i.e. blocking in write iff more than 4kB is buffered.
This doesn't resolve the bug for me. |
fix Issue #338 - keep-alive HTTP requests only served after 40ms |
I see. The windows console is so unbelievably slow (1-3 ms for one line of text) that the delay is fully hidden by log output for me. So the flushing behavior needs to be checked (I'm also unsure what exactly the "normal" and "flush" modes of libevent actually do, need to check the sources). |
I converted the issue into a pull request to hopefully fix the issue. |
Hmm GitHub is currently messing up this ticket... |
Oh I see then this was probably the cause for the hiccups |
So if this fixes the issue for you, I'd also change the exit condition for |
Not sure I get you. You mean like in the pull request? |
AFAIU the main problem was this line 275 in |
Ok, forget what I've said. It's all there already, not sure what I've seen or thought to see. |
regression requests on keep-alive HTTP connections only served after 40ms
Looking with Wireshark at the stream I can also confirm that it fixed the packet fragmentation issue. vibed.org is also responding noticeably faster again. |
Assuming that the big delays that I've seen in my first tests were caused by the delayed ACK (didn't know of the bad interaction with Nagle's algorithm, thanks for the pointer!), maybe it makes sense to embrace libevent's buffering mechanism and enable |
As an improvement we could use the real MSS size (MTU - TCP/IP headers) of the socket instead of the hardcoded 4096 bytes. It can be obtained with NB: The druntime network headers are a mess and |
This works around linking problems such as vibe-d/vibe.d#338, caused by the frontend appending template instances to the wrong module. GitHub: Fixes ldc-developers#558.
The method
Libevent2TCPConnection.waitForData
only returns after 40ms.In v0.7.17 I see
socket 11 write event (false)!
afterwait for data
. The write event is missing on master.I tried to bisect the issue but there were to many build errors in the git history to do so.