Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Distributed .NET with Microsoft Orleans

You're reading from   Distributed .NET with Microsoft Orleans Build robust and highly scalable distributed applications without worrying about complex programming patterns

Arrow left icon
Product type Paperback
Published in May 2022
Publisher Packt
ISBN-13 9781801818971
Length 262 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Bhupesh Guptha Muthiyalu Bhupesh Guptha Muthiyalu
Author Profile Icon Bhupesh Guptha Muthiyalu
Bhupesh Guptha Muthiyalu
Suneel Kumar Kunani Suneel Kumar Kunani
Author Profile Icon Suneel Kumar Kunani
Suneel Kumar Kunani
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Section 1 - Distributed Applications Architecture
2. Chapter 1: An Introduction to Distributed Applications FREE CHAPTER 3. Chapter 2: Cloud Architecture and Patterns for Distributed Applications 4. Section 2 - Working with Microsoft Orleans
5. Chapter 3: Introduction to Microsoft Orleans 6. Chapter 4: Understanding Grains and Silos 7. Chapter 5: Persistence in Grains 8. Chapter 6: Scheduling and Notifying in Orleans 9. Chapter 7: Engineering Fundamentals in Orleans 10. Section 3 - Building Patterns in Orleans
11. Chapter 8: Advanced Concepts in Orleans 12. Chapter 9: Design Patterns in Orleans 13. Section 4 - Hosting and Deploying Orleans Applications to Azure
14. Chapter 10: Deploying an Orleans Application in Azure Kubernetes 15. Chapter 11: Deploying an Orleans Application to Azure App Service 16. Other Books You May Enjoy

Monolithic applications versus distributed applications

In the following diagram, we have a classic monolithic hotel booking application with all the UX and business processing services deployed in a single application server tightly coupled together with the database on the left side. We have a basic N-tier distributed hotel booking application with UX, business processing services, and a database all decoupled and deployed in separate servers on the right side.

Figure 1.1 – Monolithic application (left) versus an N-tier distributed application (right)

Figure 1.1 – Monolithic application (left) versus an N-tier distributed application (right)

Monolithic architecture was widely adopted 15-20 years ago, but plenty of problems arose for software engineering teams when systems grew and business needs expanded with time. Let's see some of the common issues with this approach.

Common issues with monolithic apps

Let's have a look at the scaling issues:

  • In a monolithic app, there will be no option to scale up UX and services separately as they are tightly coupled. Sometimes scaling doesn't help due to conflicting needs of the resources.
  • As most components use a common backend storage, there will be a possibility of locks when everyone tries to access the data at the same time leading to high latency. You can scale up but there will be physical limits to what a single instance of storage can scale.

Here are some issues associated with availability, reliability, and performance SLAs:

  • Any changes in the system will need the deployment of all UX and business components, leading to downtime and low availability.
  • Any non-persistent state-like session stored in a web app will be lost after every deployment. This will lead to abandoning all the workflows that were triggered by the user.
  • Any bugs such as memory leaks or any security bugs in any module make all the modules vulnerable and have the potential to impact the whole system.
  • Due to the highly coupled nature and the sharing of resources within modules, there will always be resource starvation or unoptimized usage of resources, leading to high latency in the system.

Lastly, let's see what the impacts are on the business and engineering team:

  • The impact of a change is difficult to quantify and needs extensive testing. Hence, it slows down the rate of delivery to production. Even a small change would need the entire system to be deployed.
  • Given a single highly coupled system, there will always be physical limits on collaboration across teams to deliver a feature.
  • New scenarios such as mobile apps, chatbots, and analysis engines will take more effort as there are no independent reusable components and services.
  • Continuous deployment is almost impossible.

Let's see how these issues are addressed in a distributed application.

N-tier distributed applications

N-tier architecture divides the application into n tiers:

  • Presentation (known as the UX layer, UI layer, and the work surface)
  • Business (known as the business rules layer and services layer)
  • Data (known as the data storage and access layer)

Let's have a look at the advantages of a distributed application:

  • These tiers can be owned, managed, and deployed separately. For example, any bug fixes or changes in the UX or service will need regression testing and deployment of only that portion.
  • Multiple presentation layers, such as web, mobile, and bots, can leverage the same business and data tiers as they are decoupled.
  • Better scalability: I can scale up my UX, services, and database independently. For example, in the following diagram, I have horizontally scaled out each of the tiers independently.
Figure 1.2 – N-tier Distributed application scaled out

Figure 1.2 – N-tier Distributed application scaled out

  • The separation of concerns has been taken care of. The presentation tier containing the user interface is separated from the services tier containing business logic, which is again separated from the data access tier containing the data store. High-level components are unaware of the low-level components consuming them. The data access tier is unaware of the services consuming it, and the services are unaware of the UX consuming them. Each service is separated based on business logic and the functionality it is supposed to provide.
  • Encapsulation has been taken care of. Each component in the architecture will interact with other components through a well-defined interface and contracts. We should be able to replace any component in the diagram without worrying about its internal implementation if it adheres to the contract. The loosely coupled architecture here also helps in faster development and deployment to the market for customers. Multiple teams can work in parallel on each of their components independently. They share the contract and timelines for integration testing at the beginning of the project with each other and once internal implementation and unit tests are done, they can start with integration testing.

In this section, we discussed the advantages of distributed applications over monolithic applications and how easy it is to scale each of the tiers independently. In the next section, we will see challenges with distributed applications.

You have been reading a chapter from
Distributed .NET with Microsoft Orleans
Published in: May 2022
Publisher: Packt
ISBN-13: 9781801818971
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.
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 €18.99/month. Cancel anytime