Reader small image

You're reading from  Building Microservices with .NET Core

Product typeBook
Published inJun 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781785887833
Edition1st Edition
Languages
Right arrow
Authors (3):
Gaurav Aroraa
Gaurav Aroraa
author image
Gaurav Aroraa

Gaurav Aroraa has done M.Phil in computer science. He is a Microsoft MVP, life time member of Computer Society of India (CSI), certified as a scrum trainer/coach, XEN for ITIL-F and APMG for PRINCE-F and PRINCE-P. Gaurav serves as a mentor at IndiaMentor, open source developer, contributor to TechNet Wiki co-founder of Innatus Curo Software LLC. In 19+ years of his career, he has mentored thousands of students and industry professionals. You can tweet Gaurav on his twitter handle @g_arora
Read more about Gaurav Aroraa

Lalit Kale
Lalit Kale
author image
Lalit Kale

Lalit Kale is a technical architect and consultant with more than 12 years of industry experience. Lalit has helped clients achieve tangible business outcomes through the implementation of best practices in software development. He is a practitioner of TDD and DDD, and a big believer in agile and lean methodologies. He has worked with several organizations, from start-ups to large enterprises, in making their systems successful, be it in-house or mission critical, with clients in the USA, the UK, Germany, Ireland, and India. His current interests include container technologies and machine learning using Python. He holds a bachelor's degree in engineering (IT).
Read more about Lalit Kale

Manish Kanwar
Manish Kanwar
author image
Manish Kanwar

Manish Kanwar completed his masters of science in computer applications from MD University, India, and is a cofounder of Innatus Curo Software LLC, with a presence in India. He has been working in the IT industry across domains for the last 17 years. He started exploring .NET right from the first release and has been glued to it ever since. His range of experience includes global wealth management (financial service industry, USA), life insurance (insurance industry, USA), and document management system (DMS), ECMS, India. Manish does his bit for the community by helping young professionals through the IndiaMentor platform.
Read more about Manish Kanwar

View More author details
Right arrow

Chapter 10. Creating a Complete Microservice Solution

On our journey down the lane of understanding microservices and their evolution, we  continued through various phases. We explored what led to the advent of microservices and the various advantages of utilizing them. We also discussed various integration techniques and testing strategies. Let's recap all that we have talked about thus far:

  • Testing microservices
  • Security
  • Monitoring
  • Scaling
  • Reactive microservices

Architectures before microservices


Microservices were never designed from the ground up to be in the present form. Instead, there has been a gradual transition from other forms of prevalent architecture styles to microservices. Prior to microservices, we had the monolithic architecture and service-oriented architecture that reigned over the world of enterprise development.

Let's delve into these two before doing a quick recap of microservices and their various attributes and advantages.

The monolithic architecture

The monolithic architecture has been around for quite some time and it results in self-contained software with a single .NET assembly. It consists of the following components:

  • User interface
  • Business logic
  • Database access

The cost paid for being self-contained was that all the components were interconnected and interdependent. A minor change in any module had the capability to impact the entire piece of software. With all the components so tightly coupled in this manner, it made testing...

Monolith transitioning


As part of our exercise, we decided to transition our existing monolithic application FlixOne to a microservice-styled architecture. We saw how to identify decomposition candidates within a monolith, based on the following parameters:

  • Code complexity
  • Technology adoption
  • Resource requirement
  • Human dependency

There are definite advantages it provides in regard to cost, security, and scalability apart from technology independence. This also aligns the application more with the business goals rather than the current or possible technical boundaries.

The entire process of transitioning requires you to identify seams that act like boundaries of your microservices along which you can start the separation. You have to be careful about picking up seams on the right parameters. We have talked about how module interdependency, team structure, database, and technology are a few probable candidates. Special care is required to handle master data. It is more a choice whether you want...

Monitoring


The monolith world had a few advantages of its own. Easier monitoring and logging is one of those areas where things are easier compared to microservices. The sheer number of microservices across which an enterprise system might be spread can be mind-boggling.

As discussed in Chapter 1, What are Microservices, in the Prerequisites for a microservice architecture section, an organization should be prepared for the profound change. The monitoring framework was one of the key requirements for this.

Unlike a monolith architecture, monitoring is very much required from the very beginning in a microservice-based architecture. There is a wide range of reasons why monitoring can be categorized:

  • Health: We need to preemptively know when a service failure is imminent. Key parameters, such as CPU and memory utilization, along with other metadata could be a precursor to either the impending failure or just a flaw in the service that needs to be fixed. Just imagine an insurance company's rate...

