paint-brush
An Intro to .Net Microservices Application Architectureby@satyamchaturvedi
413 reads
413 reads

An Intro to .Net Microservices Application Architecture

by Satyam ChaturvediAugust 3rd, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Software development has seen a massive paradigm shift in the last couple of decades, and we have moved from the Monolithic approach to the multi-tiered and Agile approach, to remain effective in the market. With the advent of Microservices, people are exploring the avenues to redesign their existing monolithic systems and convert them into sequence-independent microservices. In a typical setup, every microservice runs in its own separate process. It can be deployed on its own, without having any sort of dependency on other microservices. It can have its own dedicated data store and it can seamlessly collaborate with several microservices to fulfil its action.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - An Intro to .Net Microservices Application Architecture
Satyam Chaturvedi HackerNoon profile picture

Software development has seen a massive paradigm shift in the last couple of decades, and we have moved from the Monolithic approach to the multi-tiered and Agile approach, to remain effective in the market and offer flexible and scaled solutions for enterprises. It is an established norm to breakdown the overall software development process into little tasks and then work on them simultaneously to fulfill the requirements, instead of getting overwhelmed by the enormity of the entire process.

Another important change we are witnessing is about .Net Microservices, which is gaining massive popularity in the Tech market, as enterprises
are moving gradually towards developing more larger and complex applications that can be set apart and handled as an amalgamation of multiple smaller services. With the advent of Microservices, people are exploring the avenues to redesign their existing monolithic systems and convert them into sequence-independent microservices.

Flaws in Traditional Monolithic Architecture

.Net Microservices offer a solution to the issues and challenges we were facing with the traditional and monolithic architecture. In a traditional approach, with the growth of application the associated code base used to be expanded as well, which used to overload the software development environment wherever it used to load the application, which ultimately reduced the productivity of a developer.

In traditional architecture, an application is packaged in one EAR/WAR, and when we change the technology stack of the application due to any reason, it makes the overall process too much cumbersome. It becomes very difficult to refactor the code base with the monolithic architecture as it becomes hard to predict how it may impact the functionality of the application.

If any function or application component fails, then the entire application becomes unstable or just crashes. Imagine a web application that may have separate functions such as user login, purchase, history, and payment gateway. Under such a scenario, the application becomes unstable and its performance is compromised if a specific function starts putting more pressure on the computing resources.

Picture Credit: Divante

Application scaling is another challenge with traditional and monolithic architecture. In the above-mentioned example, the web application could be scaled by deploying the EAR/WAR packages in the given additional servers, this practice is also called Horizontal scaling. But this design is highly inefficient, as all the additional servers may contain copy of the application, which will utilize the similar kind of computing resources of all additional servers.

Monolithic architecture usually impacts both the application development and application deployment stages. With the ever-increasing user-base and application usage, the developers feel challenges while breaking
down their application into smaller components.

As every component in monolithic approach is closely tied together, developers can seldom work independently to build and deploy the modules due to their dependency on existing modules, this approach only increases the overall development time and inefficient usage of resources. .Net Microservices address all these flaws, and in next section, we will learn about them.

What is a Microservice?

Typically, a Microservice is a service with one specific capability that a remote Application Programming Interface (API) exposes to the rest of the software. It is developed in such a way that each capability in the system is executed as a separate microservice. In a typical setup, every microservice runs in its own separate process. It can be deployed on its own, without having any sort of dependency on other microservices. It can have its own dedicated data store and it can seamlessly collaborate with several other
microservices to fulfil its action.

