-
Notifications
You must be signed in to change notification settings - Fork 22
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
Windows TCP may cause issues when working with VMware Linux Guest on LAN, for specific payload length #132
Comments
Jeez, so here's a copy of my reply in the email: Yes, this is how it should work. How did you actually verify that that it doesn’t work for you? See line 4 of an strace I just made here:
|
Sorry you're right TCP_NODELAY is set properly and thanks for confirming. I was able to move with testing, so greatly appreciated. Will rename the bug to what i think it is, and we can close it later, maybe someone will have some idea or maybe it helps someone. Spent last 2 days on debugging and checking pecl_http sources. So this issue seems to be related to some very specific issue with different TCP imlpementations. Reproduced that on 4 instances (VMware 16 and 17) on LAN. Workaround is to just add 3-4KB of "garbage" to each HTTP request when working with VMware and windows machines if communication is slow. Maybe someone who knows more about TCP can suggest some better solution. So basically it seems that the issue is there for specific lengths of TCP payload (payload length which results in creation of exactly 2 TCP packets during send). It was working correctly using CURL/POST extension but my PECL_HTTP code was sending POST request in 2 system calls so it produced 2 packets (that's consistent with tests attached), so when I switched - HTTP requests with short payload (almost all) start to take significantly longer time to run. That was +50ms so exactly like it is on this system when Nagle's algo is ON. That's why I incorrectly assumed it's issue with NODELAY. Setup for client: And php_http was sending 2 packets minimum for every POST request, so that's a coincidence and that's why it was giving high latency for me, but the extension works perfectly fine. Curl Request: PHP_HTTP request: Reproductible... ~4-6ms vs [~45-58ms] Attaching tests php_tests.zip Done more tests... attached laptop with win10 using just single cable (not switch / router) - same thing (so that's probably not hardware). Attached laptop with debian and it works OK. So it seems there's some issue with windows TCP when working with VMware... CLIENT ||| SERVER |
The second Let me reformat your results table:
It looks like it depends on Windows being the native Client/Server Host on both sides, even more so If the assumed rows are right. Also, the strace shows, that it's actually the server side delaying 50ms. |
Thanks for the table, looks much better. Figured it out actually and that's very good info if anyone is experiencing issues with latency on windows. Found some people complaining about high network latency in games on windows while linux was ok (in windows 7 this latency is 200ms, this was changed to 50ms in Win10/11 so it's huge issue for games). Also found these posts So there's a value which you can set in the registry for each network interface TcpAckFrequency which defaults to 2. If there are less packets than TcpAckFrequency then the ACK gets delayed by 200ms on Win <10 and by 50ms in Win10 and above. This seems to be less or equal actually. Increased that to 5 and after restart all traffic which was <= 5 frames was delayed by additional 50ms. When you set TcpAckFrequency on your LAN network card to 1 (on server side is enough) the problem is gone, because ACK gets send instantly. Not sure why packets which are fitting inside 1 frame are getting ACK'ed quickly, maybe there's some additional optimization for this case. There's also interesting comment about NODELAY, so maybe VMware is not implementing NODELAY correctly as well...
|
Hello, i'm trying
$client = new http\Client('curl', 'fc');
$options = ['tcp_nodelay'=>true]
$client->setOptions($opts)
This doesn't seem to have any effect. I need to add around 1000b of additional, empty payload so the request won't incur additional 50ms penalty. How to add nodelay flag?
Thanks
The text was updated successfully, but these errors were encountered: