When Ajax requests the same file and multiple files, is there a big difference in reading speed?
My get.php here is to generate JSON data for AJAX calls
If you have 10,000 requests at a time,
Scenario One: These 10,000 requests both access a get.php file at the same time;
The structure inside the get.php is probably like this.
if (id==1) {
situation one;
}
else if (id==2) {
Situation two;
}
... And so on.
else if (id==20) {
Situation 20;
}
Scenario two, splitting the get.php into get1php according to different case details, get2.php ... get19.php, get20.php, makes 10,000 requests scattered.
1) What are the differences in speed between these two options?
2) is there any good way to increase the speed of the request?
I know that one way to do this is to distribute the get.php files across different servers, which can spread out different servers and read faster.
------Solution--------------------
No difference, multiple requests read a file at the same time and read multiple files without distinction. No restrictions on file locks are required to read.
If you deploy to more than one server and request a balanced distribution across multiple servers, it does load-balancing effect.
------Solution--------------------
Multiple server layout load balancing is sure to be able to share the pressure, but the code can also be optimized, you use the if else if format, rather than with switch () {case:; Statement... All by the LZ judge