Nosql to MySQL with memcached [reprint]

Source: Internet
Author: User

This article is from the MySQL Community's joint use of MySQL and memcached, revealing the development direction of the next version of MySQL and sharing it with you.

The ever increasing performance demands of Web-based services has
Generated significant interest in providing nosql access methods
Mysql-enabling users to maintain all of the advantages of their
Existing relational database infrastructure, while providing blazing
Fast performance for simple queries, using an API to complement regular
SQL access to their data.

The handlersocket
Development at Dena is a great example of Community innovation, with
Solution implemented as a custom plug-in and protocol for the MySQL
Server daemon.

We are hearing the community say they want notonly SQL-they want
Their trusted SQL RDBMS-plus, they want nosql techniques to access
That data. So, we are previewing our notonlysql solution for MySQL-
Delivered via memcached-with implementations to access both the InnoDB
And MySQL cluster (NDB) storage engines.

The purpose of this article is to provide more detail on the memcached API for MySQL, specifically covering:

  • Design Rationale
  • Implementation
  • Getting started
Design Rationale

Using the memcached API, Web services can directly access the InnoDB
And MySQL Cluster Storage engines without transformations to SQL,
Ensuring low latency and high throughput for read/write queries.
Operations such as SQL parsing are eliminated and more of the server's
Hardware resources (CPU, memory and I/O) are dedicated to servicing
Query within the storage engine itself.

Over and above performance, there are a number of additional potential benefits in this approach for both developers and DBAs:

  • Preserves investments in memcached infrastructure by re-using
    Existing memcached clients and eliminates the need for application
    Changes.
  • Access to the full range of memcached client libraries and
    Platforms, providing maximum deployment flexibility and consistently
    High Performance guest SS all supported environments.
  • Extends memcached functionality by integrating persistent,
    Crash-safe, transactional database back-ends offering acid compliance,
    Rich query support and extensive management and monitoring tools.
  • Reduces service disruption caused by cache re-population after
    An outage (note that buffer pool reloading enhancements planned for
    Future milestone release will further improve recovery performance
    Warming the cache)
  • Simplifies Web infrastructure by compressing the caching and database layers into a single data tier, managed by MySQL.
  • Reduces development and administration effort by eliminating
    Cache invalidation and Data Consistency Checking required to ensure
    Synchronization between the database and cache when updates are
    Committed.
  • Eliminates duplication of data between the cache and database,
    Enabling simpler re-use of data processing SS multiple applications, and
    Memory cing memory footprint.
  • Flexibility to concurrently access the same data set with SQL,
    Allowing complex queries to be run while simultaneously supporting
    Key-value operations from memcached.

Of course, the memcached implementations for InnoDB and MySQL Cluster
Are still in their early phases of development (though MySQL cluster is
More mature at this stage), and so neither is suitable for production
Deployment. Nonetheless, developers can at least get a taste of what is
Possible as these features evolve.

Implementation

The initial memcached API implementations for InnoDB and MySQL
Cluster take slightly different approaches, which are discussed below.

Note that both implementations are dependent on memcached 1.6.

Memcached and InnoDB

As replicated strated in Figure 1, memcached protocol access for InnoDB is
Implemented via a memcached daemon plug-in to the mysqld process,
The memcached protocol mapped to the native InnoDB API.

Figure 1: memcached API implementation for InnoDB

With the memcached daemon running in the same process space, users
Get very low latency access to their data while also leveraging
Scalability enhancements delivered with InnoDB 1.2 (which has been
Introduced as part of the MySQL 5.6.2 Development Milestone release ),
And a simple deployment and management model. Multiple web/Application
Servers can remotely access the memcached/InnoDB server to get direct
Access to a shared data set.

Note that in the current InnoDB implementation, updates made
Memcached applications are not written to the BINLOG. binlogging
Capability is something that the engineering team plan to add in
Future milestone release which wocould deliver against more of
Benefits identified in the "design rationale" section above.

With simultaneous SQL access, users can maintain all the advanced
Functionality offered by InnoDB including support for foreign keys, XA
Transactions and complex join operations.

Looking forward, the MySQL engineering team plans to develop the same
Implementation model used by MySQL cluster with the memcached Server
Running in a separate process space (discussed below). Users can then
Choose whichever implementation model makes the most sense for their
Specific use-case.

Learn more»

You can download the code now from the http://labs.mysql.com and select the appropriate build:

  • Binary: mysql-5.6.2-labs-innodb-memcached-linux-x86_64.tar.gz
  • Source: mysql-5.6.2-labs-innodb-memcached.tar.gz
Memcached and MySQL cluster (NDB)

Like memcached, MySQL cluster provides a Distributed Hash table
In-memory performance for caching, which can now be accessed via
Simple memcached API.

Figure 2: memcached API implementation for MySQL cluster (NDB)

Unlike the initial InnoDB Implementation discussed above, a MySQL
Cluster plug-in is installed within the memcached server as
"Memcached driver for NDB" which can access the ndb api to directly
Query the data nodes, as specified strated in the distriabve.

With the memcached server running in a separate process space,
Single MySQL cluster instance can serve multiple memcached applications,
And scale-out on demand with transparent auto-sharding, In-memory data
And the ability to add nodes on-line to a running cluster,
Interruption to service.

Users can also take advantage of 99.999% uptime and high Write Performance Properties of MySQL cluster to support update-intensive services with extreme availability requirements.

As all updates from memcached applications pass through the ndb api,
The BINLOG injector thread captures and writes events to the binary log
For onward replication to slave systems.

As well as having memcached access to MySQL cluster, users have
Additional flexibility of maintaining their own dedicated memcached
Caching layer for data with the following properties:

  • Read-intensive (rarely updated)
  • Response-time sensitive
  • Does not require persistence
  • Simple key-value access patterns

The memcached API adds another direct nosql access method to MySQL
Cluster, which already primary des C ++ (ndb api), Java, JPA, LDAP and
HTTP/rest interfaces, all of which can be used concurrently with the SQL
Interface to serve a broad range of web, telecoms and embedded
Use-Cases Handling the simplest to the most complex queries.

Learn more about the memcached implementation for MySQL cluster»

You can download the code now from the http://labs.mysql.com and select the source build: mysql-cluster-7.2-labs-memcached

Summary

Explosions in data volumes and Internet penetration rates are driving
A seemingly insatiable demand for ever-higher levels of Database
Performance. By directly implementing memcached API support to InnoDB
And MySQL cluster, developers and DBAs can preserve the rich
Functionality of relational databases and SQL, while also having options
To integrate simple and fast access methods provided by the one of
Most widely adopted nosql protocols.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.