Redis has many great use-cases like session or full page caching, queues, pub/sub and leaderboards/counting, etc. Usable in your applications and microservice architectures.
In this article, I show you how to use StackExchange.Redis in ASP.NET Core to access a Redis server running in Docker.
The example application lets users write posts in categories. It uses Redis to cache aggregated data for top categories and users while the database stores the item/line data as “source of truth”.
This article starts with a simple first use-case and then advances to a more complex one with Lua scripting and the inbox pattern.
A scaled microservice-based application with a huge amount of growing data has a challenge to effectively deliver aggregated data like top lists.
In this article, I show you how to use Redis to cache the aggregated data. While the databases store the item/line data as “source of truth” and use sharding to scale.
A single Redis instance can handle some 100,000 operations per second
My example data model with users, posts, and categories can be a basis for your own usecases.
In the previous article, you created a microservice architecture and manually implemented application-layer database sharding.
Now, you will scale the application and run multiple container instances of the microservice and databases. You will use Docker Compose and an HAProxy load balancer:
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.
This is the first of two parts. You will…
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.
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.
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. …
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:
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: