Is there a big difference in reading speed when ajax requests converge one file and multiple files?

Source: Internet
Author: User
Is the reading speed significantly different when ajax requests the same file and multiple files? My get. php is used to generate json data for ajax calls. if there are 10 thousand requests at the same time, Solution 1: All 10 thousand requests access a get at the same time. php files; get. the architecture in php is like this: if & nbsp; (id1) & nbsp ;{& nbsp; situation 1;} else & nbsp; if & nbsp; (When I ajax requests the same file and multiple files, is there a big difference in reading speed?
Here, get. php is used to generate json data for ajax calls.

If there are 10 thousand requests at the same time,
Solution 1: These 10 thousand requests simultaneously access a get. php file;

The architecture in get. php is probably like this.
If (id = 1 ){
Case 1;
}
Else if (id = 2 ){
Case 2;
}
... And so on
Else if (id = 20 ){
Case 20;
}


Solution 2: split get. php into get1php, get2.php... get19.php, and get1_php based on different situations to distribute 10 thousand requests.

1) What is the difference in speed between the two solutions?

2) Is there any good way to increase the request speed?
I know that one way is to distribute the get. php file to different servers, so that the reading speed of different servers can be dispersed and accelerated.


------ Solution --------------------
There is no difference. there is no difference between reading a single file for multiple requests and reading multiple files. You do not need to be restricted by file locks for reading.

If you deploy the service on multiple servers and evenly distribute the requests to multiple servers, the load balancing effect is indeed achieved.
------ Solution --------------------
Server load balancer can be deployed on multiple servers, but the code can also be optimized. if else if format is used, switch () {case:; break ;} statement... based on LZ

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.