Skip to content

High CPU usage when number of requests are higher

0

Hi Team

Our site is a wordpress site and used cloudfront CDN. We observe high cpu usage when multiple users are making requests. we tested using Locust tool. What can we do to improve the cpu utilization? This situation occurred after we configure the cloudfront. In theory CDN should reduce the cpu usage if i'm not mistaken.

Enter image description here

Awaiting a favorable response

Best Regards

1 Answer
2

I understand your concern about high CPU usage with your WordPress site using CloudFront CDN, especially when multiple users are making requests. You're correct that in theory, a CDN should help reduce CPU usage on your origin server. However, there are several factors to consider and steps you can take to improve the situation:

  1. Optimize your cache hit ratio: Ensure that CloudFront is caching as much content as possible. A higher cache hit ratio means fewer requests reach your origin server, reducing CPU load. You can do this by:

    • Configuring appropriate caching behaviors in CloudFront
    • Setting proper Cache-Control headers on your origin
    • Using CloudFront Origin Shield for an additional caching layer
  2. Enable CloudFront Origin Shield: This feature provides an additional caching layer that can significantly reduce the load on your origin server, especially during traffic spikes.

  3. Use WordPress-specific protections: CloudFront offers WordPress-specific security rules through AWS WAF. These can help protect your site from common WordPress vulnerabilities and reduce unnecessary load on your server.

  4. Implement rate limiting: Configure rate limiting rules in CloudFront to protect your origin from HTTP floods, which can cause high CPU usage. Start by monitoring the rate of requests and then set appropriate limits.

  5. Review your WordPress configuration: Ensure your WordPress site is optimized for performance. This includes using caching plugins, optimizing databases, and minimizing plugin usage.

  6. Check origin server capacity: If your origin server is undersized, it may struggle with the traffic even with CloudFront in place. Consider scaling up your server resources if necessary.

  7. Analyze request patterns: Use CloudFront's request logs to identify any unusual traffic patterns or specific requests causing high CPU usage. This can help you pinpoint and address specific issues.

  8. Fine-tune CloudFront settings: Adjust your CloudFront distribution settings to optimize for your specific WordPress setup. This might include tweaking caching behaviors, TTL settings, and origin request policies.

By implementing these measures, you should be able to reduce the CPU usage on your origin server and better leverage the benefits of CloudFront CDN for your WordPress site. Monitor your performance metrics after making these changes to ensure improvement.
Sources
Caching and availability - Amazon CloudFront
Increase the proportion of requests that are served directly from the CloudFront caches (cache hit ratio) - Amazon CloudFront
Amazon CloudFront - AWS Best Practices for DDoS Resiliency
Introducing CloudFront Security Dashboard, a Unified CDN and Security Experience | Networking & Content Delivery

answered a year ago
EXPERT
reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.