スキップしてコンテンツを表示

waiting response time and blocked time while performing any Ajax request

0

We are facing high server waiting response time and blocked time while performing any Ajax request. Could any one please assist us in resolving this issue?

Our technical team has already deactivated all plugins and tested with basic AJAX calls, but the problem persists.

Additionally, we’ve observed that the issue is more pronounced on our production site compared to our testing server, which performs faster.

To reproduce this issue you can hit the pagination on the URL.

Please help us for the same.

質問済み 1年前161ビュー
1回答
0

Hi Sanjay,

Let's dive into your issue.

Clarifying the Issue

It sounds like you’re facing high waiting response time and blocked time when performing Ajax requests, particularly with pagination URLs on your production site.

You’ve already tested with basic Ajax calls and disabled all plugins, but the issue persists. It’s also clear that the problem is more pronounced on your production server compared to the testing server, which performs faster. Let’s get to the bottom of it.


Key Terms

  1. Waiting Time: The time a browser spends waiting for the server to respond after an Ajax request is sent.
  2. Blocked Time: Duration where requests cannot execute immediately, often due to resource limits or queuing on the server.
  3. Ajax Request: An asynchronous request sent from the browser to fetch or send data without reloading the page.

The Solution (Our Recipe)

Here’s a step-by-step approach to resolving this issue:

1. Monitor Server Performance

  • Use AWS CloudWatch to analyze CPU usage, memory consumption, and network latency on your EC2 instance.
  • Example: Enable CloudWatch Metrics and look for high CPU utilization or network I/O spikes.

Tip: If your instance is maxing out resources, try scaling it up or enabling Auto-Scaling to handle peak loads.


2. Identify Slow Backend Processes

  • Profile your application to find slow-running database queries or heavy API calls.
  • Use tools like AWS RDS Performance Insights or database profiling:
    • For SQL databases, run:
      EXPLAIN SELECT * FROM your_table WHERE condition;
    • This helps identify inefficient queries.

Tip: Optimize long-running queries, add indexing, or batch data to reduce execution time.


3. Optimize Ajax Requests

  • Reduce Payload Size: Return only necessary data fields in the Ajax response.
  • Enable Compression: Use gzip or Brotli compression to minimize response sizes.
  • Pagination Caching: Cache frequently requested results using a service like Amazon ElastiCache or local caching.

Example (gzip compression in Nginx):

gzip on;
gzip_types text/plain application/json;

4. Inspect Client-Side Blocking

  • Use Chrome DevTools > Network Tab to analyze how long Ajax requests are in a “Pending” state.
  • Ensure concurrent requests are optimized: browsers often limit simultaneous requests to the same domain.
  • If needed, reduce Ajax call frequency or batch multiple requests into one.

5. Check Production vs. Testing Configurations

  • Verify that production server configurations (e.g., Nginx/Apache limits, Node.js workers, or PHP-FPM settings) match those of the test environment.
  • Example: Increase worker processes in Nginx for better request handling:
    worker_processes auto;

Tip: If your production server is on a smaller EC2 instance, consider upgrading temporarily to test performance.


Closing Thoughts

By starting with server performance analysis and moving through backend optimization, Ajax tuning, and client-side checks, you’ll be able to pinpoint the bottleneck. Remember, tools like AWS CloudWatch and DevTools are your best friends here.

Once you’ve reviewed these areas, let us know your findings—I'm happy to help you dig deeper!


Good luck on your debugging, Sanjay! Looking forward to hearing about your progress. 😊

Cheers, Aaron 🌟

回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

関連するコンテンツ