The web server under the photo. Which storage architecture to choose based on the scaling?
There is a web project, there is a lot of pictures.
Need advice on how to store pictures including the scaling?
Now all the pictures fall down in the General section of web server space is becoming less and less...
Plans to buy a machine under static, private domain of the type my-cdn.com
In nginx to create a subdomain fs1.my-cdn.com and there to put the files. How to end a server fs2.my-cdn.com etc. In a table pictures to store the number of the server (or fs1) to understand what kind of car is a file.
Linux is not strong, so the more nothing comes to mind. The web server is working under debian.
p.s. I will appreciate any answers. Credits to everyone!:D Only no flood plz.
Have not considered the connection hranilischa like S3?
myron_Schmeler98 answered on June 26th 19 at 14:37
It is better to do something a little different. To make a node — the input node to statics. This input node requires very little resources, but will make the interface for your entire system, you will avoid many problems and will be able to scale easily.
All access requests to static files should be sent to that node, for example, files.example.com. The one who is out of the query doesn't even know what server etc. is a file and it doesn't need to know.
This node keeps track of the files and knows on what server you have located the file. Your application (the website) sends a request to node (files.example.com) to access a particular file and that node is looking in my database where the file is located (on what server and what address) and in return gives the address, for example, srv01.files.example.com/f/405/502.jpg
Thus you will have a single interface as the entry point and your code will interact with the files through this interface (the API). If in the future you will need to change the algorithm, it is necessary to change only what is behind the interface, but not what lies ahead (what lies ahead interface won't even notice the change).
In the future, for reliability, you can make mirror sites.
Elta.Daugherty answered on June 26th 19 at 14:39
If the migration photo is not anticipated, then Your option is quite reliable. When mass migration from server to server, you only need to do UPDATE the column with the name of the server.
If you want to delete/move/add files between servers, it is still necessary to write the handler, which monitors the space on the servers and prioritizethe record current pictures to the correct server on which the workload was light, IO is the place. Ala load balancer.