How to optimize server for high traffic load in 32GB RAM Droplet

December 5, 2017 3k views
MySQL Apache DigitalOcean Java Ubuntu 16.04

I am using 32 GB Memory / 40 GB Disk / BLR1 - Ubuntu 16.10 x64 droplet and my android app running on this droplet but i am facing critical issue on server.
Basically my application based on chatting so i installed openfire on this server. sometimes my application API not working because of high traffic load. According to firebase analytics my application active users are 100 per minute. So i am sure that problem occur because of high traffic load. I used all optimized query for application api but still mysqld used 400% CPU usage. its very strange problem me. Why mysqld taking high CPU usage.

Digital Ocean Graph detail

  1. CPU Usage: Total : 88.82%
  2. RAM Usage: Total: 14%

strange why RAM used only 14% out of 32GB RAM and CPU taking too much process.

Other detail
mysqld: 437.56%
Java: 238.11%
Apache2: 231.02%

mysqld used too much CPU process.

I try to found solution but still i am not getting any success result. Please help me if someone know that how to fix this issue.


2 Answers

400 rps is NOT highload; it’s your application being inefficient. Start by profiling mysql load. Post samples of SHOW FULL PROCESSLIST and SHOW VARIABLES. Do the normal tuning dance with mysql tuner script. Show SQL dataset sizes. Enable slow logging and check tables for queries with missing or suboptimal indices. There’s plenty of tuning to do.

A single node is a single point of failure. It would be a good idea to use a multi-tier architecture, look at load balancing your app, and to scale horizontally. You’ll get far better performance from many smaller droplets than one expensive high mem system.

I would also refrain from using a non-LTS release of Ubuntu - 16.10 has been EOL since July.

Have another answer? Share your knowledge.

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