C#C
C#3y ago
coado

Databases load balancing

Hey everyone,
I have to create a load balancer between databases. I am using EF core to build queries and manage database connections. I wonder if changing the database connection in interceptors is possible. For example, I have a DBContext instance connected to database1, and in the interceptor, I want to run a round-robin algorithm that will change the connection between database1, database2, etc.

The second approach that came to my mind is to create a proxy that will act as a "database" (it will listen for queries). It would redirect the requests between multiple real databases. I will connect DBContext to my proxy in my server that uses EF Core. I am unsure if it's possible and how to go about this.

I am new to C# and this is my assignment for university, so any help is appreciated. Thanks!


Hey everyone,
I have to create a load balancer between databases. I am using EF core to build queries and manage database connections. I wonder if changing the database connection in interceptors is possible. For example, I have a DBContext instance connected to database1, and in the interceptor, I want to run a round-robin algorithm that will change the connection between database1, database2, etc.

The second approach that came to my mind is to create a proxy that will act as a "database" (it will listen for queries). It would redirect the requests between multiple real databases. I will connect DBContext to my proxy in my server that uses EF Core. I am unsure if it's possible and how to go about this.

I am new to C# and this is my assignment for university, so any help is appreciated. Thanks!
Was this page helpful?