APC is supposed to make PHP faster

Hi

I have installed APC and PHP with:

apt-get install php-pear php5-cli php5-cgi php5-dev php-apc

The matter is I do not see any performance boost with APC enabled. APC is installed with default settings and I have tried to change some of these also according to advices given by Linode but nothing happens - sometimes it evens makes performance worse.

Basically I have used ab to do some stresstest. My testpage is some regular HTML with a single phpinfo() in it giving the page a total size of around 50K.

Anyone got a clue as to why?

3 Replies

PHP apc caches the php byte code, phpinfo() doesn't require much in the way of resources so you won't see an improvement, run something complex like wordpress or drupal etc

Thanks for answering

I see, this link also suggests what you say.

http://bitflop.com/document/120

Whenever you run a PHP script, the PHP interpreter compiles the source code of the script to byte code for execution. This takes time, and on more complex web apps, it can be a significant amount of the execution time.

APC caches the result of this compilation, so that when a script is executed, it can skip the compilation and just interpret the pre-compiled bytecode.

On a simple script, the compilation time is an inconsequential part of the execution time. But on a more complex web app, with hundreds or thousands (or more) lines of code, skipping that step can save a large amount of time (and CPU power). Hence why those benchmarks you linked to show no savings for small stuff, but show huge savings for WordPress, Drupal, and Phorum.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct