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

Microservices: Rearchitecting Your Stack With Tarantool

DZone's Guide to

Microservices: Rearchitecting Your Stack With Tarantool

Learn about Tarantool, one of the most microservice-ready, in-memory databases on the market — and it's open source!

· Database Zone
Free Resource

Discover Tarantool's unique features which include powerful stored procedures, SQL support, smart cache, and the speed of 1 million ACID transactions on a single CPU core!

Microservices can decrease the risk of experimenting with new technologies and can enable each part of an application to scale at its own pace. Of course, each microservice should be as independent as possible from the other microservices in an ecosystem, ideally only connected by a communications interface. Powering your microservices with technologies that are both versatile and resource lean can help achieve this independence.

Open-source Tarantool is one of the most microservice-ready databases on the market due to its small footprint and unique architecture. It can execute an enormous amount of work on a single core, which means that it can run effectively on everything from an IIoT device to a small cloud VPS instance to a multicore server. The latter could actually run a whole suite of Tarantool services. And the fact that Tarantool has all of the features that it needs to function as an independent database means that any microservice it powers doesn’t require an additional database (as it would, were Tarantool a more conventional cache).

Four key elements contribute to Tarantool’s self-sufficiency and facility are:

  1. A non-blocking Lua application server that runs concurrent to its DBMS. Tarantool’s application server runs concurrent to its database server and can serve as an application’s complete backend, functioning entirely without an additional language like Go, Node, Python, or PHP. This speeds up an application, as data doesn’t need to be passed between the database and external application code, thus cutting the overall number of layers in an application down from five to two (Tarantool and NGINX are in fact all you need to build a successful suite of microservices). Note that additional functionality can easily be added to the application server with LuaRocks modules.

  2. Its ability to execute fully ACID transactions with rollbacks. Unlike most in-memory and NoSQL databases, Tarantool is fully ACID-compliant, and transactions can be rolled back. This allows it to handle OLTP loads without relational backup.

  3. Its facility for processing datasets larger than RAM. Tarantool’s write-optimized Vinyl engine enables it to work with data sets up to 100 times larger than available RAM by performing some operations on disk. This means that it can handle a large variety of data processing tasks as size isn’t a limiting factor.

  4. Its complex querying capabilities — including SQL. Tarantool offers much more than the simple key/value searches of most in-memory databases because it includes secondary indexes and as of version 1.8, full SQL support (its SQL implementation sits on top of native data structures). This allows it to be used in situations where queries need to be more complex.

Tarantool microservices can be exposed via REST API or RPC and a suite of services is ideally managed with an API gateway (see here, as well as the first reference in Point #1 above). Tarantool also features multi-node data replication: a must for microservices on virtual machines.

You are likely wondering, “But how can I begin using my current data for microservices?” Martin Fowler suggests that the strangler vines on a fig tree are a natural metaphor for converting a monolith: the vines begin growing on the top of the tree, extend to the roots, and then multiply until the original tree is wholly subsumed. Similarly, your goal should be to slowly begin to offload the parts of your application to microservices where the performance of traditional solutions isn’t good enough. For example, authorization and authentication can be excellent candidates for conversion. Also, keep in mind that Tarantool engineers are available to evaluate your application and suggest the parts that are most appropriate for restructuring.

Tarantool’s dexterity allows it to serve as an effective lynchpin in any application’s transition to microservices. But don’t let its leanness mislead you: Tarantool was born for heavy loads. Although open source, it was developed in-house at one of the world’s largest internet companies.

Discover Tarantool's unique features such as powerful stored procedures, SQL support, smart cache, and the speed of 1 million ACID transactions on a single CPU.

Topics:
microservices ,database ,tarantool ,lua ,dbms ,acid ,oltp ,querying ,architecture

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}