Configure Apache for high performance on drupal 6

Events happening in the community are now at Drupal community events on www.drupal.org.
rokape's picture

I need someone help me for config drupal 6.15 for hight performance on apache server.Now i run site on VPS hostgator with 1,3G ram.So now i need everybody show me some files config:etc:
1.my.cnf
2.httpd.conf
3.Cache for PHP
4.mysql turning...
5.what mod of apache can disable?
I need very detail for that file to understand.can you show me for this?
And what module should i turn off to have best performance?i hear someone tell :statics module...?List modules i used in attach.
Thanks all!

AttachmentSize
modules.txt2.2 KB

Comments

Best way for Apache

kbahey's picture

You have a wrong title, you are asking about Apache, but then go on in the post and ask about everything else too.

Better to stay on topic.

For Apache, the most efficient way is to run PHP in FastCGI mode, and Apache with MPM worker (threaded server). Performance is about the same as mod_php, yet the memory foot print is much much less.

Here is an article with details on Apache fcgid configuration

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

i kinda disagree

Milan0's picture

I've done some benchmarking with these setups

Linode 540 + 270 extra ram (810 megs)
Ubuntu+mysql+apache+ apache worker+ mod_fcgid +php+ apc+varnish

Ubuntu+mysql+apache+ apache prefork + mod_php+php+ apc+varnish

Indeed, fastcgi has a lot smaller memory footprint, its RAM usage is very predictable and thus very scalable, however you should be aware that usingg an opcode casher in combination with fastcgi will be troublesome, since apc does not share its mem along processes, meaning it will put down a memory block cahce for every request. This is secure, but will hog up the memory..

Also i've found fastcgi very unreliable in serving requests when concurrency of users starts going up.
A 98-95 % succes rate of serving requests is noted by me in several benchmarks, which means on scale a large amount of users will get a 'service unavailable' or request timeouts. You will see alot of requests coming through fine, and a bunch of them taking 10-15x amount of pageload time.

This gets even worse when you start adding a session cooki, and i was not very impressed to say the least. Pageload time goes up, requests /s goes down fast.

I've found the standard apache prefork + mod_php+php much more reliable and faster in combination with apc and varnish.
I can serve alot more anonymous requests faster because they are all proxied, and sessions are handled faster.
I'm not an expert in any way, so my conclusions might be false .

However i've seen similair warnings and benchmarks all over the web also taking about unreliable request delivery and the problem with opcode caches.

http://2bits.com/articles/apache-fcgid-acceptable-performance-and-better...

Therefor i've decided to go with the traditional setup.
While i will have to worry alot more about RAM, and not putting the server in swap-hell, i've found that Apache's prefork config can be scaled along the way. You would have to do the same for FastCgi, there is no difference there, it just has a smaller footprint to start with, but when concurrency goes up, you will seemore and more requests not being served and timing out.

Yes and no

kbahey's picture

Hi. I am the author of the article you linke d to.

Yes, with FastCGI, each process has a copy of the APC code cache. This also restricts using APC as a data cache (e.g. cache router), but you are better off with memcache in any case.

No, FastCGI is not unreliable. It is very reliable. We use it for several client sites, some of them get over 1 million pages views a day, and even 2 million as well (full article coming soon). The key here is to use fcgid, not other ways of running FastCGI (mod-fastcgi, ...etc.)

We use MPM Worker, and it is very stable, using the configurations in the said article.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

Then i guess

Milan0's picture

Its back to the sandbox for me :) Thanks alot for your great insight.

I'going to give it another shot from a clean config@

How can i install varnish

rokape's picture

How can i install varnish with apache(installed cpanel)?

Also for mods to disable

Milan0's picture

mod_ssl, mod_cache, mod_file_cache, mod_disk_cache

THe first ofcourse only if not using SSL, when going preverse proxy cash id def go for Varnish with drupal, and disable the apache cache mods above.

I use one php-cgi process

brianmercer's picture

