DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Data
  4. Hot Shot 010 – Dealing With M/SOA Data (Part 2) [Podcast]

Hot Shot 010 – Dealing With M/SOA Data (Part 2) [Podcast]

Part 2 of this podcast on data in microservice architecture discusses the database architecture in microservice applications.

Peter Pilgrim user avatar by
Peter Pilgrim
CORE ·
Sep. 26, 18 · Presentation
Like (2)
Save
Tweet
Share
2.62K Views

Join the DZone community and get the full member experience.

Join For Free

These are my verbatim notes from the PEAT UK podcast: 

Hello there once again and welcome 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.

* []

The single responsibility principle is a computer programming principle that states that every module or class should have responsibility for 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 words, one microservice has a private database. Let’s make it absolutely 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 an inventory warehouse payment processor thing access a distributed store. So visualize this for a moment.

Let’s say, we need to handle a spike then we could double the number of 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 the 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 works with a remote Aurora RDS just as well as a local database on your workstation or on your firm’s on-premise datacenter. 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.

Data (computing) Relational database microservice Podcast

Published at DZone with permission of Peter Pilgrim, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • A Brief Overview of the Spring Cloud Framework
  • How To Check Docker Images for Vulnerabilities
  • Event Driven 2.0
  • Quick Pattern-Matching Queries in PostgreSQL and YugabyteDB

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: