Lampwrights Forum

Lampwrights Forum (http://www.lampwrights.com/index.php)
-   PHP (http://www.lampwrights.com/forumdisplay.php?f=4)
-   -   What is opcode caching? (http://www.lampwrights.com/showthread.php?t=6)

Jeff 07-18-2010 08:48 PM

What is opcode caching?
 
When a PHP script is called by a users browser the process is as folllows:
  1. User requests page
  2. Web server compiles the PHP script (interprets)
  3. Executes the compiled version of the page
  4. Outputs the data
When we think of normal applications such as programs on your desktop, the compiling step is not one we normally consider. Usually the applications we use are already compiled. However, scripting languages such as PHP, Perl, Ruby, etc., are compiled on demand or interpreted. There are subtle differences between compiling and interpreting but that is for another day.

As you can imagine, converting source code to machine code (opcode) can be resource intensive. Opcode caches will store the opcode in a cache and execute it instead of constantly recompiling the source code. This basically eliminates step 2 in the above list and seriously speeds up your site.

There are many opcode caches out there such as Xcache, APC, etc.. No large site should be without one!


All times are GMT -4. The time now is 09:51 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2024, vBulletin Solutions, Inc.