I have another request from my client, which this time reads ... He wants us to optimize the database in some way. A very sharp increase in database requests is expected and such optimization is necessary. The client is aware of the manageable databases (clusters), but we do not know exactly how things work, in combination with Laravel. The question is this - when we create a connection with the cluster in Laravel, should the cluster itself be configured by digitalocean or it is at Laravel level? In general, what is the best way to build a database? It must be on an external server - that's clear. But how to setup this cluster to work the best way with Laravel?
vertical scaling is adding more grunt to your server(s), ie, more ram and more processors
horizontal scaling is adding more servers.
Far simpler to just get a bigger box until that either becomes economically disadvantageous or because you want to horizontally scale to improve resilience.
@Snapey Okay, but I have another question. Do I need to setup something on the code when changing to cluster? Is it that simple as just pay the cluster and connect Laravel with it through the .env file? Because currently we are on a simple PostgreSQL database hosted on the same server as the app. And if I need any preparation for migrating to the cluster, I should do it from now on. Also.. When the time comes to decide how to scale the server, if we decide to scale it horizontally, how does this happen? How does Laravel communicate with both servers? These 2 servers actually record the same information in real time, right?
The specific and most important question:
Do I need to prepare something for the cluster migration? Or I can simply do
@Laralex No, both servers don't record the same data. Its important to have one as the 'master' and then replication will push changes to the others (note master and slave are no longer politically correct). Reads happen from the other members of the cluster.
You have a lot of way to go before you need to worry about horizontal scaling. Note that doubling the number of servers will not give 2x the performance