PHP ,MySQL memory DB and memcached

memcached, mysql, php

Solution

I would say that if you operate a website that would need memcached, you shouldn't be running it on a shared host.

That's my flippant answer. Here's a real answer:

Memcached has some good advantages over the MEMORY storage engine.

- Storage is distributed over multiple servers. MEMORY storage engine is limited to a single host, and constrained by the CPU and memory of that host.

- Quick access of individual entries. MEMORY storage engine has table-level locking only, so concurrency suffers.

- Non-relational key/value storage. MEMORY storage engine is more structured, which isn't as useful for cache-type usage. Also MEMORY expands varchar to full length, so is less efficient storage.

As a caching solution, I wouldn't choose the MySQL MEMORY storage engine. Since you're using PHP, you should be using APC or Xcache or something. These have data cache features that are better for typical usage in PHP.

If you're not using one of these PHP caching technologies, that's a more important area to improve than worrying about memcached versus MEMORY storage engine.

Problem

I've a site which is running in a shared host without memcached. So, how about make a MySQL memory DB as object cache just like memcached?

Original source