Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How APC opcode cache works

Tags:

php

apc

Can I use apc opcode cache if I can (not must) have unique content for each visitor on same page? I'm not sure I understand how opcode working. If only save php result to cache and serving it like "html", then it's useless for me. I definitely need to run sql queries on each pageview. Or it's any better way how to optimize php? App have very high-load - about 1000 pageviews per second. It run on nginx + php-fpm.

like image 865
stix Avatar asked Sep 15 '13 18:09

stix


People also ask

How does opcode cache work?

OPcache is a caching engine built into PHP. When enabled, it dramatically increases the performance of websites that utilize PHP. From php.net: OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.

What is PHP opcode?

An OPCode is the numeric identifier of a single operation that can be performed by the Zend Virtual Machine (Zend VM). After PHP has scanned the human-readable source code and chunked it into tokens, these tokens are grouped together in the parsing phase.

What is purge Opcache content?

Purge OpCache will allow you to clear OpCache on post/page updates. If you need this integration, you can enable it, but it does not affect performance.


2 Answers

Yes, you can. APC caches the program, not its' result. So, the code will be executed each time, just in "optimised" way.

like image 110
Alex Avatar answered Oct 31 '22 05:10

Alex


How to determine which resource object loaded from, cached opcodes or compiled newly?

like image 45
Barif Avatar answered Oct 31 '22 05:10

Barif