performance tuning on raspberry pi 1st generation
See original GitHub issueI’m submitting a …
- bug report
- feature request
- question about the decisions made in the repository
Do you want to request a feature or report a bug?
performance bug
What is the current behavior?
CherryPy consumes about 15-20% CPU on a single-core raspberry pi 1st generation when idle, ie. no requests being processed at all. To reduce this, I tried various configuration adjustments, but to no avail. How can I reduce this ?
If the current behavior is a bug, please provide the steps to reproduce and if possible a screenshots and logs of the problem. If you can, show us your code.
>>> import cherrypy
>>> cherrypy.quickstart()
[29/Apr/2021:14:14:22] ENGINE Listening for SIGTERM.
[29/Apr/2021:14:14:22] ENGINE Listening for SIGHUP.
[29/Apr/2021:14:14:22] ENGINE Listening for SIGUSR1.
[29/Apr/2021:14:14:22] ENGINE Bus STARTING
[29/Apr/2021:14:14:22] ENGINE Started monitor thread 'Autoreloader'.
[29/Apr/2021:14:14:23] ENGINE Serving on http://127.0.0.1
[29/Apr/2021:14:14:23] ENGINE Bus STARTED
top output:
Tasks: 85 total, 1 running, 84 sleeping, 0 stopped, 0 zombie
%Cpu(s): 23.9 us, 8.9 sy, 0.0 ni, 66.6 id, 0.0 wa, 0.0 hi, 0.7 si, 0.0 st
MiB Mem : 430.1 total, 152.9 free, 76.2 used, 201.0 buff/cache
MiB Swap: 100.0 total, 100.0 free, 0.0 used. 297.3 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
10674 root 20 0 131484 21240 8188 S 18.5 4.8 0:45.63 python3
What is the expected behavior?
when idle, no noticeable CPU consumption even on a single-core raspberry pi (or generally ‘low-performance devices’)
What is the motivation / use case for changing the behavior?
useability on low-performance devices
Please tell us about your environment:
- Cheroot version: ?
- CherryPy version: 18.6.0
- Python version: 3.9.2
- OS: Raspbian GNU/Linux 10 (buster)
- Browser: [all ]
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, e.g. stackoverflow, gitter, etc.)
have tried to reduce server.thread_pool to 1, unfortunately no CPU reduction
Issue Analytics
- State:
- Created 2 years ago
- Comments:21 (6 by maintainers)
Top GitHub Comments
It shouldn’t matter. The “switch” was just moving code from one place to another w/o changes. It was an organizational change, not a functional one. Of course, over time it got refactored but I don’t believe it’d influence stuff this much. OTOH, it may be a good idea to check if the use of cheroot alone produces a similar amount of load or not. The invocation examples are here: https://cheroot.readthedocs.io/en/latest/pkg/cheroot.cli.html.
Haven’t had time to use py-spy but thought I’d reduce the threadpool from default 10 to 1: sadly no change, but at least now it’s clear that the worker threads aren’t the root cause. Next I’ll turn off the Autoreloader thread. Keep you posted.