0

I'm using nginx as a load balancer on amazon ec2 m3.large instance. This load balancer will receive loads from a load generator and distributed them to the 3 instance with mysql database serves as backend. The thing is, when I use 1 instance to run the load test. It can handle 6000 queries per second. But when i use nginx serves as load balancer and 3 backend instances which are all m3.large. The throughput is still 6000. And the CPU utilization of the 3 backend instance are all 25% (after warming up for many times). When I run a single instance, the CPU utilization will be 80%. Please! give me some suggestions about this bottle neck. Here is my sites-avalable/default file and nginx.conf file. And i did not change any other thing in this system.

DEFAULT:

upstream first15 {
           server ec2-54-165-7-29.compute-1.amazonaws.com:80 ;
    }
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    location / {
            proxy_pass  http://first15;
    }

nginx.conf:

user www-data;
worker_processes 4;
pid /run/nginx.pid;
worker_rlimit_nofile 100000;

events {
        worker_connections 20480;
        multi_accept on;
        use epoll;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
       server_names_hash_bucket_size 128;
        client_header_buffer_size 2k;
        large_client_header_buffers 4 4k;
        client_max_body_size 8m;
  • 3
    Is the nginx servers maxxed out on some resource ( CPU, RAM, network bandwidth (internal or external), TCP connections, disk throughput, etc.) when the test is running? If not, your bottleneck may be elsewhere. – Ladadadada Nov 16 '14 at 7:57
  • no the cpu utilization and memory is low in the front – Pushen Gao Nov 16 '14 at 16:27
  • Try to increase worker_processes and worker_connections. – Alexey Ten Nov 17 '14 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.