Home >Backend Development >PHP Tutorial >Why don't e-commerce websites bind data directly but use js to define data?
Separation of front and back ends?
Performance optimization?
Separation of front and back ends?
Performance optimization?
For large websites like JD.com and Taobao, data reading is very complicated and cannot simply be read from an interface. The main approximate data is divided into the following categories
Read data directly
Read the latest data directly from the server. Only a portion of the data does this because there is too much pressure on the service. This step may be server-side rendering.
Cached data
If reading the latest data from the server fails, or the real-time performance is not strong and there is no need to read the latest data, use cached data. to reduce pressure on the database.
Disaster recovery data
If the machine suddenly fails, or the program crashes, and both direct reading of data and caching of data fail, disaster recovery data will be used. Disaster recovery data is generally saved to the client in localStorage or userData after successfully reading the first two types of data. Even if there is a server-side failure, the page can still be displayed normally. It just might not be the latest data.
So like Taobao and JD.com, even if something goes wrong. Nor does it affect user browsing (which may affect operations).
So it’s difficult to analyze why it is used in this way just by looking at the title picture.
Put rendering on the client to reduce server pressure