InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Site Performance tutorials

  • Chrome PageSpeed insights
  • Google custom search with lazy loading
  • Install and monitor memcache for php on Ubuntu
  • Internal vs external css
  • Javascript in header vs footer
  • PHP apc - setup and performance benchmarks
  • Php apc vs memcache
  • Using inline image for site performance
 
  • Home
  • > Tutorials
  • > Web Development
  • > Site Performance

Php apc vs memcache

By admin | Last updated on Jan 16, 2016

When you are running a site in php (wordpress or non-wordpress), there are two popular options for in-memory cache.

  1. APC (Alternative PHP cache): Opcode and object cache for php.
  2. Memcache: Free & open source, high-performance, distributed memory object caching system.

Note that memcache is not specific to php, but I’m using php as context for this article as php is one of the most popular programming languages and wordpress, php and memcache is a very popular combination.

High level comparions notes between apc and memcache

  1. Opcode cache: apc is opcode cache and caches php bytecodes. So it can lead to faster php execution. Opcode cache is not applicable for memcache as it is out of process in-memory object cache.
  2. Object cache: Both apc and memcache can be used for object cache. Apc being in process cache can be little faster. But Memcache is better if data is large as it be distributed to multiple servers.
  3. Apache restart: Apache restart resets apc cache but it does not reset memcache. This is a good thing as cache warming won’t be needed again. So memcache is better option from this perspective.
  4. Administration: Since memcache is managed by external process, it can be accessed by non php processes also (e.g. python or shell utils like memdump, memccat).

Final comments

Optimum configuration may depend on various factors like traffic, data size etc. But I think in most cases using apc for php opcode cache (not for data) and memcache for data will give a good performance outcome. And moreover with this configuration data cache won’t have to be reloaded with apache restart which may happen whenever you change apache config.

Suggested posts:

  1. PHP apc – setup and performance benchmarks on Ubuntu Linux
  2. How to bypass cross site scripting (XSS) protection by browsers
  3. How to and why disable wordpress cron
  4. How to upgrade EC2 Ubuntu Linux micro instance to small
  5. How to use pm2 to manage node.js application in production
  6. How to install wordpress on Amazon AWS-EC2 Classic Ubuntu Linux micro instance
  7. How to create and use color palettes in Inkscape
  8. How to install ViewVC for svn repository on Ubuntu Linux
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Memcache, PHP, Site Performance, Tutorials, Webmaster
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress