Answer the question
In order to leave comments, you need to log in
One or more servers for backend, frontend and database?
Hello!
The following question arose: I am developing a site whose backend is written in Django, the frontend is written in React, and PostgreSQL is used as the database, please tell me how expedient it is to distribute the backend, frontend and database on different machines? Or is it better to place everything on one machine, but +/- powerful? How in such situations most often act and what is better to focus on? Unfortunately, since the project is new, I cannot estimate the possible load and give it to you as "input data", but I really wanted to listen to the advice of more experienced colleagues.
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
How expedient is the backend, frontend and database to be distributed on different machines?If one machine does not cope, or there are other reasons, then it is very advisable.
How in such situations most often act and what is better to focus on?They launch a project on what is available and does not hit the pocket hard. And then, depending on the load, they select iron and architecture.
Well, at least there are approximate load tests?
Check how many users you expect, what will be the load, run on minimal equipment, see how much percentage it is occupied. From this and see what is better - on one, or it no longer pulls out and must be carried.
When launching a site, on average, very small resources are enough, and even within the same provider, you can simply change the tariff by adding CPU and RAM up to a certain limit.
If explosive growth of users is expected, then the ideal is to write it in such a way that in the near future it would be easy to spread it to different machines, and it is desirable to plan the architecture for horizontal growth in general.
But it is. If there is such an explosive growth, then the money should flow like a river, and there it might be easier and more profitable to take a couple more people and rewrite it from scratch to meet the new requirements.
Focus, of course, on the load.
Since this is Django and React, then this is a web application.
Front is the end user browser on the user's computer.
The backend and the database can be hosted on the same server for starters. If it doesn't work - smash it.
If it's not difficult for you, throw everything at once, except for the database, into containers. Then in the future it will be technically easy to scale / split it (well, of course, here you also need to take into account scalability in the application code, but you just take this into account if the project takes off, it is not advisable to invest in it right away).
Django, React, PostgreSQL = web application.
In this area, for a long time, all the norms are parallel, as already answered above - initially write with a bias towards the extension, set to the minimum and scale as necessary.
the same PostgreSQL with minimal loads is better to keep locally to speed up work, when the load increases, push it to a neighboring server or cluster (it’s important to write this in the code as global constants, and not write localhost / localdb in each connection and request)
front / back if necessary, the same balancers are parallelized
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question