We're very pleased that you want to get in touch with us. Please fill in the form below:



or   Close this form  
Some content

Peter Pilgrim :: Java Champion :: Digital Developer Architect

I design Java EE and Scala software solutions for the blue-chip clients and private sector

Hey all! Thanks for visiting. I provide fringe benefits to interested readers: checkout consultancy, training or mentorship Please make enquiries by email or call +44 (0)7397 067 658.

Due to the Off-Payroll Working plan for the UK government, unfortunately, I am no longer accepting standard GOV.UK contract engagements for the public sector. Please enquire for further information.

Hot shot 010 – Dealing with Micro-Service Oriented Architecture DATA (part 2)

24 September 2018 Comments off

4 minutes

698

This are my verbatim notes to the PEAT UK podcast:

 

 

Hello there once again to another hot shot. My name is Peter Pilgrim, DevOps specialist, Java enterprise and platform engineer and Java Champion

 

 

What’s the database architecture in a microservices application?

In true independent microservices, they are designed and built to follow the Single Responsibility Principle (Robert Martin), which is the idea that a software function, class , package or aggregate module does not one thing well and only one thing well.

* [SRP](https://en.wikipedia.org/wiki/Single_responsibility_principle)

The single responsibility principle is a computer programming principle that states that every module or class should have responsibility over a single part of the functionality provided by the software, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility. Robert C. Martin expresses the principle as, “A class should have only one reason to change.”[1]

 

 

 

 

Therefore the SRP implies the MicroServices must be loosely coupled so that they can be developed, deployed and scaled independently

Some business transactions must enforce invariants that span multiple services. For example, the Place Order use case must verify that a new Order will not exceed the customer’s credit limit. Other business transactions, must update data owned by multiple services.

Some business transactions need to query data that is owned by multiple services. For example, the View Available Credit use must query the Customer to find the credit limit and Orders to calculate the total amount of the open orders.

Some queries must join data that is owned by multiple services. For example, finding customers in a particular region and their recent orders requires a join between customers and orders.

Different services have different data storage requirements. For some services, a relational database is the best choice. Other services might need a NoSQL database such as MongoDB, which is good at storing complex, unstructured data, or Neo4J, which is designed to efficiently store and query graph data.

Ideally, each microservices in your application should be its own copy of a database that only the specific service can access. In other word, one microservices has a private database. Let’s make it absolute clear. Each instance of a microservice class has ownership of database and when I use the term database it is very abstract meaning. The database is a simply a persistent store and it could be either RDBMS, or a NoSQL or Graph database or some other durable storage mechanism. So here I am talking a say three instances of a microservice a inventory warehouse payment processor thing access a distributed store. So visualise this for a moment.

Let’s say, we need to handle a spike then we could double the number instances to our inventory warehouse payment microprocessor service and then we have 6 instances talking to our instance. We can double this again to 12 communications, and double it again 24 communications (or connections). Now, can we actually feel the pressure on 48 persistent connections from our Java microservices onto our so-called database?

Precisely, because issue is that databases need to scale and still be atomic, consistent, isolated and durable with our very private customer data including yours and mine.

So in my experience, people have different ideas of a microservice persistent database. For some the ideal is too much, a customer might for instance look to AWS RDS Aurora for a solution, because they know it is based on MySQL and Amazon cites this server endpoint as reliably distributed such that it scales. The MySQL workbench work with a remote Aurora RDS just as well as local database on your workstation or on your firm’s on-premise data centre. Because the AWS RDS can be treated as a distributed database server with multiple schemas, users and tables shared across microservice instances that can be attractive for customers. The drawbacks are obviously Amazon charges the cost and of course there are concerns about privacy and security of customer data.

 

 

Bye

+PP+
September 2018

 

 

By the way, all your Shares, Likes, Comments are always more than welcomed!

 

 

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Contents of this blog entry are under copyright © 2017 by Peter Pilgrim and associates. For enquiries after republishing, please contact us for permission. All requests for syndicated content will be ignored /dev/null, consider yourself warned!

I help to design, create and build JVM components and services that are behind popular e-commerce websites.

My Blurb

Please get in touch , directly, to establish hire availability, contract & consulting opportunities.

Speaking at Your Conference

Contact by invitation

What Peter Does

Contact