Support for MySQL read replicas #1734
Replies: 3 comments 7 replies
-
It is expected to use something like HAProxy for load balancing as this is in the domain of database operations and not Ory Kratos! This works well everywhere, is the standard for modern db stacks, is generalizable, and means you can optimize it for your env independent of the software (eg Kratos) you use. |
Beta Was this translation helpful? Give feedback.
-
Hello! We are having this very same issue and we were wondering if a scenario with 2 Kratos deployments sharing the same DB would work OK. Let me explain a bit deeper:
With this in mind, we could do some networking to only forward read only queries to Kratos 2. Would that be safe? Our main concerns
To add more context to this: we are using oathkeeper with Kratos and we are progressively starting to migrate to this new system. We are worried with the performance as we have a high-load system and every authenticated request will, theoretically, end in a request from cc/ @aeneasr cc2/ Hey @harnash , may I ask how did you finally solved this? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hey @noells. I think you will run into problems with this setup. There are some endpoints that create records though they are GETs (i.e.
where
We've just recently switch all queries hitting Dealing with primary/replica in the code would be much more precise than dealing with extra layer between Kratos and DB but it is not trivial and requires some extra tooling around that ( |
Beta Was this translation helpful? Give feedback.
-
Hello! We're introducing Kratos to our infrastructure and because of our scale, we simply can't use the single MySQL database for all queries. Generally, we use primary-replica replication and configure apps to use primary for writes and replicas for reads or implement such an approach if it's our own code. It seems that such configuration is not possible in Kratos since the one and only data source can be configured for it.
Do you plan to implement such a feature in the future? What do you generally think about this approach to configure separate read- and write-databases for Kratos? Do you know whether someone tried to use some alternative approaches like using ProxySQL to route queries to appropriate databases and how it works with Kratos?
Beta Was this translation helpful? Give feedback.
All reactions