High CPU Usage in ERPNext Version 14 - wkhtmltopdf and Worker Processes

Hello ERPNext Community,

I am experiencing high CPU usage on my ERPNext server, particularly with wkhtmltopdf and worker processes. This issue has been persistent and occurs every day. Below are the details of my setup and the troubleshooting steps I have already taken:

Server Details:

  • ERPNext Version: 14

Issue Description:
When I run htop, I observe that several wkhtmltopdf processes and worker processes are consuming a significant amount of CPU and memory. This is causing performance issues on the server. Here is a screenshot of the htop

Troubleshooting Steps Taken:

  1. Analyzed the resource usage using htop.
  2. Ensured that ERPNext and all dependencies are up-to-date by running bench update.
  3. Reviewed and optimized the ERPNext configuration in common_site_config.json and site_config.json.
  4. Checked MySQL performance and optimized the database.
  5. Monitored Redis performance.
  6. Reviewed scheduled jobs and worker configurations.

Despite these efforts, the issue persists. I would appreciate any advice or suggestions from the community to help resolve this issue.

Thank you in advance for your help!

Best regards,
Rasool

Hi,

Are there print or pdf rendering activities that are known to be initiated by users when the high cpu use is observed or are these processes observed without?

Hello,

thanks for your reply

Regarding your question about whether high CPU usage occurs without users initiating print or PDF rendering activities, we have observed that high CPU usage can indeed occur independently of these specific tasks. There are instances where the CPU usage spikes even when no print or PDF rendering activities are being executed by users

If htop is showing wkhtmltopdf processes running in the background when the spikes occur, finding the source of the wkhtmltopdf jobs is what is needed. Are there complex or large custom print formats in use that are not finishing or are being cancelled but not stopping ?