I use one php-cgi process with many children and all the children use one shared APC cache. What is the advantage of using more than one process? (except if you're a shared host and want to run multiple processes as different users)

fcgid or something else?

kbahey's picture

I tried fcgid with children. I can't remember the exact parameters, but it overran memory in some cases, or was stable in others, so I went to the source code of fcgid, and checked what parameters are there, experimented with them, ...et.c and ended up with the stable configuration linked to in the 2bits.com article. This configuration has an APC shared memory segment for each process.

Are you using fcgid or something else for FastCGI? Please post some details, config, ...etc.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

i think i got it right now but..

Milan0's picture

Switching from APC to memcache in cacherouter seems to have fixed most of the issue :)

I'm using a couple more php-cgi processes. Since i am using 4 vCPU's, i'm using 4-8, think this should be ok, nothing weird happening.

Only thing i'm experiencing is this:
1 out of like 10 SIEGE requests ends up taking 2-7x as slow as the others.
This might be because the current php-cgi process slots are full, and its jus waitng for a process to respawm.

What do you think? The request is still served, it just takes ungodly long.

When i cut down on php-cgi processes, (1) i see a steep climb in pageload time, and after a minute, i start getting connection timeouts.

Note i'm benchmarking with a session set, to avoid results being obscured by Varnish.

I'm installed Cen

rokape's picture

I'm installed Cen OS5+mysql+apache+ apache worker+ mod_fcgid +php+ xcache.
But what's +varnish?Pressflow 6?

@Rokape: can you please post

introfini's picture

@Rokape: can you please post instructions how to do that in CentOS? I've tried everything but I can't make it to work.

Thanks.

Pressflow and varnish

Milan0's picture

Pressflow 6 == Drupal 6, but with optimized core.
Porting is as simple as installing pressflow and copying modules and database over to the new pressflow installation.

Varnish is a reverse-proxy for apache.
Varnish acts as a middle-man between client and apache, so varnish will serve files from its cache first (static pages) before contacting apache for things that can't be cached. (dynamic pages).

Thanks man. So compare

rokape's picture

Thanks man.
So compare betweet: drupal6+boost vs Pressflow 6+varnish on performance+speed of websie?

How to configure

rokape's picture

How to configure Drupal+Varnish?Install Varnish?My VPS on gator with centos 5

Pressflow is Drupal with some

brianmercer's picture

Pressflow is Drupal with some optimizations and added features. Drupal only patches with bug fixes once it's released. Pressflow adds core improvements, often backported from Drupal development on the next version.

If you want to use Varnish then you'll have to use Pressflow, or else patch vanilla Drupal with the reverse proxy patch that the Pressflow guys have backported.

Check out http://groups.drupal.org/node/25425 for instructions on setting up Drupal with Varnish like they do on the Pantheon/Mercury prefab Amazon images. Note of warning though, those instructions are for the Ubuntu/Debian way of doing some things and will have to be adjusted for Centos/Red Hat.

Thanks!I Hope anyone guides

rokape's picture

Thanks!I Hope anyone guides me install and config on centos5...

Concurrency Level:

rokape's picture

Concurrency Level: 200
Time taken for tests: 28.58718 seconds
Complete requests: 20000
Failed requests: 0
Write errors: 0
Total transferred: 495960000 bytes
HTML transferred: 488120000 bytes
Requests per second: 712.79 [#/sec] (mean)
Time per request: 280.587 [ms] (mean)
Time per request: 1.403 [ms] (mean, across all concurrent requests)
Transfer rate: 17261.48 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 16 171.6 1 3045
Processing: 1 224 722.1 149 24609
Waiting: 0 196 700.5 135 24607
Total: 7 241 743.4 151 24622
Bendmark with Cen OS5+mysql+apache+ apache worker+ mod_fcgid +php+ xcache.
That's good or not?VPS 1,3G RAM,CPU 2,27G,1 core?

I have a comment about your

jose.amengual's picture

I have a comment about your Concurrency Level.

Whatever tool you use like ab or siege to test you drupal site, you have to run it for more than 60 sec or 60 secs at least.

I have been working in tuneup Drupal with varnish and etc and if you run a test for 28 seconds you can even get 10000 req/s but if you run it for 60 sec you will get more realistic results around 1000 req/s or so.

I've read that for using the

joehudson's picture

I've read that for using the same APC cache for PHP in fastcgi mode, you need to use mod_fastcgi, not mod_fcgid, becasue only fastcgi (not the newer fcgid) allows PHP to distribute requests over it's own child processes: http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week