Ajax please converge on a file and multiple files when reading speed there is no big difference

Source: Internet
Author: User
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

  • 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.