How to Install Memcached

Software needs to use a Memcached client API to take advantage of it.

Applications which have heavy database needs will benefit the most. Applications which do their own data caching won’t always get much of a boost from Memcached, but the potentially larger store may help them.

Most CMS programs don’t provide Memcached support by default. On WordPress for example, you’ll have to install a third-party plugin and then enable Memcached from the cPanel.

If the Memcached service is activated correctly by the hosting provider, the plugin will be able to use it to store frequently executed queries inside.

Summary of Memcached

Memcached will serve most data requests generated by your site. To achieve that, the collective size of the key/store must suffice to cache the majority of the requested data objects from the site to achieve an acceptable performance rate.

Check the capacity of Memcached with your hosting provider.

Main Memcached Features

Server-based system

Distributed cache

Free and open source

Can store any type of data

Minimal security; deploy only on protected local networks

The Top Three Memcached Hosts

Here are three providers that you should seriously consider when developing a Memcached-based site.

LiquidWeb managed hosting includes 24/7 support with guaranteed initial response times, and it guarantees 100% uptime. It’s not the least expensive option, but it gives good value.

WebFaction: Memcached Hosting for Developers

WebFaction boasts “hosting for developers,” and it provides detailed technical information on using Memcached. It provides SSH access, and you can run any tools of frameworks of your choice, in many programming languages.

Other features in Technologies

memcached Frequently Asked Questions

What is Memcached?

Memcached is a caching program designed to minimize database load.

Who developed Memcached?

Brad Fitzpatrick developed Memcached for LiveJournal in 2003. Anatoly Vorobey later rewrote the program from the original Perl into C. As open-source software, it continues to be developed by a team of contributors.

Do I have to use my server space for caching?

No. It is possible to set up a separate machine to be used as your Memcached server. Before doing this, you should check with your host to see if they are configured for this and to ensure proper security measures are in place.

What are the minimum system requirements for running Memcached?

Memcached can run on nearly any hardware, because it is designed to use very few resources. Of course, the higher processor speed and more RAM available, the faster it will perform.

Performance will vary depending on the number of active clients, available servers, and so on. You should consult the Memcached Wiki for specific strategies for optimizing performance.

Can I use Memcached for my database?

Memcached does not recommend using it on a database host. Instead, they advise giving your database as much RAM as possible. This way if cache misses happen, your indexes and data are already in memory.

Can I use memory swapping with Memcached?

It is not recommended, as swapping will result in poor performance.

Instead, you should assign a certain percentage of physical memory (usually a few percent more than you anticipate needing), to a Memcached server. For best performance you should monitor your server if it is using swap, and make adjustments to your allocations as necessary.

How do I configure Memcached?

Memcached is a command line application, so you will need to review the documentation available with the installation and on their website for an up-to-date list of Memcached arguments.

You will also need SSH access to your server.

How do I install Memcached onto my own server?

You can install Memcached using one of many pre-compiled packages available on their website, or you can download the source code and compile it yourself.

They recommend using a package whenever available, as these have been tested. See the Memcached website for specific information pertaining to your operating system.

Once Memcached is installed, how can I monitor it?

Memcached contains a number of statistical counters to monitor system performance and health.

There are also third-party monitoring tools available on the Memcached Wiki site. Some of them feature a command line interface, like Memcached, while others provide a graphical user interface to simplify the user experience.

How can I contribute to Memcached?

Memcached is an actively developed application, so there are several ways you can contribute to it.

You can join discussions with other community members and developers via their mailing list or IRC channel.

There are a number of technical conferences available for developers and users.

You can also contribute to the Memcached Wiki site by emailing your suggestions or asking for editing access through the mailing list.

What should I consider before upgrading to a new version of Memcached?

While each release of Memcached is thoroughly tested, it is important to run a new release in a QA or dev environment first, then test it on a single server in production. If everything works fine, roll out to the rest of your servers one at a time.

What sort of load can Memcached handle?

That will depend on the system it’s running on.

For a fast machine with a high speed network, it should easily handle over 200,000 requests per second. With some adjustments or faster hardware, it can handle much more than that.

Even on slower machines, it should easily be able to accomplish a few hundred requests per second.

How many clients can a Memcached site support?

Memcached uses an event-based architecture, so high numbers of clients should not slow it down. It is successfully working for companies with hundreds of thousands of connected clients.

Of course, Memcached can only work as hard as your hardware will allow. You need enough spare RAM for each connected client, so even though an individual client only requires a very small amount of RAM, hundreds of thousands of clients will require a lot of RAM.

Other factors, such as thread limitations and local ports, may affect your ability to handle a large number of clients. System tuning and additional adjustments can help.

How do release cycles work?

Three weeks after each stable release, Memcached releases a –rc1 for the next release. Additional –rc’s typically follow once or twice a day, depending on the number of fixes.

After three days, unless additional bugs are still being reported, a new stable version is released. This usually results in a new stable version approximately every month.

While any of the core developers may contribute changes, the contributor is not allowed to be a part of the review process for their own changes.

About Gary McGath

Gary McGath spent years as a software developer before turning to writing. In addition to writing many articles on technology, he's the author of two crowdfunded e-books. His tech passions include data security and digital preservation.

We've helped millions of webmasters around the world find their perfect web hosting provider.

About WhoIsHostingThis.com

In 2007, WhoIsHostingThis.com launched the world's first tool to discover which web host a website uses. Since then, we have published 1+ million words of real-user reviews, 2+ million words of content from our experts and helped millions of webmasters around the world find their perfect web hosting provider, whether it is for a personal website, blog or small business. Read more...