ERPNext Server Keeps Timing Out

I have an installation of ERPNext using docker and the server keeps timing out even though less than 10 people uses it. Upon looking at docker stats the backend container is using 100% of CPU. Any advice on what I could do to sort it out?

How much memory and how many cores does your system have? If it’s constantly using 100% of resources, most probably you need to upgrade your system specs.

It is hosted on a digital ocean droplet with these specs:

8 vCPUs
16gb ram
160gb ssd

This was upgrade from 8gb ram after I first noticed the problem. The problem still persists after the upgrade

You’ll have to check what the backend is doing that’s causing 100% cpu usage.

Try GitHub - benfred/py-spy: Sampling profiler for Python programs

1 Like

I couldn’t get py-spy to work but upon checking with htop it shows Gunicorn to be the process with high CPU usage. I currently only have 2 workers assigned to Gunicorn. Could you point me a way to increase the Gunicorn workers when using docker frappe? I have tried through common site config file but it does not work.

1 Like

In frappe docker you change the gunicorn worker count inside images/worker/Dockerfile


You have to build the image after changing the worker count

it’s just a CMD you can override it at runtime in compose as command array.

e.g. overriden here:

1 Like

As @revant_one said, you can add the command to the compose override file for custom applications as given below

    image: custom_app/worker:latest

    image: custom_app/worker:latest
    command: ["/home/frappe/frappe-bench/env/bin/gunicorn",

    image: custom_app/nginx:latest

    image: custom_app/worker:latest

    image: custom_app/worker:latest

    image: custom_app/worker:latest

    image: custom_app/worker:latest