Tuesday, June 6, 2017

nginx - High server load on KVM VPS



I have a KVM single core VPS optimized for hosting static content running only Nginx 1.13.8 with SSD and 1GB RAM with a hosting provider on a package of 100 Mbit/s unmetered bandwidth.



OS in use is 3.10.0-693.17.1.el7.centos.plus.x86_64



The server is constantly at high load of Load average: 2.59 2.16 1.90




There's no PHP or MySQL services installed or running on this server.



lscpu shows:



Architecture:          x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1

Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 13
Model name: QEMU Virtual CPU version (cpu64-rhel6)
Stepping: 3
CPU MHz: 2266.746
BogoMIPS: 4533.49

Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
NUMA node0 CPU(s): 0
Flags: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 hypervisor lahf_lm


The average daily bandwidth usage is 40Mbit/s




The maximum memory usage at any given time is between 300MB ~ 350MB



The nginx error log is only less than 8KB per day.



Looking at the top command, nginx service constantly shows 20~30% at the CPU column, which I believe isn't too bad.



What could be the possible causes of this high server load?



Since nginx is pretty resource efficient for serving static content, I can't think of a reason that's causing the bottleneck.




I'm suspecting the host maching hosting the VPS is overloaded, will this reflect the high figures in load average?



Given this high load average stats, nginx is still serving the static content and pushing the bandwidth smoothly.



But it's making me worry about the stability.



I've tried the exact same server deployment with another hosting company on a dual-core setup and distribute the traffic using RRDNS for testing.



The resource usage is only at 0.05 ~ 0.30 at all time with same amount of memory / bandwidth consumption.



Answer



Please check the application that causes the High CPU Load by running this terminal command below:



ps -eo pcpu,pid,user,args | sort -k1 -r | head -10


Got this from this link



You may also run htop and send us your screenshots.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...