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
socket.settimeout() conusming a lot of cpu #116
Comments
Increasing the select_timeout in recvall_from_socket() helped too. With timeouts increased and the conditional settimeout logic, I'm down to around 5% cpu utilization. |
Would be good to get independent approval of this, btw, as I'm a little surprised by the size of these gains. |
Your analysis is absolutely spot on. In retrospect it's really silly to call settimeout like that. Thanks for spotting that! See my commit against this issue. Let me know how it compares to what you've implemented. Will keep this open until you confirm. |
Ooops. My first commit broke fteproxy on OSX. Try the latest, and let me know if that works for you! |
Just built successfully from 8fc0a74 on a Macbook Air running 10.9, and all tests pass with the following results:
When I revert to 9f1b9e7, the tests give these results:
So test durations have increased and goodput went down... maybe that's expected? When I tested the integration with our FTEMain proxy before and after (by loading (and reloading) our customary heavy Wikipedia page), the new version performed much better, so that's the important thing. Looking better to you, @oxtoacart? Thanks for the quick fixes on this, @kpdyer! |
Yes, just pulled and tested with our FTEMain, and cpu utilization is near what I was seeing with my hacks. @kpdyer - thanks for the quick turnaround! |
Actually, I think I have one more improvement in this space. @Skivvies @oxtoacart Can you try 5eb380e with values of |
@kpdyer This last change drops CPU utilization even further! From now on I'm leaving fteproxy bugs open, just to see what you'll come up with. |
Just wanted to chime in to say bravo on the great collaboration everyone. Does anyone say "bravo" these days? Somehow makes me feel like I should be retiring =). Good stuff. |
Going to set Going to close this ticket for now. |
I've been doing a little profiling of fteproxy and noticed that in my YouTube streaming test, fteproxy was spending nearly 18% of its time on calling 'socket.settimeout()'.
Looking at the code, I noticed that we have several of these calls on the critical path, such as this one and this one.
For fun, I tried increasing the default timeout from 0.01 to 0.1. This caused my cpu utilization to drop from 35% to 9% while playing a YouTube video.
I then implemented some logic to settimeout only if it's actually changed. That was good for another couple of percent, bumping me down to 7% cpu usage.
Using just the conditional setting trick puts me at about 20% cpu usage.
I don't know what other effects these changes have, but doing something about the excessive settimeout calls might be worth it.
The text was updated successfully, but these errors were encountered: