PHP Accelerator: Difference between revisions

No edit summary
adds imagery
Line 1: Line 1:
[[Image:Preferences-system-performance.svg|200px|frameless|right]]
A [[wp:PHP_accelerator|PHP Acelerator]] is a tool that will enhance the [[Performance_tuning|performance]] of web applications written for the PHP scripting language.  The free [http://php.net/apc Alternative PHP Cache] (APC) is distributed as a PEAR package.
A [[wp:PHP_accelerator|PHP Acelerator]] is a tool that will enhance the [[Performance_tuning|performance]] of web applications written for the PHP scripting language.  The free [http://php.net/apc Alternative PHP Cache] (APC) is distributed as a PEAR package.


Line 27: Line 28:
== MediaWiki ==
== MediaWiki ==
MediaWiki can take advantage of the APC cache if you tell it to.
MediaWiki can take advantage of the APC cache if you tell it to.
see [[mw:Manual:Configuration_settings#Cache|The Manual for cache settings]], and set [[mw:Manual:$wgMainCacheType]] in LocalSettings.php:  
see [[mw:Manual:Configuration_settings#Cache|The Manual for cache settings]], and set [[mw:Manual:$wgMainCacheType]] in LocalSettings.php:
<source lang="php">
<source lang="php">
$wgMainCacheType = CACHE_ACCEL;
$wgMainCacheType = CACHE_ACCEL;
Line 33: Line 34:


== Troubleshooting ==
== Troubleshooting ==
If you notice sluggishness in your site after installing APC, then check out the front-end (apc.php).  The sure sign that you need to increase your cache size is that the "cache full" count is greater than one.  
If you notice sluggishness in your site after installing APC, then check out the front-end (apc.php).  The sure sign that you need to increase your cache size is that the "cache full" count is greater than one.
[[Image:Apc-problems.png|200px|thumb|right|Cache is too small]]
[[Image:Apc-problems.png|200px|thumb|right|Cache is too small]]


# [[Performance_tuning|Check your memory]]  
# [[Performance_tuning|Check your memory]]
# Increase the Shared Memory Size for APC in your php.ini file e.g. <code>apc.shm_size = 128</code>
# Increase the Shared Memory Size for APC in your php.ini file e.g. <code>apc.shm_size = 128</code>
# Restart Apache
# Restart Apache
# Use the Apache Bench tool to test performance with and without APC enabled.
# Use the Apache Bench tool to test performance with and without APC enabled.
Line 82: Line 83:


Connection Times (ms)
Connection Times (ms)
              min  mean[+/-sd] median  max
min  mean[+/-sd] median  max
Connect:        1    1  0.1      1      2
Connect:        1    1  0.1      1      2
Processing:  515  604 113.4    567    1030
Processing:  515  604 113.4    567    1030
Line 89: Line 90:


Percentage of the requests served within a certain time (ms)
Percentage of the requests served within a certain time (ms)
  50%    568
50%    568
  66%    600
66%    600
  75%    608
75%    608
  80%    644
80%    644
  90%    734
90%    734
  95%    925
95%    925
  98%  1031
98%  1031
  99%  1031
99%  1031
100%  1031 (longest request)
100%  1031 (longest request)
</pre>
</pre>