Why test Ajax locally in a slow response

Source: Internet
Author: User
Local test AJAX receive paging data to reflect about 1s (above) but on the server on the 100ms to more than 900 Ms What is the best way to solve the Ajax acquisition speed is slow? There's not much improvement in converting paging data to JSON.
Data size display is 2.9KB time consuming 1.03s processing logic is simply query the MySQL 10 information field also 3

Did you test it again to return a small 392b of data or to return around 1s should be my local database query slow problem?

With jquery and Ajax.

Reply content:

Local test AJAX receive paging data to reflect about 1s (above) but on the server on the 100ms to more than 900 Ms What is the best way to solve the Ajax acquisition speed is slow? There's not much improvement in converting paging data to JSON.
Data size display is 2.9KB time consuming 1.03s processing logic is simply query the MySQL 10 information field also 3

Did you test it again to return a small 392b of data or to return around 1s should be my local database query slow problem?

With jquery and Ajax.

The problem is likely to be your local support IPv6 , and your local support for Mysql reverse parsing is a curse.
There are three ways to solve the problem:

    1. Modifying the local connection database localhost instead 127.0.0.1 , this is the simplest approach.

    2. Registry Disable IPV6

    3. MySQL disables reverse parsing.

Here is a blog can refer to: http://blog.onephp.net/archives/32/

Need to look at the slow in the first place. From the data, it seems that the background processing logic takes a long time, this depends on the implementation of the logic tuning. It is also recommended to use Chrome's developer tools to see the response time of the request sections, and then to diagnose whether it is related to the network.

@lovnie Ask a question is a skill, a simple way is to ask yourself to answer.
Q: Ajax requests local slow, server fast, where is the cause?
A: The local is not likely to be a network problem, that is the background interface slow! (then debug debug to see the interface response time.)
Q: Where is the interface slow? (assuming that the previous analysis was right)
A: Add logs to analyze where the time-consuming code is
Then the problem becomes the XXX code running why so slow, and then search for a, their own analysis, can not solve the question again, so the problem seems more advanced

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