Report this

What is the reason for this report?

Managed Postgres & Django Rest Framework - High CPU load low CPU Usage

Posted on April 3, 2021

Dear DO Community,

Regardless of whether it is the managed Postgres DB or my DRF droplets, it seems like the load average is very high while the cpu usage is still reasonable. This is true regardless of whether I am using $5 droplets, or $45 Premium Intel Droplets.

My Apache Max Keep Alive is set to 500 (up from 100, and there is some improvement). Are there any other variables that I need to remember to check? Thanks!

Load Testing wise, I am only getting around 3.5 RPS ($5 droplet) with both Locust / Apache and the load average already spikes up to 5-6 while cpu usage is maxed out. I am getting around 21RPS with the $45 Droplet. However, the RPS decreases quickly when I decrease the frequency of calls per client from every second to every 10 seconds and increase the number of clients by 10. I am doing this because I plan on running my IOT business with this setup and the devices will only call every 10 seconds (maybe even less frequently if it is too expensive). Is this normal? Thanks.

Is there something that I may be doing wrong? I am also getting around 10-20 random error messages for whatever reason in the apache log. Is that normal and should I ignore them? Thanks!

The attached are screenshots of my load testing. Thanks in advance. (Top left is $45 droplet, and some screenshot include my $5 droplet at the bottom left terminal) (Some requests are directed to the LB( IP Adress 167…) and some are to the droplets themselves ($45: 12x…) ($5: 165…) Google Drive Screenshot 1 (Locust load testing - $45 Droplet)

Thanks in advance. Clement



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

I know it’s been quite a while since the question was originally posted, but I would like to post an answer in case someone runs into it now in 2023.

A high load average despite reasonable CPU usage could indicate that the system is waiting for some other resource, such as I/O operations or network requests. You can use tools like top, htop, or iotop to identify these bottlenecks.

Apache Max Keep Alive

Increasing the Max Keep Alive value can help reduce the number of connections being opened and closed frequently. However, setting it too high may lead to higher memory usage. A good balance to strike is 500, but keep an eye on your available memory.

Random Error Messages

Random error messages should not be ignored. They might indicate issues in your application. Investigate these errors in your Apache logs to understand what’s causing them and fix the root causes.

General Tips for Improving Server Performance

In general, improving server performance often involves a combination of server configuration, application optimization, and scaling resources appropriately. It may also be beneficial to consider load balancing, caching, and database optimization depending on your application’s architecture.

Monitoring tools can help you pinpoint the bottlenecks and make informed decisions about where to invest your efforts for performance improvement.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.