You are on page 1of 9

24.2.

2014

Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared | 2bits.com, Inc. - Drupal Performance Optimization, De

SERVICES

SOFTWARE

PARTNERS

ARTICLES

CONTACT

TESTIMONIALS PAYMENTS NEWS FAQ SITEMAP

Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared
Published Sun, 2008/04/20 - 17:33, Updated Thu, 2008/08/28 - 15:45 4
Article s

Almost every one knows that running high traffic sites powered with PHP applications is impossible without a PHP op-code cache / accelerators. Op-code caches speed up PHP applications by parsing and tokenizing PHP scripts once, and executing them faster for every subsequent request. There are several accelerators available, many of them are free. The ones that are maintained are:
APC eAccelerator XC ache

Do you use any of our Drupal modules? Did you find our Drupal, WordPress, and LAMP performance articles informative? Follow us on Twitter @2bits for tips and tricks on Drupal and WordPress Performance Contact us for Drupal and WordPress Performance Optimization and Tuning Consulting

Navigation
Payment Recent posts

Sometime ago, we conducted a benchmark of Drupal using APC vs eAccelerator where the latter was found to be a better performer than the former in terms of speed and memory consumption. It is now time to update this benchmark and include XCache as well.

Configuration
The tests were run on the following configuration: Hardware AMD Athlon 64 X2 Dual Core Processor 4400+ @ 2.2GHz, 1MB cache and 2GB RAM. 160GB SATA 7200RPM hard disk. Software GNU/Linux Ubuntu server Gutsy 7.10, Apache 2.2.4, MySQL 5.0.45 and PHP 5.2.3. Drupal The tests were run on Drupal 6.3-dev, checked out from CVS. Views and CCK are installed and enabled, but there are no views nor CCK types defined. Using the devel generate module, we created 2,000 users, 5 vocabularies, and 50 terms. We then created 2,000 nodes of type page and story, with 5 comments each, and assigned terms to them. All Drupal caching is disabled.

In Depth Articles
C lient Testimonials Developing, tracing and debugging Drupal Drupal Performance Tuning and Optimization for large web sites PHP op-code caches / accelerators: Drupal large site case study Abuse Drupal Best Practices at your own peril: Poor Performance Admin Menu module: Popular yet occasionally problematic Apache 2 and PHP5 on Ubuntu Feisty: bloated? Apache with fcgid: acceptable performance and better resource utilization Avoid excessive disk writes by avoiding PHP errors

PHP op-code caches


We used the following versions of each op-code cache, we also note how it was installed, and what the configuration details we used: XCache XCache is a spinoff of the lighttpd web server. It is currently maintained. We used version: 1.2.1, which is available from the APT repositories for Ubuntu Gutsy, as php5-xcache. Being available in the Ubuntu/Debian repositories means that installing Xcache was the easiest of the bunch using aptitude. Configuring XCache requires some parameters to change though if you want the cache to be in memory though. We used the following configuration to change the file which resides in /etc/php5/conf.d/xcache.ini. [ x c a c h e ] x c a c h e . s h m _ s c h e m e= " m m a p " x c a c h e . s i z e = 4 8 M x c a c h e . c o u n t= 2 x c a c h e . s l o t s= 8 K x c a c h e . t t l = 0 x c a c h e . g c _ i n t e r v a l= 0 x c a c h e . r e a d o n l y _ p r o t e c t i o n=O f f x c a c h e . m m a p _ p a t h= " / v a r / c a c h e / x c a c h e . m m a p " x c a c h e . c o r e d u m p _ d i r e c t o r y= " " x c a c h e . c a c h e r= O n x c a c h e . s t a t = O n x c a c h e . o p t i m i z e r= O f f x c a c h e . v a r _ s i z e = 0 M x c a c h e . v a r _ c o u n t= 1 x c a c h e . v a r _ s l o t s= 8 K x c a c h e . v a r _ t t l = 0 x c a c h e . v a r _ m a x t t l = 0 x c a c h e . v a r _ g c _ i n t e r v a l= 3 0 0 x c a c h e . t e s t= O f f eAccelerator eAccelerator is a fork of an older op-code cache called Turck MMCache that has been abandoned. eAccelerator development seems to have been slow of late, and is not keeping up with the latest versions of PHP 5. We found that eAccelerators can be unstable with newer versions of PHP and Drupal, and Apache will die with segmentation faults often. We had to use the log watcher script for restarting Apache automatically when this happens, but it was too frequent in some cases to be a real nuisance. We used version v0.9.5.2, which is the latest stable release.

http://2bits.com/articles/benchmarking-drupal-with-php-op-code-caches-apc-eaccelerator-and-xcache-compared.html

in your code Benchmarking APC vs. eAccelerator using Drupal Benchmarking Drupal 5.x vs. 6.x: which one is faster? Benchmarking Drupal from the shell command line Benchmarking Drupal with PHP opcode caches: APC , eAccelerator and XC ache compared Benchmarking PostgreSQL vs. MySQL performance using Drupal 5.x Benchmarking Zend Server C ommunity Edition with Drupal Benchmarking strings overrides vs. locale module Beware of Drupal modules that disable the page cache Beware when Drupal/Pressflow displays messages for anonymous users Botnet hammering web site causing outages Bottleneck: Replacing taxonomy_term_count in taxonomy_dhtml Bypassing Drupal core Node Access

1/9

24.2.2014

Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared | 2bits.com, Inc. - Drupal Performance Optimization, De
We used version v0.9.5.2, which is the latest stable release. It was installed from source using the following commands: p h p i z e . / c o n f i g u r e m a k e m a k ei n s t a l l We used the following configuration which resides in /etc/php5/conf.d/eaccelerator.ini. z e n d _ e x t e n s i o n e a c c e l e r a t o r . s h m _ s i z e e a c c e l e r a t o r . c a c h e _ d i r e a c c e l e r a t o r . e n a b l e e a c c e l e r a t o r . o p t i m i z e r e a c c e l e r a t o r . c h e c k _ m t i m e e a c c e l e r a t o r . d e b u g e a c c e l e r a t o r . f i l t e r e a c c e l e r a t o r . s h m _ m a x e a c c e l e r a t o r . s h m _ t t l e a c c e l e r a t o r . s h m _ p r u n e _ p e r i o d e a c c e l e r a t o r . s h m _ o n l y e a c c e l e r a t o r . c o m p r e s s e a c c e l e r a t o r . c o m p r e s s _ l e v e l APC APC is a PECL package that is maintained by the core PHP developers, including Gopal and Rasmus. It has several advantages including a very simple configuration, and close tracking of PHP versions. Being actively maintained is a big plus for APC. We used version 3.0.16 of APC. It was installed using PECL, via the following command: p e c li n s t a l la p c The configuration for APC is very minimalistic. We used the following configuration file in /etc/php5/conf.d/apc.ini. e x t e n s i o n a p c . s h m _ s i z e =a p c . s o =4 8 =/ u s r / l i b / p h p 5 / 2 0 0 6 0 6 1 3 / e a c c e l e r a t o r . s o =4 8 =/ v a r / c a c h e / e a c c e l e r a t o r =1 =1 =0 =0 =" " =0 =0 =0 =1 =1 =9
core Node Access table joins to avoid outage caused by slow queries C an a Drupal web site handle a million page views a day? C ase study: Views, Quicktabs and template.php C ommon Issues and Solutions for Dealing with C loud C omputing and VPS performance issues for Drupal C onfiguring Drupal with multiple bins for memcached C orrect C lient IP Address with a Reverse Proxy or C ontent Delivery Network (C DN) Do not configure the Service Links module with TinyURL.com Drupal 7.x and Pressflow pitfalls can reduce your site's performance Drupal core caching and contributed content caching modules Drupal not saving admin pages with large number of input fields Drupal on a dedicated servers vs. Amazon AWS/EC 2 Drupal performance tuning and optimization / userpoints seminar at Open C raft Drupal site excessive memory usage traced to APC and php5memcached Examples for Drupal custom caching: Adding a cache timestamp to cached pages and HTTP headers Fast, Parallel MySQL Backups and Imports with Mydumper Free your content of PHP: Moving PHP code out of blocks, views and nodes Google C rawler hitting your site too aggressively? High PHP execution times for Drupal, and tuning APC for include_once() performance High server load because of repeating queries too many times Hosting Virtualization: Virtuozzo/OpenVZ vs. Xen, which is best? How Drupal's node_access table can negatively impact site performance How Google and Bing crawlers were confused by quicktabs How relying on connections to third party servers can be detrimental to performance How to reduce page load times by sending emails via cron, rather on page submission Identifying aggressive crawlers using Go Access Improving the performance of Drupal's cron by using the Elysia cron module Increasing Drupal's speed via the Squid caching reverse proxy