Monitoring strategies


To begin with monitoring, you could think of different commonly implemented strategies as a solution to your problem. Some of the commonly implemented strategies are:

  • Application/system monitoring
  • Real user monitoring
  • Semantic monitoring and synthetic transactions
  • Profiling
  • Endpoint monitoring

Just bear in mind that each one of these strategies is focused on solving a specific purpose only. While one could be helpful in analyzing transaction propagation, the other could be suitable for testing purposes. So it is important for you to pick up a combination of these when designing the whole system since just using a single strategy won't suffice the needs.

Scalability

We have discussed in detail the scale-cube model of scalability and have found what scaling at each axis means. Note that x-axis scaling is achieved through the use of load balancers between multiple instances and the users of the microservices. We also saw how z-axis scaling is based on the transaction origination...

Reactive microservices


We have progressed well while transitioning our monolithic application to the microservice-styled architecture. We have also briefly touched upon the possibility of introducing reactive traits to our services. We now know what are the key attributes of reactive microservices are:

  • Responsiveness
  • Resilience
  • Autonomous
  • Being message-driven

We also saw the benefits of reactive microservices amounting to less work on our part when it comes to managing communication across/between the microservices. This benefit translates not just into reduced work but the capability to focus on the core job of executing the business logic instead of trying to grapple with the complexities of inter-service communication.

Greenfield application


Now let's go ahead and create the FlixOne bookstore from scratch. First, we will scope out our microservices and their functionalities and identify inter-service interactions as well.

Our FlixOne bookstore will have the following set of functionalities available:

  • Searching through the available books
  • Filtering books on the basis of categories
  • Adding books to the shopping cart
  • Making changes to the shopping cart
  • Placing an order from the shopping cart
  • User authentication

Scoping our services

In order to understand how these functionalities will map out as different microservices, we need to first understand what it would take to support it and what can be clubbed together as a microservice. We will see how the data store would start to look out of the window of microservices themselves.

The book-listing microservice

Let's try to break down the first functionality of searching through books. In order to let our users browse through the store for books, we need to maintain a list...

Summary


We hope that this book was able to get you initiated with the fundamental concepts of the microservice-styled architecture and also helped you dive deeply into the fine aspects of microservices with clear examples to associate the concepts with. The final application is available for you to take a closer look and analyze what you have learned so far at your pace. We wish you luck in utilizing the skills learned in this book and apply them to your real-world challenges.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Building Microservices with .NET Core
Published in: Jun 2017Publisher: PacktISBN-13: 9781785887833
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (3)

author image
Gaurav Aroraa

Gaurav Aroraa has done M.Phil in computer science. He is a Microsoft MVP, life time member of Computer Society of India (CSI), certified as a scrum trainer/coach, XEN for ITIL-F and APMG for PRINCE-F and PRINCE-P. Gaurav serves as a mentor at IndiaMentor, open source developer, contributor to TechNet Wiki co-founder of Innatus Curo Software LLC. In 19+ years of his career, he has mentored thousands of students and industry professionals. You can tweet Gaurav on his twitter handle @g_arora
Read more about Gaurav Aroraa

author image
Lalit Kale

Lalit Kale is a technical architect and consultant with more than 12 years of industry experience. Lalit has helped clients achieve tangible business outcomes through the implementation of best practices in software development. He is a practitioner of TDD and DDD, and a big believer in agile and lean methodologies. He has worked with several organizations, from start-ups to large enterprises, in making their systems successful, be it in-house or mission critical, with clients in the USA, the UK, Germany, Ireland, and India. His current interests include container technologies and machine learning using Python. He holds a bachelor's degree in engineering (IT).
Read more about Lalit Kale

author image
Manish Kanwar

Manish Kanwar completed his masters of science in computer applications from MD University, India, and is a cofounder of Innatus Curo Software LLC, with a presence in India. He has been working in the IT industry across domains for the last 17 years. He started exploring .NET right from the first release and has been glued to it ever since. His range of experience includes global wealth management (financial service industry, USA), life insurance (insurance industry, USA), and document management system (DMS), ECMS, India. Manish does his bit for the community by helping young professionals through the IndiaMentor platform.
Read more about Manish Kanwar