By: Shilpi
July 26 2019

'Discrete data' tale of Microservices

Microservices has helped the organizations to improve their application building procedure. The quality of application development enhances and also deployment is getting simplified. Earlier to the implementation of microservices it is advised to ponder over the data maintenance and management for the same. 

The utmost care and measures need to be taken while handling the data in microservices architecture to ensure data security and performance across the system. Let us understand the data storage complexities and comprehend measures that can be taken to resolve those.

What are Microservices?

image showing a green colour cube divided into many green coloured small cubes
Source: LazaroIbanez/Medium

A distributed architectural approach for the application building is what we define as Microservices(Microservices Architecture). A large suite of applications can be built readily with the help of these extensible loosely-coupled components. Any changes made at one component will not break the entire system. The scalability of the application gets enhanced with microservices. Rapidly building new components converting the distinct user demands into a fully working functionality. 

With the features like addition, removal, modification, renaming, reconfiguration, and rearrangements of modules microservices is bringing innovative challenges and respective solutions for the same. 

Data considerations and challenges

Decomposing large application into easily manageable chunks based microservices. Using microservices methodology improves the quality of the application building process,  eventually productivity. Data management in microservices is quite challenging. Each service manages its own data supply. Being private no other service can access the data store directly. This avoids unforeseen coupling between services which may result due to the sharing of the same underlying data schemas.

An instance image of data arrangement in microservices showing service A and B in blue colour and a database structure in cylindrical form

Moreover, any changes done in the data schema will result in alteration in every service that depends on the particular database. Separation of data stores limits the scope preserving the independent deployment swiftness. Apart from this, data sharing limits create boundaries for the working teams eventually ceasing any optimization on the data storage.

Each service ends up using multiple data storage technologies within a single application, termed as Polyglot Persistence. The term has emerged from Polyglot Programming, a concept in which an application is written as a mixture of many languages just because different problems in the application need different languages to address the issue. When implementing in microservices, it gives full freedom to each team to make the choice of a ‘mixed’ datastores as per their requirements. 

The following issues persist as a result of the distributed data management approach

  • Data Redundancy: The same data section appears at multiple locations resulting in excessive use of the same data repetitively. For example, an application might be using the same data set for reporting and transactions.
  • Data Integrity, Consistency and Security: Isolation of data stores leads to many data copies affecting the data stability and accuracy across data stores. Managing any single update across the partitioned data stores is worth consideration in case of microservices. A detailed check is required in case of data circulation across distributed services. Data security threats exist in the majority of data movement and transformation cases.

Approaches to recapitalize data storage in Microservices 

image showing a vintage suitcase with some random things inside it

In order to do data management in microservices, a mix match approach needs to be followed. No single procedure will give a complete solution when dealing with microservices data storage arrangements. 

  • DevOps surfaced as an asset for both software development and data storage processes in the case. of microservices. The capability of DevOps for building applications with a huge data supply is magnificent. It is recommended to give DevOps data accessibility independent of the microservices location. Sequentially, allowing developers to perform the latest data updates without any inconvenience. Consequently, holding the secure, protected, upscale performance container data in its most current state with high availability. 
  • Follow ACID(Atomicity, Consistency, Integrity, and Durability) transactions for finding out the strong consistency places so as to encompass strong consistency across the whole data storage system.
  • Store what is required. Following a DDD(domain-driven-design) approach will facilitate the only data that is needed by a particular service. Service may only require a subset of a domain and carefully planning and selecting a domain entity is recommended. 
  • The event-driven architectural style is an aid. If an event is issued and changes are made on its public models or entities. Services that want to embrace the changes can subscribe to these events. For example, to get a materialized view of data service can use the more suitable querying data. 
  • Microservices has offered the undying benefits for the storage of data by bringing flexibility in the complete system. Along with agility, it carries many data security risks and threats. Data security has been very much significant when it comes to a distributed application building approach. Securing data threats with a three-pronged approach that includes building runtime defenses for both data and data threats.
  • In addition to that, log maintenance is necessary in the case of a distributed data management approach. Monitoring the flow of data, access information is essential to measure the security through the application.
  • With regard to reducing the total load from the events at high scale data aggregation or batching is considered appropriate.

Final Note:

Microservices has emerged from the world of domain-driven design, continuous delivery platform building infrastructure automation, scalable systems. Microservices has opened different level computing environment. 

Since the former mentioned is a way too different from monolithic architectures and brings the associated challenges organizations are trying and testing many new different strategies for data storage in microservices, like storing the data that is only needed for the service, following an event-driven architecture style, to name a few.