This guide teaches you how to analyse website lag when server resources are at typical levels. Assume that even though the server resources are being used normally (less than 30–40%), a website still operates more slowly. In that case, the problem can be with aspects of application performance, configuration, or network problems rather than the actual server resources. Analyse your website performance with the potential issues given below.
Causes of slowdown:
- Database Performance Issues:
- Slow Queries: Even if the server is not fully utilised, database queries may be inefficient or poorly indexed. Complex queries or missing indexes can significantly slow down response times.
- Database Connection Pooling: If your application frequently opens new database connections and does not reuse them (poor connection pooling), it can cause delays.
- Locks/Deadlocks: Concurrent access to the database can cause locking or deadlocks, which can lead to delays in processing requests.
- Application Code Inefficiencies:
- Memory Leaks: Your application may be consuming memory unnecessarily over time, which can cause it to slow down, even if overall system memory usage is low.
- Slow Loops or Inefficient Algorithms: Application code that uses inefficient algorithms or has unnecessary loops can consume resources more slowly.
- Unoptimised File Handling: If your application frequently reads/writes files or handles large file transfers without optimisation, it can cause delays.
- Synchronous Operations: If your application uses synchronous operations (such as waiting for external APIs or services to respond), this can cause the server to become unresponsive even if resources are underutilised.
- Web Server or Configuration Issues:
- Incorrect IIS or Apache Configuration: Misconfigurations like restricting concurrent requests or excessive throttling can lead to delays
- Large Number of Simultaneous Requests: Even at 30% capacity, too many concurrent requests can slow the web server, especially if it is not optimised for concurrency.
- HTTP Request/Response Overhead: If response headers, cookies, or requests are too large, they can increase overhead and slow processing time.
- Compression Settings: Missing or improper HTTP compression (e.g., GZIP) can increase load times for assets like CSS, JavaScript, and images.
- Caching Issues:
- Lack of Caching: If caching is not properly configured on the server or client side, the server may repeatedly process the same requests, leading to slowness.
- Stale Cache: If cached data is not updated properly, it may cause the application to serve outdated data, increasing response time.
- Network or External Service Bottlenecks:
- Slow External API Calls: If your application relies on external services or APIs and they are slow or experiencing delays, the application’s performance can degrade.
- Network Latency: High network latency from location, routing, or infrastructure issues can slow loading times, even if the server is fine.
- DNS Issues: Slow DNS resolution can add delays to initial requests to the website.
- Content Delivery Network (CDN) Issues:
- CDN Misconfiguration: CDN issues like caching errors or node failures can slow page loads, even when using services like Cloudflare or Akamai.
- Content Not Cached Properly: If the CDN does not cache assets correctly, the server handles more requests than necessary
- Browser or Front-End Issues:
- JavaScript Execution: Large or inefficient JavaScript files that block rendering or cause reflows can slow page load times.
- Heavy CSS or Images: Unoptimised or oversized CSS, images, or other assets (like fonts) can slow down page rendering.
- Front-End Frameworks: Heavy front-end frameworks like Angular or React can slow your site due to issues like memory leaks or inefficient data binding
- Concurrency and Threading Issues:
- Thread Contention: Poor thread management, such as multiple requests accessing shared resources simultaneously, can lead to performance bottlenecks.
- Blocking Operations: Synchronous calls to databases or services can block threads, making the server seem slow despite low CPU usage.
- Content Size and HTTP Requests:
- Large Response Size: Sending large files (e.g., images, HTML, or scripts) can increase load times.
- Excessive HTTP Requests: A high number of resource requests (scripts, images, stylesheets) can slow page loads due to connection overhead.
- Inefficient Load Balancing (if applicable):
- Misconfigured Load Balancer: Uneven request distribution can overload some servers while others remain underutilised, leading to inefficiencies.
- Traffic or Usage Spikes:
- DDoS Attacks or Bot Traffic: Even if server resource utilisation seems low, malicious traffic like DDoS attacks or bots can overwhelm the system with requests, impacting performance
- Legitimate Traffic Peaks: A sudden surge in legitimate users can slow the system, even if resources are not fully utilised.
Troubleshooting Steps:
- Check Application Performance: Use profilers like Visual Studio Profiler, New Relic, or JetBrains dotTrace to monitor and optimise application code.
- Monitor Database Queries: Use database performance tools like SQL Profiler or slow query logs to identify bottlenecks in queries.
- Analyse Web Server Logs: Review IIS logs or Apache logs for errors or slow response times.
- Profile Network Latency: Use network monitoring tools to check for external latency or DNS issues.
- Use a CDN Effectively: Ensure your CDN is caching assets correctly and has no configuration issues.
- Optimise Front-End Assets: Use tools like Google PageSpeed Insights or Lighthouse to analyse and optimise front-end resources.
By identifying and addressing these issues, you can analyse and improve your website’s performance, even when server resources are under 30% utilisation.
Hope you liked our article! For more such informative articles, follow our KB section regularly.
If you need to adjust resource limits for better performance, refer to our guide How to edit resource limits in WHM