Other alternatives

There are other ways of helping the web server deliver its content faster and faster. It is common to use PHP accelerators for this task. We have some other accelerators that can be evaluated and tested in our environment:

  • Alternative PHP cache (APC): This is totally free and open source. It will be included in the core of PHP6. It has a rich statistics page that allows evaluation of its behavior. You can learn more about it at http://pecl.php.net/package/APC.
  • XCache: This was developed by one of the creators of lighttpd. It has a very simple statistics page. A detailed information about this can be found at http://xcache.lighttpd.net/.
  • eAccelerator: This was created in 2004 as a fork of Turck MMCache. It is supported by the most recent versions of PHP. To learn more about it go to http://eaccelerator.net/.

In practice, a PHP accelerator's main function is to improve performance of PHP scripts by caching these compiled scripts so that almost all the overhead of compiling is eliminated. PHP accelerators decrease server load and increase the speed of PHP.

The main advantage of a PHP accelerator is that scripts are compiled and loaded in the memory and then delivered to the user. With this, the amount of I/O performed on the disk is reduced. Since the memory latency is smaller than the drive's latency, we have a significant gain in user perception.

The following table shows the results of a simple test (with Apache) performed on a virtual machine by accessing the triggers screen (tr_status.php) with about 700 active triggers:

Test

XCache without mod_deflate

APC without mod_deflate

PHP without mod_deflate

XCache with mod_deflate

APC with mod_deflate

PHP with mod_deflate

Concurrency level

50

50

50

50

50

50

Complete requests

500

500

500

500

500

500

Document length (bytes)

24,317

24,317

24,317

24,317

24,317

24,317

Total bytes transferred

12,593,511

12,274,254

12,274,377

12,285,937

12,285,862

12,285,850

Requests per second

33.39

31.28

13.50

44.05

32.01

14.72

Transfer rate (kilobytes per second)

805.12

749.86

332.66

1,058.83

774.82

353.13

Time taken

~15 sec

~16sec

~36sec

~11sec

~15sec

~34sec

As we can see, we have a considerable gain when using PHP accelerators compared to pure PHP (no use of accelerators). On the other hand, mod_deflate did not represent a very large difference in the tests.

It is also clear that XCache has performed better in the test than APC.

The suggestion is that you run the same tests in your environment so that you can find the best solution and configuration for your scenario.

For reference, tests were performed with the Apache Bench (AB) tool, with the following parameters:

[root]# ab -c 50 -n 500 -k -H "Accept-Encoding: gzip, deflate" "http://<zabbix_gui_IP>/zabbix/tr_status.php?groupid=0&hostid=0"

Another alternative is the Google Pagespeed module (https://developers.google.com/speed/pagespeed/module). This module's main function is to optimize the content delivered by the web server (including CSS, JavaScript, images, and so on).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset