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

server high CPU load #32

Open
belm0 opened this issue Sep 19, 2018 · 3 comments
Open

server high CPU load #32

belm0 opened this issue Sep 19, 2018 · 3 comments

Comments

@belm0
Copy link
Member

belm0 commented Sep 19, 2018

I'm seeing high CPU load of the server relative to my current implementation, which is running https://github.com/dpallot/simple-websocket-server via trio.run_sync_in_worker_thread().

The workload is many small messages, typically < 80 bytes, mostly one-way communication. trio-websocket consumes 2-3x more CPU.

with simple-websocket-server the sends are synchronous, so no backpressure, but it means that the Trio scheduler is much less used

@njsmith
Copy link
Member

njsmith commented Sep 20, 2018

Have you tried profiling? I find vmprof particularly useful because it combines low-overhead, useful visualization, and a nice web interface so you can share profiles with other people. (Do be warned if you have proprietary code though that it uploads some data to the web, which is why it can do the nice sharing but OTOH some people get antsy.)

Basically:

pip install vmprof
python -m vmprof --web <your script that runs too slow>

@mehaase
Copy link
Contributor

mehaase commented Sep 20, 2018

Did you install wsaccel? It was not included as a dependency in the current PyPI release (0.0.1) but it is a dependency now on master. I haven't benchmarked with and without wsaccel, so I don't know how much of a difference it makes.

@belm0
Copy link
Member Author

belm0 commented Sep 20, 2018

Yes, wsaccel installed. I checked and it doesn't make any difference.

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

3 participants