?

Log in

No account? Create an account

Memcache Engine for MySQL version 0.5

« previous entry | next entry »
Feb. 26th, 2007 | 08:14 pm

The two big changes in 0.5 are that I fixed a memory leak and it now has its own information schema table on statistics.

For example:
mysql> select * from information_schema.memcache_servers;
+----------------+-------+---------------+-------------+-------+---------------------+-------------------+-----------------------+------+------+------+--------+------------+---------------+----------------+
| NAME | COUNT | CURRENT_ITEMS | TOTAL_ITEMS | BYTES | CURRENT_CONNECTIONS | TOTAL_CONNECTIONS | CONNECTION_STRUCTURES | GETS | SETS | HITS | MISSES | BYTES_READ | BYTES_WRITTEN | LIMIT_MAXBYTES |
+----------------+-------+---------------+-------------+-------+---------------------+-------------------+-----------------------+------+------+------+--------+------------+---------------+----------------+
| localhost:6688 | 2 | 5 | 39 | 399 | 2 | 65 | 3 | 236 | 39 | 197 | 39 | 4669 | 9546 | 67108864 |
| localhost:6666 | 2 | 4 | 12 | 311 | 1 | 62 | 3 | 143 | 12 | 114 | 29 | 2215 | 5977 | 67108864 |
+----------------+-------+---------------+-------------+-------+---------------------+-------------------+-----------------------+------+------+------+--------+------------+---------------+----------------+
2 rows in set (0.01 sec)

The tables shows the current status of any memcached server that is attached to MySQL. There are a few more statistics that I can grab but the assortment I picked for the first version should be very useful. The schema is such:

mysql> desc information_schema.memcache_servers;
+-----------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+--------------+------+-----+---------+-------+
| NAME | varchar(120) | NO | | | |
| COUNT | bigint(4) | NO | | 0 | |
| CURRENT_ITEMS | bigint(4) | NO | | 0 | |
| TOTAL_ITEMS | bigint(4) | NO | | 0 | |
| BYTES | bigint(4) | NO | | 0 | |
| CURRENT_CONNECTIONS | bigint(4) | NO | | 0 | |
| TOTAL_CONNECTIONS | bigint(4) | NO | | 0 | |
| CONNECTION_STRUCTURES | bigint(4) | NO | | 0 | |
| GETS | bigint(4) | NO | | 0 | |
| SETS | bigint(4) | NO | | 0 | |
| HITS | bigint(4) | NO | | 0 | |
| MISSES | bigint(4) | NO | | 0 | |
| BYTES_READ | bigint(4) | NO | | 0 | |
| BYTES_WRITTEN | bigint(4) | NO | | 0 | |
| LIMIT_MAXBYTES | bigint(4) | NO | | 0 | |
+-----------------------+--------------+------+-----+---------+-------+
15 rows in set (0.00 sec)

There is still quite a bit of work to be done but it seems to be working without issue. Next on the list is to support multiple indexes per tables.

For other engine writers you can check out how to add information schema via this patch:
http://hg.tangent.org/memcache_engine?fd=9bc58f383d06;file=src/ha_memcache.cc

You can download 0.5 from here:
http://download.tangent.org/memcache_engine-0.5.tar.gz

When you upgrade you will have to run this command to get the information schema:
mysql> INSTALL PLUGIN memcache_servers SONAME 'libmemcache_engine.so';

Link | Leave a comment | Share

Comments {7}

Build error

from: tobatus
date: Feb. 27th, 2007 12:59 pm (UTC)
Link

I tried this today at the first time but I couldn't get it builded. I got "ha_memcache.cc:1103: error: variable `st_mysql_information_schema memcache_server_is' has initializer but incomplete type" and so on. I tried the version 0.4 and it builded fine to me.

Reply | Thread

Brian "Krow" Aker

Re: Build error

from: krow
date: Feb. 27th, 2007 03:44 pm (UTC)
Link

What version of 5.1 are you using? It will probably only build with the latest (well, a version that supports loadable I_S).

Reply | Parent | Thread

Re: Build error

from: tobatus
date: Feb. 28th, 2007 08:08 am (UTC)
Link

It was on 5.1.15, but now I tried with the bitkeeper version and it builded fine.

Reply | Parent | Thread

Brian "Krow" Aker

Re: Build error

from: krow
date: Mar. 1st, 2007 05:51 am (UTC)
Link

That is good to hear.

Reply | Parent | Thread

(no subject)

from: jamesd
date: Feb. 27th, 2007 01:01 pm (UTC)
Link

If it's reasonably cheap to track, knowing the response time would be helpful when trying to track down performance pain.

Reply | Thread

Brian "Krow" Aker

(no subject)

from: krow
date: Feb. 28th, 2007 05:02 am (UTC)
Link

I will need to look. I exposed pretty much everything... but there are two time fields that are defined that I didn't expose. If the data is there, it would be easy to add it.

Reply | Parent | Thread

idea for useful storage engine

from: bbaker
date: Mar. 8th, 2007 02:03 am (UTC)
Link

I would like a storage engine that layers on top of other storage engines and saves change tracking information (to a tracking table) for preconfigured tables and fields. Of course this can be done with triggers on each table of interest, but it is tedious, ugly, and error prone.

For many business users, this is a killer feature.

bbaker

Reply | Thread