S
S
Sergey Pashkevich2017-09-05 11:45:16
Load balancing
Sergey Pashkevich, 2017-09-05 11:45:16

UPDATED: Balancing requests from different countries (NGINX) and trying to log into an account from a country that was not registered from?

Good afternoon.
I am working on an application in one country where there is active registration and user activity. But now the task arose to enter another market (another country) and in order not to mix data from the current database and a new one (from another country), since this is not necessary, a copy of the application will be made from its database and through balancing requests at the country level (nginx ) requests will be redirected to the correct application.
But what if a user from one country who was registered in the application (in the database for his country) arrives in another country where he also has his own copy of the application and tries to log into his account. He will not be able to log in, since the balancer will throw him onto another copy of the application, which, of course, does not contain his data.
Maybe someone faced similar problems and you somehow solved them or know how to solve them?
Since I have no idea how to solve this problem.
I would be grateful for any of your thoughts.
PS: it makes no sense to shove everything into one database, since users from one country do not need to show data from another and vice versa.
PPP (Example Application):
There is a platform where any user can register their store and sell their products on it, there is also a page where all products from all stores will be placed. By visiting this page, buyers can see all the products and can make purchases.
But now there was a need to place this platform for other countries, but I don’t want to mix products from different countries. It is necessary that the user entering the system sees only those products and only those stores that are located in his country.
Also, users should not know anything about the fact that there are some other products and other stores from other countries. For them, it will just be a local platform for their country.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Leonchik, 2017-09-05
@siarheipashkevich

I will answer based on the topic and your comment

Application example:
There is a platform on which any user can register their store and sell their goods on it, there is also a certain page where all goods from all stores will be placed. By visiting this page, buyers can see all the products and can make purchases.
But now there was a need to place this platform for other countries, but I don’t want to mix products from different countries. It is necessary that the user entering the system sees only those products and only those stores that are located in his country.
Also, users should not know anything about the fact that there are some other products and other stores from other countries. For them, it will just be a local platform for their country.

There are many implementation options, I will write how I would do it:
1. One database and here's why:
- Easy to maintain
- Eliminates the situation when the user connects to the wrong database (if one domain)
- There will be no problems if you decide to split the database, since id will still be unique. (because it is much more difficult to combine)
- A complex implementation of your idea in several databases
PS Display a certain product and not mix them, add a column and add 2 words to the query. The same with authorization + it is possible to write something like "Your account is not supported in this country"
2. Each country has its own domain (any level, it doesn't matter) and here's why:
- Proper indexing by search engines
- Easy to maintain
- Easier to monitor and track statistics
- Filter
PS users If you want to block X country's access to stores in Y country, then it's better to prohibit the "IP range" of X country on the domain of Y country
3. Refuse to distribute users by IP, the reasons are simple:
- No 100% guarantees that a person will get to the desired domain / language, etc.
- There will be problems with search engines
- Users will not be able to choose
- The user is tied to the country (which is already wild nonsense)
- A sea of ​​​​calls to the TP with the question "Nothing works for me !!!"
0. by the way:
- you limit yourself and this is bad
- I'm sure that there are analogues in the architecture of your idea that are implemented correctly
I wrote the first thoughts that came to mind and I can "go too far" in something or not take into account something, because I don't know all the details. And yes, if you are guessing right now and rely on the opinion of people from the toaster who do not know your concept, then you already have problems ...

B
Boris Korobkov, 2017-09-05
@BorisKorobkov

Balancing by IP is possible only to reduce the load, but the data must be the same in any case.
In your case, use different domains (example.ru, example.it, example.ge) or subdomains (ru.example.com, it.example.com, ge.example.com) to separate the database

H
hOtRush, 2017-09-05
@hOtRush

I think sharing the base is a bad decision. Why is it impossible to mark in the database which country the user is from? And then, as written above, simply redirect when logging in to the desired local subdomain

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question