An Introduction of a Microservices with ASP.net core 3x(Part-1)

This is an introduction about the Microservices architecture and we will discuss monolithic application/architecture and problems.

The goal is very clear & simple, to understand the Microservices Architecture and how to use it with the AWS component.

This is very important to understand that when it is good to use the microservices architecture or when it is not. Sometime it may be a backfire when it placed the wrong place. Microservices is not always a solution. So you have to think & identify, which architecture best fits your solution/application.

I am covering the below points in this article. I hope it will be helpful to you while developing a microservices application.

1・What is Monolithic applications?
2・Problems of Monolithic applications?
3・What is Microservices?
4・Benefits of Microservices over the Monolithic applications?
5・Architecture of Microservices with AWS(based on an application).
6・Team structure to develop the Microservices?
7・Evolution of a asp.net?
8・How you can implement it with asp.net core3x?

Let's start.
**1・What is Monolithic applications?**
In software engineering, a monolithic application is designed without modularity.
Without modularity means, software/application is made of component or module that they can be easily replaced or that can be reused, but in a monolithic application, there is no modularity.
One application performs many tasks and includes multiple services.
A console application is a perfect example. All the logic/database and user interface within an application.
![2020-02-07 13_02_29-Book1 - Excel.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/117479/562e92fd-a5fe-588c-9fec-91b9882bdb8c.jpeg)

**2・Problems of Monolithic applications?**
1. Can turn to a big ball of mud quickly. No single developer knows the entire code.
2. Limited reuse.
3. Scaling can be a challenge and /or costly.
4. Continuous integration and development can become complex and time-consuming.
5. They are built with one framework or programming language.
6. It's hard for multiple teams to work on one code base(e.g. code conflicts).
7. Change in one part of the application requires full build, deployment, and test.

**3・What is Microservices?**
Microservices are an architectural style that develops a single application as a set of small services. Each service runs in its own process. The services communicate with clients, and often each other, using lightweight protocols, often over messaging or HTTP.

Let's take an example of an e-shop.
![2020-02-07 13_20_07-microservices_.xlsx - Excel.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/117479/451cef2f-6ac3-366e-da7b-e21f1043ed93.jpeg)

**4・Benefits of Microservices over the Monolithic applications?**
There are many benefits to using microservices. Some of them are related to how they allow developers to write code.

・Microservices are small applications that the development teams create independently. Since they communicate via messaging if at all, they’re not dependent on the same coding language. Developers can use the programming language that they’re most familiar with. This helps them come to work faster, with lower costs and fewer bugs.

・Since the teams are working on smaller applications and more focused problem domains, their projects tend to be more agile, too. They can iterate faster, address new features on a shorter schedule, and turn around bug fixes almost immediately. They often find more opportunities to reuse code, also.

・Microservices improve your architecture’s scalability, too.
With monolithic systems, you usually end up “throwing more hardware” at the problem or purchasing expense and difficult-to-maintain enterprise software. With microservices, you can scale horizontally with standard solutions like load balancers and messaging.


**5・Architecture of Microservices with AWS.**
Based on the attached architecture, we will develop an application in the next part.
The architecture divided into two parts.
1. Public Internet
2. Private Infrastructure on AWS(VPC)
this part also divided into two parts.
            1. public subnet
            2. private subnet
![2020-02-07 17_02_01-Window.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/117479/bb3b0d23-903f-21e1-8253-66908c4eb810.jpeg)


**6・Team structure to develop the Microservices?**
For Microservices development, it is better to create a vertical team.
Let say, Accounts Team developer completed his task then Inventory Team can assign some task to accounts team developer too. We can share the resources between the teams.

And for the source control system, 
should have own repo for a particular service. Do not add all services into one repo.
If the account team developer wants to help the inventory team, then he needs to take an own fork(a copy of the source code) from the git and need to submit the request to the inventory team and then someone from the inventory team will manage the request.
So that's how someone from the other team may help someone inside the other team and vice versa.
![2020-02-07 14_05_44-microservices_.xlsx - Excel.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/117479/81b365d3-423b-2751-6ec3-f69c81d89770.jpeg)


**7・Evolution of a asp.net to asp.net core?**
![Screen Shot 2020-02-06 at 11.10.08.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/117479/c88222ad-d3ca-6363-b3b4-3775d5827275.png)

**8・How you can implement it with asp.net core3x?**
In the next part, we will go into the deep-diving(coding part).
till then stay tuned.

If you find anything wrong then please let me correct.

Enjoy coding...:grinning::grinning:

ref: https://stackify.com/what-are-microservices/

**Thanks,
Alok Rawat**