Benchmarking methodology
We used the Apache Benchmark (ab) command, with a concurrency of 5, and 3,000 requests, like so: a bc 5n 3 0 0 0h t t p : / / e x a m p l e . c o m / Test 1: No PHP op-code cache In this test, we established a baseline of how Drupal 6 would perform without any op-code cache. D o c u m e n tP a t h : / D o c u m e n tL e n g t h : 2 1 7 5 7b y t e s C o n c u r r e n c yL e v e l : 5 T i m et a k e nf o rt e s t s : 2 8 8 . 2 5 5 2 1 2s e c o n d s C o m p l e t er e q u e s t s : 3 0 0 0 F a i l e dr e q u e s t s : 0 W r i t ee r r o r s : 0 T o t a lt r a n s f e r r e d : 6 6 7 7 7 0 0 0b y t e s H T M Lt r a n s f e r r e d : 6 5 2 7 1 0 0 0b y t e s R e q u e s t sp e rs e c o n d : 1 0 . 4 1[ # / s e c ]( m e a n ) T i m ep e rr e q u e s t : 4 8 0 . 4 2 5[ m s ]( m e a n ) T i m ep e rr e q u e s t : 9 6 . 0 8 5[ m s ]( m e a n ,a c r o s sa l lc o n c u r r e n tr e q u e s t s ) T r a n s f e rr a t e : 2 2 6 . 2 3[ K b y t e s / s e c ]r e c e i v e d C o n n e c t i o nT i m e s( m s ) m i n m e a n [ + / s d ]m e d i a n m a x C o n n e c t : 0 0 0 . 5 0 1 9 P r o c e s s i n g : 1 8 1 4 7 91 8 6 . 0 4 4 4 1 8 2 2 W a i t i n g : 1 6 6 4 6 11 8 4 . 7 4 2 7 1 7 0 8 T o t a l : 1 8 1 4 7 91 8 6 . 0 4 4 4 1 8 2 2 P e r c e n t a g eo ft h er e q u e s t ss e r v e dw i t h i nac e r t a i nt i m e( m s ) 5 0 % 4 4 4 6 6 % 5 2 5 7 5 % 5 7 7 8 0 % 6 1 9 9 0 % 7 3 2 9 5 % 8 1 9 9 8 % 9 4 6 9 9 % 1 0 1 2 1 0 0 % 1 8 2 2( l o n g e s tr e q u e s t )

Using the devel module, we see that the page generation time for PHP is around 200 ms. P a g ee x e c u t i o nt i m ew a s2 0 9 . 5 8m s .E x e c u t e d1 0 1q u e r i e si n9 . 6m i l l i s e c o n d s . Memory utilization is consistent at 24MB per Apache process. Note that the sixth colum (Resident Set Size) is what matters. V i r tR e s 0 2 1 3 M2 4 6 6 0 3 7 4 4S 0 . 0 1 . 2 0 : 5 1 . 3 7/ u s r / s b i n / a p a c h e 2ks t a r t 0 2 1 3 M2 4 4 8 4 3 8 2 4S 0 . 0 1 . 2 0 : 5 1 . 3 7/ u s r / s b i n / a p a c h e 2ks t a r t 0 2 1 3 M2 4 4 8 4 3 8 2 4S 0 . 0 1 . 2 0 : 5 0 . 9 5/ u s r / s b i n / a p a c h e 2ks t a r t

1 3 6 1 6w w w d a t a 1 6 1 3 6 1 9w w w d a t a 1 5 1 3 6 2 7w w w d a t a 1 5

http://2bits.com/articles/benchmarking-drupal-with-php-op-code-caches-apc-eaccelerator-and-xcache-compared.html

2/9

24.2.2014

Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared | 2bits.com, Inc. - Drupal Performance Optimization, De
1 3 6 1 7w w w d a t a 1 3 6 2 4w w w d a t a 1 3 6 2 6w w w d a t a 1 3 6 1 5w w w d a t a 1 3 6 2 3w w w d a t a 1 3 6 2 5w w w d a t a 1 3 6 1 8w w w d a t a 1 5 1 5 1 6 1 6 1 5 1 5 1 6 0 0 0 0 0 0 0 2 1 3 M2 4 4 8 4 2 1 3 M2 4 4 0 8 2 1 3 M2 4 4 0 8 2 1 3 M2 4 4 0 4 2 1 3 M2 4 4 0 4 2 1 3 M2 4 4 0 4 2 1 3 M2 4 4 0 4 3 8 2 4S 3 7 4 8S 3 7 4 8S 3 7 4 4S 3 7 4 4S 3 7 4 4S 3 7 4 4S 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 1 . 2 1 . 2 1 . 2 1 . 2 1 . 2 1 . 2 1 . 2 0 : 5 0 . 1 4/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 4 8 . 9 9/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 5 0 . 0 7/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 5 1 . 0 3/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 4 9 . 3 9/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 5 2 . 9 5/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 4 9 . 9 3/ u s r / s b i n / a p a c h e 2ks t a r t
proxy Installing PHP APC on GNU/Linux C entos 5 Installing PHP APC on GNU/Linux Ubuntu Gutsy Gibbon 7.10 (and Debian) Installing Varnish 3.x on Ubuntu Server 12.04 LTS and using Munin to monitor it Installing eAccelerator 0.9.5.1 on Ubuntu Feisty 7.04 Installing memcached 1.2.5 and memcache pecl 2.2.3 on Ubuntu server Large web site scalability: The Slashdot infrastructure hardware and software Less is more: Keeping down the number of modules by extending existing ones Measuring memory consumption by Drupal bootstrap and modules Memory usage revisited: when the Open Buffet is not to blame, rather Views Microsoft-WebDAVMiniRedir + Drupal singlesignon = An aggressive crawler Monitoring MySQL queries using PROC ESSLIST along with system resource utilization MySQL InnoDB: performance gains as well as some pitfalls MySQL my.cnf configuration for a large Drupal site Native PHP compilers: Roadsend Node creation and editing slow in Internet Explorer? Here is a solution ... Overcoming long Views rendering time on Drupal sites Performance C ase Study: Scaling of a Drupal intranet for a large multinational corporation Performance C ase Study: slow database queries from web to database server Performance Logging and Monitoring: A module to log and monitor performance statistics for Drupal Performance benchmarking of Drupal 5.12, Drupal 6.6, and Drupal 7.x: we are getting slower ... Performance issues with memcache module 6.x-1.13 Podcast: Khalid Baheyeldin on Drupal Performance Presentation: 2.8 Million page views per day, 70 million per month, one server! Presentation: 3.4 Million page views per day, 92 million per month, one server and Drupal Presentation: Drupal Backend Performance Optimization and tuning: a guide for everyone Presentation:

Test 2: eAccelerator
D o c u m e n tP a t h : / D o c u m e n tL e n g t h : 2 1 7 5 7b y t e s C o n c u r r e n c yL e v e l : 5 T i m et a k e nf o rt e s t s : 9 5 . 9 8 3 9 8 6s e c o n d s C o m p l e t er e q u e s t s : 3 0 0 0 F a i l e dr e q u e s t s : 0 W r i t ee r r o r s : 0 T o t a lt r a n s f e r r e d : 6 6 7 7 7 0 0 0b y t e s H T M Lt r a n s f e r r e d : 6 5 2 7 1 0 0 0b y t e s R e q u e s t sp e rs e c o n d : 3 1 . 2 6[ # / s e c ]( m e a n ) T i m ep e rr e q u e s t : 1 5 9 . 9 7 3[ m s ]( m e a n ) T i m ep e rr e q u e s t : 3 1 . 9 9 5[ m s ]( m e a n ,a c r o s sa l lc o n c u r r e n tr e q u e s t s ) T r a n s f e rr a t e : 6 7 9 . 3 9[ K b y t e s / s e c ]r e c e i v e d C o n n e c t i o nT i m e s( m s ) m i n m e a n [ + / s d ]m e d i a n m a x C o n n e c t : 0 0 0 . 1 0 3 P r o c e s s i n g : 5 7 1 5 9 9 1 . 3 1 4 8 3 8 3 0 W a i t i n g : 5 0 1 5 2 8 9 . 8 1 4 2 3 7 0 4 T o t a l : 5 7 1 5 9 9 1 . 3 1 4 8 3 8 3 0 P e r c e n t a g eo ft h er e q u e s t ss e r v e dw i t h i nac e r t a i nt i m e( m s ) 5 0 % 1 4 8 6 6 % 1 7 4 7 5 % 1 9 3 8 0 % 2 0 5 9 0 % 2 3 9 9 5 % 2 6 3 9 8 % 2 8 9 9 9 % 3 0 9 1 0 0 % 3 8 3 0( l o n g e s tr e q u e s t ) Using devel, the PHP time is around 47 ms. A significant improvement over not using an op-code cache. P a g ee x e c u t i o nt i m ew a s5 7 . 8 8m s .E x e c u t e d1 0 1q u e r i e si n9 . 0 1m i l l i s e c o n d s . Memory utilization for Apache is as follows. The 30MB process size is from the first run where the PHP scripts were loaded, parsed and tokenized. The other processes are from the subsequent requests and they range from 23MB to 18MB. 9 8 0 1w w w d a t a 9 7 9 9w w w d a t a 9 7 9 7w w w d a t a 9 8 0 0w w w d a t a 9 8 0 6w w w d a t a 9 8 0 8w w w d a t a 9 8 0 7w w w d a t a 9 8 0 3w w w d a t a 9 8 0 9w w w d a t a 9 8 0 5w w w d a t a 1 6 1 6 1 6 1 5 1 6 1 6 1 5 1 5 1 6 1 6 0 0 0 0 0 0 0 0 0 0 V i r tR e s 2 6 1 M3 0 6 8 81 2 6 4 4S 2 5 4 M2 3 8 4 81 2 5 8 8S 2 5 3 M2 2 5 3 61 2 2 7 2S 2 5 1 M2 0 0 2 81 1 8 3 2S 2 5 1 M1 8 5 3 61 0 3 9 6S 2 5 1 M1 8 5 3 61 0 3 9 6S 2 5 1 M1 8 5 3 61 0 3 9 6S 2 5 1 M1 8 5 3 61 0 3 9 6S 2 5 1 M1 8 5 3 61 0 3 9 6S 2 5 1 M1 8 5 3 61 0 3 9 6S 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 1 . 5 1 . 2 1 . 1 1 . 0 0 . 9 0 . 9 0 . 9 0 . 9 0 . 9 0 . 9 0 : 1 4 . 9 6/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 5 . 8 9/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 5 . 7 4/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 4 . 0 8/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 4 . 7 4/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 4 . 8 3/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 4 . 6 7/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 5 . 6 2/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 4 . 0 7/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 4 . 1 6/ u s r / s b i n / a p a c h e 2ks t a r t

Test 3: XCache D o c u m e n tP a t h : / D o c u m e n tL e n g t h : 2 1 7 5 7b y t e s C o n c u r r e n c yL e v e l : 5 T i m et a k e nf o rt e s t s : 9 9 . 7 6 3 0 0s e c o n d s C o m p l e t er e q u e s t s : 3 0 0 0 F a i l e dr e q u e s t s : 0 W r i t ee r r o r s : 0 T o t a lt r a n s f e r r e d : 6 6 7 7 7 0 0 0b y t e s H T M Lt r a n s f e r r e d : 6 5 2 7 1 0 0 0b y t e s R e q u e s t sp e rs e c o n d : 3 0 . 2 8[ # / s e c ]( m e a n ) T i m ep e rr e q u e s t : 1 6 5 . 1 2 7[ m s ]( m e a n ) T i m ep e rr e q u e s t : 3 3 . 0 2 5[ m s ]( m e a n ,a c r o s sa l lc o n c u r r e n tr e q u e s t s ) T r a n s f e rr a t e : 6 5 8 . 1 9[ K b y t e s / s e c ]r e c e i v e d C o n n e c t i o nT i m e s( m s ) m i n m e a n [ + / s d ]m e d i a n m a x C o n n e c t : 0 0 0 . 0 0 2 P r o c e s s i n g : 5 9 1 6 4 8 3 . 4 1 5 5 3 3 6 7 W a i t i n g : 5 2 1 5 6 6 6 . 4 1 4 8 1 8 0 2 T o t a l : 5 9 1 6 4 8 3 . 4 1 5 5 3 3 6 7 P e r c e n t a g eo ft h er e q u e s t ss e r v e dw i t h i nac e r t a i nt i m e( m s ) 5 0 % 1 5 5 6 6 % 1 7 8 7 5 % 1 9 6 8 0 % 2 0 6 9 0 % 2 3 7 9 5 % 2 6 3 9 8 % 2 8 7 9 9 % 3 0 5 1 0 0 % 3 3 6 7( l o n g e s tr e q u e s t ) Using devel, the page generation is around 50 ms.

http://2bits.com/articles/benchmarking-drupal-with-php-op-code-caches-apc-eaccelerator-and-xcache-compared.html

3/9

24.2.2014

Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared | 2bits.com, Inc. - Drupal Performance Optimization, De
P a g ee x e c u t i o nt i m ew a s5 9 . 3 7m s .E x e c u t e d1 0 1q u e r i e si n9 . 2 7m i l l i s e c o n d s . For memory utilization, you can see that it ranges from 29MB to 19MB, a bit more than eAccelerator. V i r tR e s 2 6 3 M3 2 3 1 61 1 8 3 2S 2 5 9 M2 9 9 7 61 3 4 4 0S 2 6 1 M2 9 7 2 41 1 6 2 8S 2 5 4 M2 3 5 7 61 2 1 2 8S 2 5 1 M1 9 6 2 41 1 5 2 4S 2 5 1 M1 9 6 2 41 1 5 2 4S 2 5 1 M1 9 6 2 41 1 5 2 4S 2 5 1 M1 9 6 2 41 1 5 2 4S 2 5 1 M1 9 6 2 41 1 5 2 4S

1 0 3 1 6w w w d a t a 1 0 3 1 9w w w d a t a 1 0 3 1 8w w w d a t a 1 0 3 1 7w w w d a t a 1 0 3 2 2w w w d a t a 1 0 3 2 8w w w d a t a 1 0 3 2 4w w w d a t a 1 0 3 2 5w w w d a t a 1 0 3 2 7w w w d a t a Test 4: APC

1 6 1 5 1 5 1 6 1 5 1 5 1 5 1 5 1 6

0 0 0 0 0 0 0 0 0

0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0

1 . 6 1 . 5 1 . 4 1 . 1 1 . 0 1 . 0 1 . 0 1 . 0 1 . 0

0 : 1 7 . 0 3/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 7 . 0 5/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 6 . 8 3/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 5 . 3 3/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 6 . 8 5/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 4 . 9 5/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 5 . 3 2/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 4 . 4 2/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 5 . 0 5/ u s r / s b i n / a p a c h e 2ks t a r t

Presentation: Drupal C amp Toronto 2011 Web Site Performance Optimization and Scalability Presentation: Drupal Performance and Scalability: What you need to know Presentation: DrupalC amp Toronto 2008: Drupal Performance Optimization for Large web sites Presentation: HUGE! A Drupal site with 381 modules, 174GB MySQL database, and 200 million row tables Presentation: Linux toolbox for monitoring and performance Presentation: Ontario Linux Fest 2007: Performance Tuning and Optimization for large LAMP sites Presentation: Performance tuning and optimization of high traffic Drupal sites Presentation: The Apache Web Server at the KW Linux Users Group Previous/Next API: a high performance API module for previous/next node Quicktabs can sure use more caching Reduce your server's resource usage by moving MySQL temporary directory to tmpfs Reducing server load by eliminating anonymous sessions for Drupal 6.x Reducing server resource utilization for busy sites by implementing fast 404s in Drupal Reducing the size and I/O load of Apache's web server log files Remember that the C APTC HA module disables page caching Scalability of the Taxonomy Browser module: Restricting number of terms Server indigestion: The Drupal contributed modules "open buffet binge" syndrome Similar Entries module: Scalability issues and workarounds Site slow because of img_assist module and how to solve it Slow MySQL queries on a multiserver setup: use compression Solving High C PU usage and reducing page generation times due to Skinr module Strategies for dealing with resource wasting crawlers Subscriptions module: sending notifications as nodes are updated vs. cron The 80/20 rule for Drupal web site optimization: little actions and big impacts The importance of tuning APC for sites with a high number of Drupal modules

D o c u m e n tP a t h : / D o c u m e n tL e n g t h : 2 1 7 5 7b y t e s C o n c u r r e n c yL e v e l : 5 T i m et a k e nf o rt e s t s : 9 8 . 5 3 0 0 6 8s e c o n d s C o m p l e t er e q u e s t s : 3 0 0 0 F a i l e dr e q u e s t s : 0 W r i t ee r r o r s : 0 T o t a lt r a n s f e r r e d : 6 6 7 7 7 0 0 0b y t e s H T M Lt r a n s f e r r e d : 6 5 2 7 1 0 0 0b y t e s R e q u e s t sp e rs e c o n d : 3 0 . 4 5[ # / s e c ]( m e a n ) T i m ep e rr e q u e s t : 1 6 4 . 2 1 7[ m s ]( m e a n ) T i m ep e rr e q u e s t : 3 2 . 8 4 3[ m s ]( m e a n ,a c r o s sa l lc o n c u r r e n tr e q u e s t s ) T r a n s f e rr a t e : 6 6 1 . 8 4[ K b y t e s / s e c ]r e c e i v e d C o n n e c t i o nT i m e s( m s ) m i n m e a n [ + / s d ]m e d i a n m a x C o n n e c t : 0 0 0 . 0 0 2 P r o c e s s i n g : 5 8 1 6 3 7 1 . 2 1 5 5 2 4 5 2 W a i t i n g : 5 3 1 5 8 6 9 . 6 1 5 0 2 3 2 9 T o t a l : 5 8 1 6 3 7 1 . 2 1 5 5 2 4 5 2 P e r c e n t a g eo ft h er e q u e s t ss e r v e dw i t h i nac e r t a i nt i m e( m s ) 5 0 % 1 5 5 6 6 % 1 7 8 7 5 % 1 9 3 8 0 % 2 0 4 9 0 % 2 3 5 9 5 % 2 5 8 9 8 % 2 8 5 9 9 % 3 0 2 1 0 0 % 2 4 5 2( l o n g e s tr e q u e s t ) Using devel, the page generation time is around 50 ms as well. P a g ee x e c u t i o nt i m ew a s5 9 . 8m s .E x e c u t e d1 0 1q u e r i e si n9 . 1m i l l i s e c o n d s . Memory utilization is noticeably consistent at 21MB per process, more than the other two op-caches, but suprisingly consistent. V i r tR e s 2 6 3 M3 8 1 7 21 8 0 3 6S 2 5 2 M2 1 7 0 41 3 0 2 0S 2 5 2 M2 1 6 0 41 2 7 6 8S 2 5 2 M2 1 6 0 41 2 7 6 8S 2 5 2 M2 1 5 2 01 2 6 9 2S 2 5 2 M2 1 5 2 01 2 6 8 8S 2 5 2 M2 1 5 2 01 2 6 8 8S 2 5 2 M2 1 5 2 01 2 6 8 8S 2 5 2 M2 1 5 2 01 2 6 8 8S 2 5 2 M2 1 5 2 01 2 6 8 8S

9 2 6 3w w w d a t a 9 2 6 6w w w d a t a 9 2 7 0w w w d a t a 9 2 7 4w w w d a t a 9 2 6 4w w w d a t a 9 2 6 7w w w d a t a 9 2 6 8w w w d a t a 9 2 6 9w w w d a t a 9 2 7 3w w w d a t a 9 2 7 5w w w d a t a

1 6 1 5 1 5 1 5 1 6 1 5 1 6 1 5 1 6 1 6

0 0 0 0 0 0 0 0 0 0

0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0 0 . 0

1 . 9 1 . 1 1 . 0 1 . 0 1 . 0 1 . 0 1 . 0 1 . 0 1 . 0 1 . 0

0 : 1 5 . 3 1/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 8 . 1 4/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 8 . 3 0/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 5 . 7 5/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 6 . 5 5/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 8 . 1 0/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 6 . 8 9/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 6 . 5 1/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 7 . 3 2/ u s r / s b i n / a p a c h e 2ks t a r t 0 : 1 6 . 0 3/ u s r / s b i n / a p a c h e 2ks t a r t

Summary
The following table summarizes the above results.
Requests per Second Single Request (milliseconds) Memory (Maximum, MB) Memory (Minimum, MB) None XC ache APC 10.41 30.28 30.45 96.08 31.99 33.02 32.84 24 23 29 21 24 18 19 21 eAccelerator 31.26

Conclusions
From the above results, one can come to the following conclusions:
All op-code caches provide a noticable improvement for Drupal over a default PHP installation. The speed gain is about 3X. eAccelerator is marginally better than the XC ache or APC both in terms of speed and memory utilization. Installation of each op-code cache is different: one has a Debian package, the other is installed from source and the third is via PEC L. The configuration for each is also different. Some work well with a default install, others require more tweaking.

Update:
We have noticed that in production, Xcache suffers from the same instability that eAccelerator exhibits: segmentation fault after a day or so. This happened with Xcache 1.2.1-3 which ships with Ubuntu 8.04.1, and PHP 5.2.4. The latest stable release is 1.2.2 from Xcache's web site. So, try compiling that from source, or install the logwatcher script if a minute of downtime is acceptable.

http://2bits.com/articles/benchmarking-drupal-with-php-op-code-caches-apc-eaccelerator-and-xcache-compared.html

4/9

24.2.2014

Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared | 2bits.com, Inc. - Drupal Performance Optimization, De
from source, or install the logwatcher script if a minute of downtime is acceptable.
Benchmarking Drupal from the shell command line Add new comment up Benchmarking PostgreSQL vs. MySQL performance using Drupal 5.x

Subm itte d by Tom e lloso (not ve rifie d) on Mon, 2013/11/04 - 09:28.

Another cache alternatives?

Hello, Thanks for this very informative article. May be a new post about Memcache and Varnish? Regards.
reply

Subm itte d by Hayde n (not ve rifie d) on Fri, 2011/11/25 - 08:04.

you have check time enabled

you have check time enabled on all except eAccelerator. That why eAccelerator did the best. Tune APC and xcache and they are just as fast/faster
reply

Subm itte d by Paul Vince nt (not ve rifie d) on Fri, 2011/11/18 - 05:53.

APC memory limit

Hi, We have a private website set up for our distance learning students and have run into some problems using apc with cachrouter. I've upped the apc.shm memory, but the shared memory always reads: 1 Segment(s) with 30.0 MBytes (mmap memory, pthread mutex locking), and apc seems to be sticking to this limit, even though shm is set much higher. Could anyone suggest where the 30M value might be coming from, as this seems to be overriding the apc value. Many thanks, Paul
reply

of Drupal modules Tips on speeding up your Drupal sites Tools for Performance Tuning and Optimization Tuning the Apache MaxC lients parameter Using ApacheBench for benchmarking logged in users - an automated approach Very long URL aliases not correctly cached in memcache When boost slows down your Drupal site ... XML Sitemap 6.x2.x: How Drupal modules can overload a site during cron, with solutions XML sitemap module performance issues and how to avoid them advcache and memcached benchmarks with Drupal logwatcher: restart Apache after a segmentation fault Links and resources on Drupal performance tuning and optimization

Frequently Asked Questions Services

Search Search
Custom Search

Subm itte d by Visitor (not ve rifie d) on Sat, 2012/07/07 - 15:13.

It is not enough to increase

Tweets
2bits.com, Inc. @2bits Is node creation and editing hanging up in MS Internet Explorer? Simple workaround ... 2bits.com/articles/node#Drupal #webperf #performance Expand 2bits.com, Inc. @2bits Did you know that when a #Rattlesnake strikes, it only takes 174 milliseconds. The #PuffAdder strike is even faster at 70 milliseconds ...

It is not enough to increase the shm setting in the APC config. You need to make sure your server has that amount of shm available. Not knowing what OS you are using I cannot tell you where to change the OS settings, but you can search that info on the web.
reply

Subm itte d by linux aom i (not ve rifie d) on Thu, 2011/11/17 - 10:55.

eAccelerator reaches memory limit without a warning!

eAccelerator support enabled Version 0.9.6.1 Caching Enabled true Optimizer Enabled true Check mtime Enabled true Memory Size 33,554,392 Bytes Memory Available 2,856 Bytes Memory Allocated 33,551,536 Bytes Cached Scripts 400 Removed Scripts 0 What you see is plain phpinfo.php output. The cache of eAccelerator (32MB) fills up and most of your modules won't be treated by eAccelerator. Increase it's cache size and make sure LINUX will also allow to do so: echo 37748736 > /proc/sys/kernel/shmmax ==> used to be 32MB, now 36MB to fit eaccelerator memory size I have a complete realtime monitor with special DRUPAL features available. Cannot attach any graphs here so ask me using my email-id to get more documentation on it.
reply

2bits.com, Inc. @2bits We make #Drupal #WordPress and sites go faster. We diagnose and fix #performance issues. See this example ...

Tweet to @2bits

Subm itte d by Visitor (not ve rifie d) on Thu, 2011/05/19 - 04:16.

Another benchmark of Drupal: PHP vs APC vs HipHop for PHP

It can be found here: http://php.webtutor.pl/en/2011/05/17/drupal-hiphop-for-php-vs-apcbenchmark/


reply

Subm itte d by one quad (not ve rifie d) on W e d, 2011/01/05 - 09:14.

During our tests, we've found

http://2bits.com/articles/benchmarking-drupal-with-php-op-code-caches-apc-eaccelerator-and-xcache-compared.html

5/9

24.2.2014

Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared | 2bits.com, Inc. - Drupal Performance Optimization, De
Subm itte d by one quad (not ve rifie d) on W e d, 2011/01/05 - 09:14.

During our tests, we've found that APC uses about twice as much memory as eAccelerator to cache about the same number of php files. This might not show on this benchmark because only the cached front page is requested.
reply

Subm itte d by Visitor (not ve rifie d) on W e d, 2010/02/24 - 04:51.

Optimizing for Windows

Can any of this be made in a WIMP (windows, IIS, mySQL, php) stack? Yes, I know it is not a common step but the client will never change it... so what can do about it to make drupal run fast? Any advices or similar experiences?
reply

Subm itte d by Visitor (not ve rifie d) on Tue , 2009/08/18 - 07:42.

Great article

Very interesting article. Would love to see similar tests but with Views and CCK in use. Also would love to see a comparison of Drupal vs Joomla and also accelerated PHP vs .NET test ? Also why was the Zend PHP Accelerator not included in this current test ?
reply

Subm itte d by Visitor (not ve rifie d) on Tue , 2009/08/18 - 11:32.

Views, CCK and Zend

Views and CCK are a more complicated mix, because not only do they execute more code, but also do more SQL queries. PHP op-code caches do not help with the database load at all, but may free enough CPU for the database (if the db server is on the same machine as PHP). The Zend Accelerator is proprietary, and our test was for free op-code caches for PHP. Since then, Zend released the Zend Community Server, and we wrote an article at: benchmarking Zend server community edition with Drupal. As for PHP vs. .NET, it is a moot point for most people, since speed is not the only decision point, but rather other things like platform (Windows vs. LAMP), in house knowledge, tool familiarity, integration with existing applications, ...etc. Drupal vs. Joomla is an interesting one, but it would be hard to come with a scenario where the sites have identical feature/functionality so the benchamrk is fair. If you have specific sites that need to be benchmarked, you are always welcome to contact us for consulting via the Contact form on this site.
reply

Subm itte d by Visitor (not ve rifie d) on Thu, 2009/04/30 - 14:29.

Dates

Excellent review, thank you for quality information. However, my pet internet peeve applies: Please provide 'last updated' date at top of page and 'original article' date. Keep up the good work, I rely on good people like you to make my important decisions. Well, except for where to take 'her' for a good date. ;-)
reply

Subm itte d by Visitor (not ve rifie d) on Mon, 2009/05/04 - 17:13.

Re: Dates

Excellent article. Very helpful to get me ramped up on these concepts, try them out on my server, and see what's out there to pick for accelerators.. Regarding dates -- my peeve, too :-P so I agree with Dennis.. These 2 dates would be helpful on each article page. Especially when following the links back to your earlier articles on accelerators: i want to know how dated they are. Thanks again for your work put into this, and your clear presentation. A big time-saver, thanks.
reply

Subm itte d by Visitor (not ve rifie d) on Thu, 2008/10/09 - 08:43.

APC problem: white screen of death

Hello, I would like to use Drupal on apache+mod_php with APC to test with the APC upload progress feature (rfc1867) but every time I submit a form with APC enabled I get a 'white screen of death' (WSOD)... Any ideas why?
reply

http://2bits.com/articles/benchmarking-drupal-with-php-op-code-caches-apc-eaccelerator-and-xcache-compared.html

6/9

24.2.2014

Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared | 2bits.com, Inc. - Drupal Performance Optimization, De
Recent versions?

Subm itte d by Visitor (not ve rifie d) on Thu, 2008/10/09 - 10:08.

Are you trying recent versions of PHP and APC or old ones? -2bits -- Drupal consulting
reply

Subm itte d by Visitor (not ve rifie d) on Fri, 2008/10/10 - 02:27.

up-to-date gentoo

Yes, all my packages are up-to-date (gentoo distribution) I found out that I only get the WSOD when I submit forms with file fields and when apc.rfc1867 is enabled. I'm investigating more.
reply

Subm itte d by Visitor (not ve rifie d) on Tue , 2008/10/07 - 07:12.

Thank you for this report! I

Thank you for this report! I can confirm stability problems with eAccelerator (0.8.5.3). On a Debian Etch system with Apache2 and PHP5 even D5 installations may cause segementation faults. I haven't checked XCache and instead directly went to APC and hope things will work out well.
reply

Subm itte d by Visitor (not ve rifie d) on Sun, 2010/07/18 - 10:56.

Re: Thank your for this report!

Also, thank you for this report! We linked this to our Drupal-Blog.
reply

Subm itte d by Visitor (not ve rifie d) on Tue , 2008/10/07 - 09:58.

Only APC is stable

With several servers running Ubuntu 8.04.01 LTS, Apache 2.2.8 and PHP 5.2.4 I have found that neither eAccelerator nor XCache are stable. In a matter of a day or so, you will get segfaults. On the contrary, APC -- currently using 3.0.19 -- is very stable and never experiences segmentation faults. -2bits -- Drupal consulting
reply

Subm itte d by Visitor (not ve rifie d) on Sat, 2008/09/20 - 11:22.

Good comparisons

Thanks for a more comprehensive and updated comparison (I read your APC vs EA post earlier) and the concurrency usage (although it would be great to show multiple levels).
reply

Subm itte d by Visitor (not ve rifie d) on Mon, 2008/09/15 - 13:12.

Really nice

Thanks for sharing those results.


reply

Subm itte d by Visitor (not ve rifie d) on Mon, 2008/06/09 - 14:19.

Really nice test! Thanks

Really nice test! Thanks


reply

Subm itte d by Visitor (not ve rifie d) on Mon, 2008/04/21 - 09:11.

Tool for statistics ?

This article is very interesting and the tests are well done and presented. What tool did you use for the statistics ? Is it the devel module ? I am talking about the following statistics :

http://2bits.com/articles/benchmarking-drupal-with-php-op-code-caches-apc-eaccelerator-and-xcache-compared.html

7/9

24.2.2014

Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared | 2bits.com, Inc. - Drupal Performance Optimization, De
Document Path: / Document Length: 21757 bytes Concurrency Level: 5 Time taken for tests: 98.530068 seconds Complete requests: 3000 [...]
reply

Subm itte d by Visitor (not ve rifie d) on Mon, 2008/04/21 - 09:41.

Apache Benchmark

I mentioned that in the article, but perhaps it is not prominent enough. It is called Apache Benchmark (ab). -2bits -- Drupal consulting
reply

Subm itte d by Visitor (not ve rifie d) on Thu, 2008/04/24 - 15:25.

Thanks !

Thank you very much for your answer. In fact I thought that Apache Benchmark was used to generate the traffic only, not to get the stats.
reply

Subm itte d by Visitor (not ve rifie d) on Sun, 2008/04/20 - 20:41.

xcache

Why did you disable the xcache variable cache? "xcache.var_size = 0M" Also, xcache.var_count should be the same as xcache.count.
reply

Subm itte d by Visitor (not ve rifie d) on Sun, 2008/04/20 - 20:57.

Code caching, not object caching

All three op-caches were used in this benchmark solely as op-code caches, that is as accelerators for PHP code itself. There was no content caching of any kind in this benchmark, whether on the Drupal level (database tables) or via object caches (memcached, xcache, apc, ...etc.) So, this is why the above was done. -2bits -- Drupal consulting
reply

Subm itte d by Visitor (not ve rifie d) on Thu, 2010/09/16 - 05:16.

Concurrent usage of APC & memcached possible?

Hello, can you recommend a concurrent usage of APC for opcode caching and memcached for content and PHP session caching? I'm asking because I noticed that using APC for content caching will heavily fragment the APC cache due to the short expire time of the content objects and the regular garbage collection in APC. I'm hoping separating the opcode cache from the content cache will improve performance and solve the problem with APC fragmentation. BTW, APC fragmentation is very low and available memory is high if I do not use it for content caching. Thank you for all the great and helpful articles on your site.
reply

Subm itte d by Visitor (not ve rifie d) on Thu, 2010/09/16 - 10:07.

Definitely

Most definitely: yes. I do recommend using APC for code cache, and memcache for content cache (and session cache, if needed). This is how I configure all client sites. No worries about fragmentation, and you have the ability to move memcache to a separate server, and not be limited by one machine for everything. I never use APC for content caching, only code caching. This also allows me to use FastCGI

http://2bits.com/articles/benchmarking-drupal-with-php-op-code-caches-apc-eaccelerator-and-xcache-compared.html

8/9

24.2.2014

Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared | 2bits.com, Inc. - Drupal Performance Optimization, De
I never use APC for content caching, only code caching. This also allows me to use FastCGI for PHP, where each process has its own copy of the APC code cache. If I were to use APC for content caching in that mode, then the content cache would be inconsistent.
reply

Subm itte d by Visitor (not ve rifie d) on Thu, 2010/09/16 - 10:36.

Great. Thank you. Especially

Great. Thank you. Especially for pointing out that using APC for content caching in FastCGI mode will lead to inconsistent caches. I use Apache and mod_fcgid for running php. I'm happy the fragmentation forced me to turn off user/content caching in APC.
reply

Subm itte d by Visitor (not ve rifie d) on Sun, 2008/04/20 - 21:13.

Seems it wouldn't help anyway.

Nevermind, I did some research, and it looks like the xcache variable cache wouldn't work with Drupal anyway.
reply

Subm itte d by De nis (not ve rifie d) on Thu, 2011/01/06 - 21:10.

I am using eaccelerate for a

I am using eaccelerate for a while but didn't know that it's best choice. Thanks for test. Now i'm feel with confidence.
reply

Is your Drupal or WordPress site slow? Is it suffering from server resources shortages? Is it experiencing outages? Contact us for Drupal and WordPress Performance Optimization and Tuning Consulting

HOME

SERVICES

ARTICLES

NEWS

FAQ

TESTIMONIALS

PAYMENTS

SOFTWARE

SITEMAP

CONTACT

C opyright 1999-2014 2bits.com, Inc. All rights re se rve d.

http://2bits.com/articles/benchmarking-drupal-with-php-op-code-caches-apc-eaccelerator-and-xcache-compared.html

9/9

You might also like