Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am using c1.medium (2 cores, 2gb) with nginx web server and gunicorn app server.I am running this with 5(2*cores+1) gunicorn workers.

how can i improve my server performance???

Here is my nginx conf:

user              ubuntu;
worker_processes  4;
error_log  /var/log/nginx/error.log  info;
pid        /var/run/nginx.pid;
events {
worker_connections  1024;
accept_mutex off;
}

http {
include       /etc/nginx/mime.types;
default_type  application/octet-stream;
log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

sendfile        on;
keepalive_timeout  65;

upstream app_server {
    server unix:/tmp/gunicorn.sock fail_timeout=0;
}

server {
listen       80 default;
client_max_body_size 4G;
server_name  _;    

    keepalive_timeout 5;        

    location /static {
        alias   /home/ubuntu/Mvc-EB/static;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

 gzip  on;
 gzip_http_version 1.0;
 gzip_comp_level 5;
 gzip_min_length 512;
 gzip_buffers     4 8k;
 gzip_proxied any;
 gzip_types text/plain text/xml application/xml application/xml+rss text/css         text/javascript application/javascript application/json;

 gzip_proxied        expired no-cache no-store private auth;
 gzip_disable        "MSIE [1-6]\.";
 gzip_vary           on;

        if (!-f $request_filename) {
            proxy_pass http://app_server;
            break;
        }
    }
}
include /etc/nginx/conf.d/*.conf;
}

I have tested it using ab-benchmark

here are the results

1000 requests in total with 50 concurrent requests

mani@mani-Inspiron-N5110:~$ ab -A username:password -n 1000 -c 50       
http://122.248.238.32/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 122.248.238.32 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:        nginx/1.1.19
Server Hostname:        122.248.238.32
Server Port:            80

Document Path:          /
Document Length:        22483 bytes

Concurrency Level:      50
Time taken for tests:   54.696 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      22643000 bytes
HTML transferred:       22483000 bytes
Requests per second:    18.28 [#/sec] (mean)
Time per request:       2734.800 [ms] (mean)
Time per request:       54.696 [ms] (mean, across all concurrent requests) 
Transfer rate:          404.28 [Kbytes/sec] received

Connection Times (ms)
          min  mean[+/-sd] median   max
Connect:      175  461 879.0    215   15236
Processing:   367 1602 3464.0    446   46001
Waiting:      181 1194 2848.6    221   32193
Total:        543 2063 3582.0    672   46211

Percentage of the requests served within a certain time (ms)
  50%    672
  66%    883
  75%   1669
  80%   3515
  90%   4803
  95%   7316
  98%  13492
  99%  21257
  100%  46211 (longest request)

2000 requests in total with 100 concurrent requests

mani@mani-Inspiron-N5110:~$ ab -A username:password -n 2000 -c 100  
http://122.248.238.32/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 122.248.238.32 (be patient)
Completed 200 requests
Completed 400 requests
Completed 600 requests
Completed 800 requests
Completed 1000 requests
Completed 1200 requests
Completed 1400 requests
Completed 1600 requests
Completed 1800 requests
Completed 2000 requests
Finished 2000 requests

Server Software:        nginx/1.1.19
Server Hostname:        122.248.238.32
Server Port:            80

Document Path:          /
Document Length:        22483 bytes

Concurrency Level:      100
Time taken for tests:   110.536 seconds
Complete requests:      2000
Failed requests:        0
Write errors:           0
Total transferred:      45286000 bytes
HTML transferred:       44966000 bytes
Requests per second:    18.09 [#/sec] (mean)
Time per request:       5526.808 [ms] (mean)
Time per request:       55.268 [ms] (mean, across all concurrent requests)
Transfer rate:          400.09 [Kbytes/sec] received

Connection Times (ms)
          min  mean[+/-sd] median   max
Connect:      175 1002 3998.5    220   63361
Processing:   369 2600 5535.5    476   63055
Waiting:      183 1724 3860.8    234   57319
Total:        578 3602 6901.1    835   73936

Percentage of the requests served within a certain time (ms)
  50%    835
  66%   2876
  75%   3628
  80%   3953
  90%   8483
  95%  14021
  98%  27130
  99%  34247
  100%  73936 (longest request)
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.