The document discusses integrating Memcache with InnoDB. It provides an overview of Memcache and InnoDB, why to use the Memcache plugin for InnoDB, how to install and configure the plugin, how it works, limitations, and includes a demo. The presenter is Runish Kumar from Mindfire Solutions and the presentation covers the basics of using Memcache as a caching layer for InnoDB tables in MySQL.
3. Agenda
• Introduction to Innodb integration with memcache
• Why to use memcached plugin
• Installation and setup
Presenter: Runish Kumar, Mindfire Solutions
• How it works
• Demo
• Limitations
• Q&A
4. • InnoDB is a general-purpose storage engine that balances high
reliability and high performance.
• Memcached is a general-purpose distributed memory caching system.
• InnoDB Memcached daemon provides a way to interact with Innodb
tables using memcached protocol.
• Introduced in MySQL5.6
• No-SQL in MySQL?
Presenter: Runish Kumar, Mindfire Solutions
5. • Provides direct access to InnoDB table eliminating SQL processing.
• Can be used for caching data. Communication with InnoDB is handled
out of the box by the plugin.
• Provides combination of performace (by caching data in to memory)
and persistance (by writing all data to InnoDB).
• Data can still be accessed through conventional SQL query.
• Gives us the ability to fetch any record fast using primary key from
memcache. At the same time we can do aggregation operation on
same data using SQL query if needed.
Presenter: Runish Kumar, Mindfire Solutions
6. Installation and Setup
Prerequisite:
• Must have libevent installed
• Can be installed with sudo apt-get install libevent-dev
• plugin/libmemcached.so and
plugin/innodb_engine.so must be present under mysql
plugin folder
Presenter: Runish Kumar, Mindfire Solutions
7. Two ways to get plugin files:
• Install MySQL from package manager
http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/
• Compile MySQL from source
http://dev.mysql.com/doc/refman/5.6/en/source-installation.html
Build with -DWITH_INNODB_MEMCACHED=ON option.
Optionally you can also add option -DWITH_LIBEVENT if libevent is
not installed in your machine.
Presenter: Runish Kumar, Mindfire Solutions
9. Setup/Configuration options:
• Run memcahe daemon on port of your choice
--daemon_memcached_option="-p11222"
• daemon_memcached_r_batch_size, batch commit size for
read operations (get)
• daemon_memcached_w_batch_size, batch commit for any
write operations (set, replace, append, prepend,incr, decr,
and so on)
Presenter: Runish Kumar, Mindfire Solutions
10. How It Works?
Presenter: Runish Kumar, Mindfire Solutions
11. Try a demo :)
• Memcache key can not contain spaces or new line character.
• Numeric values gets converted to string when it passes
through memcache plugin. Cast it to back to numeric value
before using it in arithmatic operation. e.g, SUM(), AVG() etc.
• If the InnoDB column you use as a key can be longer than
250 bytes, hash it to a value that is less than 250 bytes.
• If primary key of table is short, we can use it as lookup key for
memcache.
Presenter: Runish Kumar, Mindfire Solutions
12. Limitations
• You cannot use a partitioned table for data queried or stored
through the memcached interface.
• All fileds mapped with memcache has to be varchar.
• Complex queries can not be performed using memcache plugin.
• Aggregation operation can not be performed through memcache
plugin.
• Security Concerns.
Presenter: Runish Kumar, Mindfire Solutions