Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Next-Level MySQL Performance: Tarantool as a Replica

DZone's Guide to

Next-Level MySQL Performance: Tarantool as a Replica

Learn how Tarantool can help you reap all the benefits of refactoring your MySQL stack by adding an in-memory NoSQL solution.

· Database Zone ·
Free Resource

Running out of memory? Learn how Redis Enterprise enables large dataset analysis with the highest throughput and lowest latency while reducing costs over 75%! 

Image title


Refactoring your MySQL stack by adding an in-memory NoSQL solution can improve throughput, allow scalability, and result in substantial hardware savings.

Tarantool is particularly suited as a MySQL addition, as it offers all of the speed of the basic cache databases while maintaining many features of a traditional Relational Database Management System (RDBMS).

For example, Tarantool has fully ACID transactions — including rollbacks — as well as secondary indexes and Lua-scripted stored procedures. Unlike Memcached or Redis, which can only be queried by key/value pairs, Tarantool’s data objects accommodate the use of relational-style queries, which can be written in Lua or SQL (or the two mixed together).

To illustrate Tarantool’s ability to accelerate a relational stack by replicating it, consider the raw speed differential between Tarantool and a relational counterpart. Tarantool can execute one million queries per second on a single core, whereas this feat would require anywhere from 20 to 722 cores on a relational database.

Offloading work to Tarantool’s low-overhead and lock-free architecture allows existing relational implementations to become considerably leaner — at least this is what Mamba, a large internet company, experienced: they eliminated seven servers by adding Tarantool to their MySQL stack.

Tarantool’s replication of an existing MySQL installation can take two approaches:

  1. Added to a more traditional type installation, perhaps where an original single node was replicated and sharded.
  2. Used to modernize and transition to a microservices architecture. In this installation, multiple small processes each have their own functions and data sources. Microservices are a natural fit for Tarantool because it can be run as multiple instances. The maximum known instance number of Tarantool processes is around 500 (see comments in source).

The Tarantool team is led by a former MySQL engineer so it is not surprising that its replication of MySQL data is effective. Tarantool’s processing of MySQL data is much faster than a conventional SQL slave server.6

Connection to MySQL is based on libslave and it works by reading MySQL’s binary logs. A simple configuration file specifies which databases and tables should be replicated. Whole tables need not be used, as Tarantool allows the replication of subsets of tables — i.e. fields. Data can also be put into one “space,” eliminating the need for joins between tables. With regards to monitoring, there is a separate space in Tarantool that shows a running status of the replication, which is similar to SHOW SLAVE STATUS” in MySQL.7

Because Tarantool features a fully scriptable Lua application server in addition to a database management system, it can serve as the “glue” between MySQL and the whole ecosystem of Lua functionality, including LuaRocks modules. Unlike the Lua implementation in Redis, Tarantool’s application server has full access to network and external services. Using the application server, it is possible, for example, to automatically remove old data from the database(s), to send an HTTP request, or to save data to the database(s). Data can even be directly served out of the database(s) via a REST API.

Go beyond MySQL with the ability to simultaneously accelerate data from a myriad of other databases and connections. SQL capability alone allows it to easily use Oracle, SQL Server, and IBM DB2.8 Tarantool can add data that it calls in from APIs to these database connections. Used in this “mix-and-match” fashion, Tarantool can federate data that can then be pulled into front-end solutions, such as business intelligence tools like QlikView, Cognos or Tableau. Pulling data first into Tarantool and then into a BI tool is faster than pulling the data straight from the sources into the BI tool.

When added to a MySQL stack, Tarantool’s data-processing capabilities allow the stack to be downsized considerably as well as reorganized — potentially into a microservices architecture. Tarantool also greatly expands the functionality of MySQL, to the degree that a sizable amount of backend code in an application can be eliminated.

Resources

Running out of memory? Never run out of memory with Redis Enterprise databaseStart your free trial today.

Topics:
database ,mysql ,database performance ,tarantool

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}