question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

performance tuning on raspberry pi 1st generation

See original GitHub issue

I’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:open
  • Created 2 years ago
  • Comments:21 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
webknjazcommented, Jul 19, 2021

You might want to try CherryPy<9.0.0, as this is where the engine was switched from wsgiserver to cheroot: https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst#v900

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.

1reaction
Blindfreddycommented, Jul 5, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rasp Pi Tuning » Raspberry Pi Geek
The Raspberry Pi is small and economical but also fairly limited for resources. A few targeted tuning steps might help you gain better...
Read more >
Slow Raspberry Pi? 11 Tips for Better Speed and ...
If you have a slow Raspberry Pi, here are some tips and tricks for better Raspberry Pi performance. They really work!
Read more >
Tricks to improve Raspberry Pi performance and power ...
Tricks to improve Raspberry Pi performance and power consuption · 1. Using the correct input power · 2. Installing ZRAM · 3. Reduce...
Read more >
Raspberry Pi Optimization (Hardware and Software)
Buy the latest version (minimal price difference, but the performance upgrade is huge between generations) from eBay or AliExpress. The ...
Read more >
Performance measurement and tuning
The ARM1176 processor in the Raspberry Pi has three performance counters. All three performance counters are 32 bits in length (32-bit unsigned integers)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found