Here one of the most important aspects is that microservices do not need to be coded in the same programming language (Java, Erlang, or C#) or for a similar platform (Node, IIS, or NGINX). Microservices only need to know the communication method to stay in touch with each other. Some microservices may communicate using a binary protocol or a service bus like Thrift, which also depends on the system’s requirements. However, the most common method through which microservices communicate is via HTTP.

Picture Credit: Microservices.io

Microservice characteristics

As we said, Microservice is a service with focused capability, and it possess the following characteristics.

  • It is individually deployable.
  • It is responsible for a single capability.
  • It is replaceable.
  • It owns its own data store.
  • It is consisting of one or more processes.
  • It enables a small team to maintain multiple microservices.

Why do we use Microservices?

We use Microservices to develop a software solution, which should be scalable, robust, malleable, and above all shall be resilient. Such software or application must allow a comparatively short lead time from development phase to deployment phase. Any application developed via .Net Microservice must offer the following benefits.

Enable continuous delivery - The .Net microservices architecture method takes continuous delivery into account.

Allows an efficient developer workflow - Microservice enables an environment where developers can utilize an efficient workflow, which is highly maintainable.

Offers robust systems by design - Microservices aided software and application are too much robust in nature and can withstand all sorts of technical challenges.

Seamless Scaling capability - It offers seamless scaling capability, which enables developers to expand the application up or down at any point of time.

What is .Net Microservice Architecture?

The .Net Microservices Architecture is a unique software development
methodology, which allows developers to fragment an application into several smaller services, wherein each service can independently execute its process and interact with other application mechanisms.

These microservices are built around several business capabilities, which can be deployed independently with deployment mechanism, that is automatic in nature. The .Net Microservices architecture requires almost negligible level of management of these services, it could be developed in different programming languages, it also offers flexibility to employ different sets of data storage technologies.

If we are developing a scaled server-side enterprise app, it must support different kind of clients such as mobile browsers, native mobile applications, or desktop browsers. The application must be exposed to the 3rd party APIs for additional functionality. The application might need to interact with other applications, web services, or a message broker to fulfill the end user’s requests.

The application shall be designed to handle HTTP requests and messages; execute business logic, access the database; exchange the messages with other system components, and return a response in XML/HTML/JSON format. For any application, we do have logical components corresponding to all the functional areas.

With the help of .Net Microservice Architecture, developers can build an application as a collection of services that have following traits.

  • Application should be highly testable and maintainable.
  • The components of application should be loosely coupled.
  • All the services should be independently deployable.
  • Services are organized around business logic and capabilities.
  • It could be owned by a small but dedicated team.
  • Offers a frequent, rapid, and reliable delivery of complex applications.
  • Flexibility of making the changes in technology stack with evolution of application.

Advantages of .Net Microservices Architecture

.Net Microservices offer numerous advantages, that is the reason why all the big Tech Firms such as Netflix, Amazon, or eBay have already adopted this architecture and it is gaining massive traction among the netizens. If we compare .Net Microservice with the Traditional Monolithic design structures, then we get the following advantages.

  • Rapid and Smaller deployments: The thumb rule is very simple, the smaller codebases and scope of the application result in faster deployment. It also offers developers an opportunity to explore further advantages of Continuous Deployment.
  • Better Fault isolation: Fault tolerance is one of the biggest parameters that guarantee the success of an application. .Net Microservices ensure that applications remain unaffected by any sort of failure of any module.
  • Seamless Scalability: As we have a separate set of services, hence developers are capable enough to scale the required services of modules at the appropriate times, instead of scaling the entire application. It allows organizations to save a large extent
    of cost, as far as application scaling is concerned.
  • Eliminate Technology or Vendor lock-in: Microservices offers exceptional flexibility, where developers can try out a new technology stack on a specific service, when required, instead of trying it on the entire application, which could be catastrophic. It will not have too many dependency concerns for the developers, it also allows them to roll back any failed change quite easily. It offers way better vendor-based flexibility, as it has comparatively less code in play.
  • Ease of understanding: .Net Microservices are very easy to understand, and with added simplicity, it offers better insights to the developers, and they can understand the functionality of service with ease.

Disadvantages of .Net Microservices Architecture

.Net Microservices are certainly popular like a hotcake, but they do have certain drawbacks. Here are some disadvantages of .Net Microservices, that any distributed system can face in a real-time scenario.

  • Communication complexities between services – As everything service is independent in nature, hence it is quite important to handle the requests traveling between all the modules carefully. In such a scenario, developers may have to write extra codes to prevent any sort of disruption. Such complexities will only rise with time when remote calls will start experiencing sizeable latency.
  • Debugging problems: Every service will have its own set of logs and same goes with other services as well. Ultimately it will create a huge pile of logs for the developers and
    testers, which tends to enhance the complexities while debugging the code.
  • Deployment challenges: The final product may demand better coordination among the multiple services, but that could not be as simple as deploying a WAR in a container. Hence, developers and project managers should remain extremely careful while performing the deployment in a live environment.
  • More services required more resources: We are working on multiple services, interacting with multiple systems and database systems to perform different kind of transactions, which could be painful if resources are not adequate.
  • Global testing is cumbersome: To perform global testing on a microservices-based application can be difficult if not cumbersome. In a traditional monolithic approach, we could perform it by launching our WAR on an app server, by confirming its connectivity with the database server. However, with .Net Microservices, we must confirm the
    connectivity of each dependent service with the backend server before initiating the testing process.
  • Small vs Large Enterprises: .Net Microservices could be fruitful for large enterprises, but could be slower or complex for small enterprises, those need quick development and do not want to be stuck due to a complex orchestration.

However, we can address these bottlenecks with the usage of automation tools and adequate training of the development team.

How to deploy .Net Microservices-based applications?

We can deploy the .Net Microservices-based applications within containers. A container is nothing but a complete virtual operating system(OS) environment, which offers all the processes a great degree of isolation, but at the same time enables dedicated access for them to utilize the underlying hardware resources. One of the most popular container solutions is Docker, which can be used to deploy .Net microservices-based
applications.

We can also use the Virtual machines (AWS) for .Net microservices
deployments, though we must ensure that lightweight microservices packages should not leverage the whole virtual machine, as that will reduce the cost-effectiveness of the solution.

.Net microservices-based application can also be deployed using an Open Service Gateway Initiative (OSGI) bundle. In this scenario, the application service will be executed under one Java virtual machine (JVM), though this option comes with several management and isolation challenges.

Use Cases of .Net Microservice Architecture

As we said earlier, many large enterprises like Amazon, Netflix, or eBay have already opted for this architectural approach as they have understood the potential advantages this architecture offers. Here we will talk about their implementation of .Net Microservices architecture.

  • eBay – It is one of the largest marketplaces in the world, and it processes millions of transactions on daily basis. However, eBay decided to migrate from its existing monolithic architecture to a microservices-based architecture. In eBay’s architecture, its application tier is composed of multiple independent applications, where every application executes the business logic for given function area independently. In the new architecture, every application uses X-axis splits, whereas few applications like ‘Search’ utilize Z-axis splits. Microservice offers Ebay.com enough flexibility to use the combination of X-, Y- and Z-style to scale its database tier and offer exceptional services
    to the end-users.
  • Netflix- It is unarguably the most popular OTT platform in the world, and it is responsible for up to 30% of Internet traffic. Due to its massive user base and video streaming services, it has decided to transition to the microservices-based service-oriented architecture. Netflix handles over a billion video streaming requests per day on their API, from over 800 types of devices. Every API call further generates six calls to the backend services. It is the microservices-based architecture, that helps Netflix to manage such colossal traffic and API calls.
  • Amazon – Traditionally Amazon had a two-tier architecture, which has thousands of backend and frontend services, responsible for day-to-day transactions. Amazon’s architecture contains multiple application services, that generate a huge number of service calls via Amazon.com website and associated web service APIs. Microservice architecture enables Amazon website to handle massive service calls quite efficiently.

How to move forward with .Net Microservices Architecture?

With the gradual change in the web application development paradigm, we may witness more debate between using traditional Monolithic architecture or Microservices. However, it is important for the developers to perform their due diligence and adopt the necessary approach based on their projects.

For small enterprises, it is easy, cost-effective and faster to start with the monolithic application method. They can keep using the monolithic approach if the product has not attained much mature; However, they
can swiftly migrate to microservices at any time in the future. Whereas the
large enterprises with massive user base can certainly opt for .Net
microservice methodology, as it helps them to scale the application easily, ensures uptime, and flexibility to add more modules in the future with ease.

Final thoughts

The .Net microservices architecture enables the developers to employ a different set of technologies between each service. It offers the necessary flexibility to utilize the .Net for a specific module of an application, without having to implement it everywhere.

Developers can easily amalgamate the .Net microservices with apps coded in Node JS, Java, or any other programming language. This ability allows an easier migration to .Net core technology for microservices that execute in tandem with other microservices developed with other technologies. .Net microservices can easily run on all prominent cloud platforms in the market.

The future of .Net microservices certainly leads us closer to serverless architecture. It helps organizations to save time, cost, and resource at the same time, as they must pay an amount of only utilized computing resources.

Microservices is an exceptional concept that is implemented to develop applications and software solutions from a more modular and granular level. However, please keep in mind that it is not recommended to initiate developing the .Net microservices architecture from the scratch, since it is complex to define the interface and boundaries of each service right at the beginning. But yes, it is certainly a good idea to opt for .Net microservices architecture, as it allows us to develop applications, that can cater requirements of the high demanding users and markets.