Brian "Krow" Aker (krow) wrote,
Brian "Krow" Aker
krow

Memcache Engine for MySQL version 0.5

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';
Subscribe
  • Post a new comment

    Error

    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 7 comments