Is memcached really faster than MySQL on very simple query?

Christopher Schmidt crschmidt at crschmidt.net
Thu Jul 13 11:17:11 UTC 2006


On Thu, Jul 13, 2006 at 07:12:35PM +0800, howard chen wrote:
> On 7/13/06, Christopher Schmidt <crschmidt at crschmidt.net> wrote:
> >
> >On Thu, Jul 13, 2006 at 06:48:19PM +0800, howard chen wrote:
> >> seems MySQL is quite efficient in handling simple query?
> >
> >Memcached is designed to run as a distributed query cache. The
> >expectation is that you're running against several memcached servers,
> >which allows you to distribute your memory caching against multiple
> >machines.
> >
> >MySQL has a built in query cache that would store the results of any
> >simple test for a short period of time.
> >
> >Your test in this case is not a use case that memcached is designed to
> >exceed performance of the MySQL query cache in. Unless you have multiple
> >machines in which you are distributing your cache, setting the MySQL
> >query cache to use just as much memory as Memcached will usually work
> >just as well.
> >
> >(There may be exceptions to this rule, but your test isn't one of them.)
> >
> >To respond to your queston: No. Memached is not designed to outperform
> >MySQL on a loop over the exact same query over and over again, so it's
> >not faster.
> 
> mysql> show status like '%qcache%';
> +-------------------------+-------+
> | Variable_name           | Value |
> +-------------------------+-------+
> | Qcache_free_blocks      | 0     |
> | Qcache_free_memory      | 0     |
> | Qcache_hits             | 0     |
> | Qcache_inserts          | 0     |
> | Qcache_lowmem_prunes    | 0     |
> | Qcache_not_cached       | 0     |
> | Qcache_queries_in_cache | 0     |
> | Qcache_total_blocks     | 0     |
> +-------------------------+-------+

Which doesn't really change the fact that the response to the above
statement:

seems MySQL is quite efficient in handling simple query?

Is "Yes, it is. There is no need to replace MySQL if you're only
handling simple queries on a single machine."

-- 
Christopher Schmidt
Web Developer


More information about the memcached mailing list