Limited ressources - 2 processes running

Hello,

I am running Django on a Raspberry pi Zero which has limited computing capacity.
I am having a performance issue and when I am checking the processes draining a lot of CPU, I notice 2 instances of Python running in parallel which seems to use exactly the same amount of resources which makes me think that it is running twice (PID 531 and 532 are draining the CPU). See below screenshots.
Can someone confirm me that this is totally normal?
If it is not, any clues on what could have gone wrong?

For information, I have a startServer.sh script in /etc/init.d to start the server at boot.

2

thank you,

Tibibs

Welcome to the forum @tibibs!

First - you shouldn’t use runserver in production - it’s not intended for production use and isn’t tuned for performance. gunicorn is a good production WSGI webserver. You can tune it to use only one process.

Second - these shouldn’t be true processes but threads. Unless you pass --noreload to runserver, it starts its autoreload thread. This doesn’t increase actual memory usage. Try using htop in tree mode and you’ll see that one “process” lives under the other.

Hope that helps,

Adam

2 Likes

It’s been a while since I got this problem.
It tuned out I have changed my raspberry pi for another SBC more powerful and multicore, which can handle easily running Django.

I have set it up together with Nginx and Gunicorn.
Thank’s to have raised this comment to me.