VPS Drupal tuning Apache2, varnish, memcached, ACP
Here the info
xxxx@serviidb:~# ab -n 200 -c 4 http://www.serviidb.com/
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 www.serviidb.com (be patient)
Completed 100 requests
Completed 200 requests
Finished 200 requests
Server Software: Apache/2.2.14
Server Hostname: www.serviidb.com
Server Port: 80
Document Path: /
Document Length: 202809 bytes
Concurrency Level: 4
Time taken for tests: 1.141 seconds
Complete requests: 200
Failed requests: 0
Write errors: 0
Total transferred: 40668990 bytes
HTML transferred: 40561800 bytes
Requests per second: 175.23 [#/sec] (mean)
Time per request: 22.827 [ms] (mean)
Time per request: 5.707 [ms] (mean, across all concurrent requests)
Transfer rate: 34797.25 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 1 23 144.7 2 1034
Waiting: 0 21 144.7 0 1031
Total: 1 23 144.7 2 1034
Percentage of the requests served within a certain time (ms)
50% 2
66% 2
75% 3
80% 3
90% 3
95% 4
98% 1033
99% 1033
100% 1034 (longest request)
part of my apache2.conf
#
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 2
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 6
##
## Server-Pool Size Regulation (MPM specific)
##
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<ifmodule mpm_prefork_module="">StartServers 1
MinSpareServers 3
MaxSpareServers 6
ServerLimit 24
MaxClients 24
MaxRequestsPerChild 3000</ifmodule>
# Include generic snippets of statements
Include /etc/apache2/conf.d/
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
Include /etc/phpmyadmin/apache.conf
parts of MYSQL my.com
[mysqld]
max_allowed_packet = 16M
key_buffer = 16k
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 2M
myisam_sort_buffer_size = 2M
query_cache_size = 14M
#
# * Basic Settings
#
#
# * IMPORTANT
# If you make changes to these settings and your system uses apparmor, you may
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#
user = mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
#key_buffer = 16M
max_allowed_packet = 1M
thread_stack = 64K
thread_cache_size = 4
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
#query_cache_size = 16M
#
9 Replies
xxxxx@serviidb:~# ab -n 500 -c 4 http://www.serviidb.com/
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 www.serviidb.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Finished 500 requests
Server Software: Apache/2.2.14
Server Hostname: www.serviidb.com
Server Port: 80
Document Path: /
Document Length: 202809 bytes
Concurrency Level: 4
Time taken for tests: 0.315 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 101674000 bytes
HTML transferred: 101404500 bytes
Requests per second: 1587.34 [#/sec] (mean)
Time per request: 2.520 [ms] (mean)
Time per request: 0.630 [ms] (mean, across all concurrent requests)
Transfer rate: 315217.58 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 1 2 0.9 2 8
Waiting: 0 1 0.6 0 4
Total: 1 2 0.9 2 8
WARNING: The median and mean for the waiting time are not within a normal deviation
These results are probably not that reliable.
Percentage of the requests served within a certain time (ms)
50% 2
66% 3
75% 3
80% 3
90% 3
95% 4
98% 5
99% 6
100% 8 (longest request)
Your maxclients should be something like 10, which leaves some room for MySQL, other things, caching, etc.
EDIT: You're also not using ab right for load testing if you're setting the concurrency way lower than your maxclients.
i was having the same problem in my drupal 7 site too. I have a linode 512mb.
Follow some support instructions, like the default configurations..
Disabled KeepAlive and MaxClients = 7 and stopped having problems and the site is must faster.. Although i would like to tune it more.
I'm not a sysadmin.. should i decrease MaxClients even more? One of the site's features is to upload large image files (4/5 mb) and using imagemagik to resize them, which consumes a lot of memory..
Should i install apc or memcached?
Can someone give me some advices to keep overall memory balanced?
Your case of file uploads is different from the standard case, you need to keep your maxclients high enough for this scenario. You may need to do one of these two things:
1) Get more RAM to support higher maxclients
2) Switch from prefork to worker so that you can handle larger numbers of simultaneous clients in a more memory-friendly manner
The uploads are only made by me and another person (content manager) the main purpose of the site is simply to display content… It's not for public user registrations at the moment.
Thank you for the advice, i'll have to upgrade the account in the future if i need those requirements.
Wonder what people think of LINODE after seeing all their stinky spam?
Really cool and techie - or just plain lazy and stupid?
Maybe we should have a POLL (which is almost as bad as spam).
Perhaps LINODE should read up on FORUM MODERATORS in the PHPBB Forum manual.
If only they had members across the globe, hence across all time zones, that could moderate such dribble.
Nah, that would make way too much sense.