Microservices use distributed computing to isolate and scale application service components, and this is the hot trend for application development. MemSQL sees this trend continuing because of the prolific increase of real-time applications. These applications require deep analytics and a strategy for manageable components delivering speed and scale.
Each application service component has its own independent service deployment and flexible data model. The goal is to allow developers to focus on building business logic rather than coordinating with corporate models and infrastructure constraints.
Microservices has promise for improving developer productivity but also has known drawbacks that need to be addressed. Decisions and struggles with Microservices include distributed transactions, eventual consistency, and high-performance analytics. One approach to addressing these challenges is to define the most appropriate data repository for your services, which also provides the flexibility to modify the data model at a service level while also delivering high performance joins to other objects. In addition, the repository will also need to provide high-performance analytics across all the data within a domain.
By making a few base decisions and leveraging MemSQL as the data repository a highly flexible, scalable and performant solution can be delivered. The first choice is to leverage a single database table per service. The second choice is to leverage JSON as the model for your service data.
MemSQL and Microservices Architecture
How the components work together:
- Each Service is independent and scales by adding nodes.
- Services manage and use data within a JSON object.
- Services persist JSON objects to MemSQL.
- MemSQL indexes and stores the JSON in MemSQL Tables.
- MemSQL scales by adding either Aggregator and/or Leaf nodes.
- Analytics tools use SQL to query the JSON data.
- Convert to computed SQL columns from JSON for speed improvements.
MemSQL has extended its SQL to support the traversing of JSON objects as well as the extraction of data from a JSON object so it can be fully indexed. Additionally, once indexed, it can also deliver fast, distributed join performance across MemSQL tables. Microservices addresses performance and scale of independent services; by adding MemSQL you also get high-speed analytics, transactions and SQL queries across a distributed platform without having to restructure or move your data.
One complexity of microservices is the need to perform transactions across JSON objects (i.e. Customer orders have to update customer spend, place the order, and reserve inventory). While spending time on application development for committing complex transactions is possible, it adds an entirely new set of programming challenges for a developer. MemSQL supports distributed transactions across the MemSQL nodes so the developer simply submits the required SQL transaction and MemSQL handles the rest.
MemSQL supports flexible service definitions by using a JSON model. Developers can add data attributes without impacting MemSQL database queries or requiring ETL modifications. Additionally, MemSQL supports the streaming of JSON data directly into tables without having to build out a table schema. Streaming of JSON data allows developers to take advantage of event-driven models as well as immediately consistent transactional models.
The ability to deliver real-time analytics within a microservices architecture is uniquely enabled by MemSQL. Combining MemSQL into your microservices architecture supports the goals of independent scaling and flexible development while also reducing the challenges of Microservices Architectures.
MemSQL helps eliminate the struggles with microservices. MemSQL includes a distributed transaction capability so developers are not burdened with distributed transaction complexity. Using MemSQL means there is no need to settle for eventual consistency as MemSQL provides immediate consistency within its read commit model.