MySQL recently released GA version 5.6, which has many good features worth noting and trying. NoSQLAPI support is a good highlight. Let's try it. Detailed feature introduction accessible: dev.mysql.comtech-resourcesarticlesmysql-5.6.html. I learned from the MySQL official website that M
MySQL recently released GA version 5.6, which has many good features worth noting and trying. NoSQL API support is one of the highlights. Let's try it. Detailed feature introduction accessible: http://dev.mysql.com/tech-resources/articles/mysql-5.6.html. I learned from the MySQL official website that M
MySQL recently released GA version 5.6, which has many good features worth noting and trying. NoSQL API support is one of the highlights. Let's try it. Detailed feature introduction accessible: http://dev.mysql.com/tech-resources/articles/mysql-5.6.html.
I learned from the MySQL official website that using Memcache APIs can access MySQL's NoSQL APIs.
Generation of the latest generation of web, cloud, social and mobile applications require fast operations against simple Key/Value pairs. at the same time, they must retain the ability to run complex queries against the same data, as well as ensure the data is protected with ACID guarantees. with the new NoSQL API for InnoDB, developers have all the benefits of a transactional RDBMS, coupled with the performance capabilities of Key/Value store.
MySQL 5.6 provides simple, key-value interaction with InnoDB data via the familiar Memcached API. implemented via a new Memcached daemon plug-in to mysqld, the new Memcached protocol is mapped directly to the native InnoDB API and enables developers to use existing Memcached clients to bypass the expense of query parsing and go directly to InnoDB data for lookups and transactional compliant updates. the API makes it possible to re-use standard Memcached libraries and clients, while extending Memcached functionality by integrating a persistent, crash-safe, transactional database back-end. the implementation is shown here:
So does this option provide a performance benefit over SQL? Internal performance benchmarks using a customized Java application and test harness show some very promising results with a 9X improvement in overall throughput for SET/INSERT operations:
First, deploy the Memcache plugin integration environment on the Server. Currently, the supported systems are Linux, Solaris, and OS X, but windows is not supported. Document address: http://dev.mysql.com/doc/refman/5.6/en/innodb-memcached-setup.html
Because MySQL is installed using the tar package, you need to install the libevent package before installing memcache plugin.
yum install libevent
You can.
Then, install the table required by libmemcached.
Set the plug-in as a daemon started with the service
Restart the MySQL service. The installation is complete. The default access port is 11211.
Next, let's verify the installation. You can simply use telnet to send the memcached command.
Then, use SQL to query data in the demo_test table:
We can use xmemcached as the client api through Java code. Official Address: https://code.google.com/p/xmemcached. Maven dependency:
com.googlecode.xmemcached
xmemcached
1.4.1
The Code is as follows:
/*** @ Param args * @ author lihzh (OneCoder) * @ blog http://www.coderli.com * @ throws MemcachedException * @ throws InterruptedException * @ throws TimeoutException * @ throws IOException * @ date 2013-3-12 12:07:41 */public static void main (String [] args) throws TimeoutException, InterruptedException, MemcachedException, IOException {MemcachedClient client = new XMemcachedClient ("10.4.44.208", 11211); // store a value for one hour (synchronously ). client. set ("key", 3600, "onecoder"); // Retrieve a value. (synchronously ). object someObject = client. get ("key"); // Retrieve a value. (synchronously), operation timeout two seconds. someObject = client. get ("key", 2000); System. out. println (someObject );}
Query records on the mysql client and store them successfully:
Only the most basic functions are tested here. If you want to use this function, you also need to do a good job of ing between traditional data tables and memcache tables. For details, see http://dev.mysql.com/doc/refman/5.6/en/innodb-memcached-developing.html.
Original article address: MySQL5.6.10 NoSQL API access experience, thanks to the original author for sharing.