Load Balance a C# ASP.NET Core Service and Use MySql App-Layer Sharding. Shows the Concepts, Which Also Apply to MongoDB, etc.

One of the big advantages of microservices is, that they can be scaled independently. This article shows the benefits and challenges of scaling one microservice and its database.

You will create a working example application and manually implement application-layer sharding. It shows how to choose a shard key based on the use-cases and data model. This helps to apply the same principles to DBMS with integrated scaling like MongoDB, etc.

Further reading: Scale your app better with Scaling Cube by Iskander Samatov and What Exactly Is Database Sharding? by Harish V

This is the first of two parts. You will…

How to Build a Resilient Architecture with RabbitMQ, C#, Entity Framework, and the Transactional Outbox Pattern

In the first step, you will create two microservices. Each microservice has its own database. They use events to publish changes to a RabbitMQ event bus. (You can skip this part if you already implemented it in my last article). Next, you will see how messages get lost e.g. when the message bus is down.

In the second part, you apply the transactional outbox pattern and see how it prevents losing messages.

In the last step, you add publisher and subscriber acknowledgments and duplicate/out-of-order message handling.


  1. Create the .NET Core Microservices and Exchange Messages
  2. Implement the Transactional Outbox Pattern
  3. (Optional)…

Use RabbitMQ, C#, REST-API and Entity Framework for asynchronous decoupled communication and eventually consistency with integration events and publish-subscribe

In this guide, you will create two C# ASP.NET Core Microservices. Both microservices have their own bounded context and domain model. Each microservice has its own database and REST API. One microservice publishes integration events, that the other microservice consumes.

Decoupled Microservices — A Real-World Example With Code

The application uses a real-world example with users that can write posts. The user microservice allows creating and editing users. In the user domain, the user entity has several properties like name, mail, etc. In the post domain, there is also a user so the post microservice can load posts and display the writers without accessing the user microservice. …

How to add a MySQL DB and a MongoDB replica set in K8S on Docker desktop using persistent volumes and access the databases from ASP.NET Core, C# and Angular

In this guide, you will use databases in a raw microservice-based cloud architecture. It starts with a single MySQL instance and continues to a MongoDB replica set with a headless Kubernetes service. Both databases use persistent volumes. The databases are accessed by ASP.NET Core backend services and use Angular as the frontend. The application is exposed via an Ingress controller.

Overview diagram of the components:

How to use K8S on Docker Desktop with Ingress to Develop Locally for the Cloud Using an ASP.NET Core C# REST API and Angular.

Kubernetes runs in a local environment with docker desktop. It is similar to a cloud environment. You can use it for developing and testing. There are no extra costs. You can always easily deploy it later to the cloud.

In this guide, you will create a raw microservice-based cloud architecture. It uses .NET Core with REST-APIs in the backend services and Angular as the frontend. All components are dockerized and Kubernetes orchestrates the containers. The application is exposed via an Ingress controller.

Overview diagram of the components:

This guide shows you how to use NSwag to automatically add an OpenAPI specification to an ASP.NET Core C# REST-API. It also serves the Swagger UI to the browser. You will use NSwag Studio to generate a TypeScript client. Then you add the strongly typed client to your Angular app. Finally you authenticate to the backend via a JWT bearer token.

Workflow and involved components:

This guide shows you all the steps to build an Angular SPA with a focus on authentication. The single-page web application uses Sign-In with google and angularx-social-login. The .NET Core authentication backend creates asymmetrically signed tokens to access another REST-API. The sample is fully working and can be the basis for a microservice-like architecture.

Authentication workflow and involved components:

Christian Zink

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store