Answer the question
In order to leave comments, you need to log in
Authorization for horizontal scaling. How to properly implement?
Tell me, please, how to implement authorization and work with users with horizontal scaling? Where can you read all about it?
It turns out that I need to make several connections to the databases with one page load (somehow this is not good) and duplicates in the user tables
______________
If the main database will store a common table with users and each company will have its own database with the same table users and this is an adequate option, then I know how to work further
Answer the question
In order to leave comments, you need to log in
It's not horizontal scaling if you're connecting to all bases. The simplest option - you must determine the database you need according to the user's data (id, login, ip ...) and connect only to it. For this, a connection balancer is used (written).
You can read / watch recordings from various conferences, see how big offices shard.
1. Authentication != Authorization
2. You need to understand that with horizontal scaling, the server should not store states - usually people store session data in a salted cookie, not in the database.
3. You need to distribute the load depending on the current one, respectively, monitoring should be carried out, and requests should be sent to the least loaded server
4. The session cookie should contain the IP of the server that processes requests from the current user, and DNS, in turn, should give the address of the server that works with this session. Thus, only one server can work with one user, and there is no need to drive any redirects between them, but for the first time you can just redirect.
5. In the case of push notifications and caching, everything is very complicated there and you need to turn CQRS-ES, sometimes you need to solve the consensus problem with Raft.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question