设为首页 收藏本站
查看: 397|回复: 0

[经验分享] NoSQL to MySQL with Memcached[转载]

[复制链接]

尚未签到

发表于 2015-6-26 08:48:06 | 显示全部楼层 |阅读模式
  本文来自Mysql社区对Mysql和Memcached联合使用的讨论,揭示了下一版本Mysql的发展方向,与大家共享。
  The ever increasing performance demands of web-based services has generated significant interest in providing NoSQL access methods to 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 HandlerSocketdevelopment at DeNA is a great example of community innovation, with a 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 InnoDBand 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 the 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 across 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 a future milestone release will further improve recovery performance by 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 thecache 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 across multiple applications, and reducing 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 Clusterare still in their early phases of development (though MySQL Cluster ismore 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 illustrated in Figure 1, memcached protocol access for InnoDB is implemented via a memcached daemon plug-in to the mysqld process, with the memcached protocol mapped to the native InnoDB API.
http://dev.mysql.com/common/images/articles/memcached_api_4_innodb.png
  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 the 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 / applicationservers can remotely access the memcached / InnoDB server to get directaccess to a shared data set.
  Note that in the current InnoDB implementation, updates made by memcached applications are not written to the binlog. Binlogging capability is something that the engineering team plan to add in a future milestone release which would deliver against more of the 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 sameimplementation 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 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 with in-memory performance for caching, which can now be accessed via the simple memcached API.
http://dev.mysql.com/common/images/articles/memcached_api_4_cluster.png
  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 an “memcached driver for NDB” which can access the NDB API to directly query the data nodes, as illustrated in the diagram above.
  With the memcached server running in a separate process space, a 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, without 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 the 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 includes C++ (NDB API), Java, JPA, LDAP and HTTP/REST interfaces, all of which can be used concurrently with the SQLinterface 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 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 drivinga 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 optionsto integrate simple and fast access methods provided by the one of the most widely adopted NoSQL protocols.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-80593-1-1.html 上篇帖子: MySQL 5.5.17 源码安装 下篇帖子: MYSQL学习笔记——基本语法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表