InfoHeap
Tech tutorials, tips, tools and more
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. How to install and monitor memcache for php on Ubuntu Linux
  2. PHP apc – setup and performance benchmarks on Ubuntu Linux
  3. How to use w3 total cache for wordpress
  4. Memcache – how to dump all keys and values on command line
  5. How to Preload cache in wordpress on Linux
  6. Tips on improving the performance of your WordPress blog or site
  7. ApacheBench (ab) – how to load test a web site
  8. How to set different HTTP Expire Header for multiple images of same type
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Memcache, PHP, Site Performance, Tutorials, Webmaster

Follow InfoHeap

facebook
twitter
googleplus
  • Browse site
  • Article Topics
  • Article archives
  • Recent Articles
  • Contact Us
  • Omoney
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | 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

Copyright © 2023 InfoHeap.

Powered by WordPress