Answer the question
In order to leave comments, you need to log in
How to organize a reliable infrastructure for a web project?
Hello!
I have a few questions about building a RELIABLE infrastructure for our web portal (PHP Yii2 + Mysql + Vue js SPA, no dockers (except for a couple of microservice pieces) + Cloudflare)
I'll start with problems
1. network crash in DC, our server becomes unavailable
2. network lags in the DC, the network seems to be there, but some of the connections take a very long time and break off, the connection with adjacent systems collapses.
3. DDoS attacks
I would not want to store everything in one basket (DC), so I will separate the services into different DCs.
For example, the most important thing (DB) will be transferred to Amazon AWS RDS
The main powerful web server with SPA and Backend will remain in the current DC in the Netherlands
I want to make a backup web server in another DC
Both web servers will work with the same database in AWS RDS (MultiAZ for reliability).
But there was a problem - all SQL queries lag a lot (each 100-500ms, looked in the Yii2 Debug panel).
if in the client's personal account it is still tolerable, there are few requests, then in the admin panel it is a living hell, the page opens for 30 seconds.
Please share your experience (unless, of course, all your services work in different DCs, and not in one DC like Amazon)
I thought to keep Mysql MASTER-MASTER on the main and backup web servers, without a single SQL server, but the question arises - how will they lead master yourself if the connection break will be more than 3-7 hours?
in general, the main goal is to ensure that in case of breakdowns in one DC, the work of the resource does not stop and customers can use the portal.
Answer the question
In order to leave comments, you need to log in
For example, the most important thing (DB) will be transferred to Amazon AWS RDS
The main powerful web server with SPA and Backend will remain in the current DC in the Netherlands
I want to make a backup web server in another DC
Both web servers will work with the same database in AWS RDS (MultiAZ for reliability)
Client - always works ONLY with one service server during one visit session. It can be either a separate structure or within the CDN structure. I prefer to use the second option.
Servers - constantly synchronize data asynchronously with each other (data exchange channel - always up!).
After the session is closed/changed by the client, a centralized notification occurs immediately to all servers and they queue up data synchronization for this particular user.
At the same time, the standard synchronization of database servers works in parallel in the normal mode.
all SQL queries lag a lotOnly a batch request pipeline with control over the load of the request-packet execution server and the necessary priority for executing all the necessary request-packages! The system must know (make its own decision!): when to fulfill the request, and when it is allowed to wait (prioritization).
It's called paranoia. You won't get 100% anyway. And if the application is interactive, also grab collisions. The fall of the data center is so rare that it makes no sense to bother.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question