Report this

What is the reason for this report?

slow response times

Posted on July 17, 2020

Hello,

I’m the owner of https://www.dijitalsat.com/ Before moving to DO we had 4 seconds max page load times and currently only server response time is 2 - 3 seconds and page loads in 10-15 . I’ve checked everything regarding to Apache2, Mysql and PHP with no luck. We are running on Centos 7, SSH panel with Apache2.

Thanks



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there @onderdigiturk,

I’ve run a quick scan with Pingdom, and it looks quite good:

https://tools.pingdom.com/#5cd760e549000000

The load time is around ~1.8 seconds and the server response time is less than 1 second.

There are a few things that you need to take into consideration:

  • Add Expires headers
  • Use cookie-free domains
  • Compress components with gzip
  • Make fewer HTTP requests

I believe that if you work on the things above the load time would drop even more.

Hope that this helps! Regards, Bobby

For anyone stumbling upon this one like me, here is a detailed response.

High page load times can be frustrating, especially when it impacts user experience and SEO. Since you’ve migrated to DigitalOcean and are experiencing increased load times, we can explore several areas to diagnose and hopefully resolve these issues. You’ve mentioned checking Apache2, MySQL, and PHP configurations, but I’ll provide a comprehensive checklist that covers various aspects potentially impacting the performance:

1. Server Resources

  • Check Server Utilization: Ensure your server has adequate resources (CPU, RAM) to handle the traffic and operations. Use tools like htop or top to monitor usage.
  • Disk I/O: Check if disk I/O is a bottleneck. Slow disk performance can drastically increase load times. Tools like iostat can be helpful.

2. Apache Configuration

  • Optimize Apache Settings: Review settings like MaxKeepAliveRequests, KeepAliveTimeout, and MaxClients. Adjust these based on your server’s capability and traffic.
  • Use Event MPM: If not already, consider switching to Event MPM for Apache which is better for handling multiple requests, especially under heavy load. ``bash sudo yum install httpd-event sudo a2dismod mpm_prefork sudo a2enmod mpm_event
### 3. **Database Optimization**

-   **Slow Queries**: Check for slow queries that can delay the response time. Tools like MySQL’s slow query log can be useful.
-   **Optimize Tables**: Regularly optimize your database tables.

```sql
OPTIMIZE TABLE tablename;
  • Connection Overhead: Check if persistent connections help reduce connection overhead.

4. PHP Configuration

  • OPcache: Ensure OPcache is enabled and properly configured. It can dramatically improve PHP performance by storing precompiled script bytecode.
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
  • Realpath Cache: Configure realpath_cache_size and realpath_cache_ttl for performance improvements in script loading.
realpath_cache_size = 4096k
realpath_cache_ttl = 7200

. Content Delivery Network (CDN)

  • Implement a CDN: If not already using a CDN, consider implementing one. CDNs can greatly reduce load times by serving static content from locations closer to the user.

6. Caching Implementation

  • HTTP Caching: Set appropriate Expires headers for static resources.
  • Application-Level Caching: Use caching solutions like Redis or Memcached for dynamic content if your application supports it.

7. Network Issues

  • Check DNS Response Times: Slow DNS resolution can increase load times. Consider using a faster DNS provider.
  • Data Center Location: Ensure your server is geographically close to your primary user base to minimize latency.

8. Profiling and Debugging Tools

  • Use Profiling Tools: Tools like New Relic or Apache’s mod_status can provide insights into what’s happening on your server.
  • Check Error Logs: Review Apache, PHP, and system logs for any errors or warnings that could indicate problems.

9. Web Application Issues

  • Code Optimization: Review your web application’s code. Poorly optimized code or plugins/themes (especially in CMSs like WordPress) can degrade performance.
  • External Services: Check if your site is making excessive or slow external API calls.

10. SSL/TLS Overhead

  • Optimize SSL/TLS: Use protocols like HTTP/2 to minimize the number of connections and enhance the loading time.

Action Steps

  • Benchmark: Before and after making changes, benchmark your site using tools like GTmetrix, Google PageSpeed Insights, or WebPageTest to measure improvements.
  • Staging Environment: Test changes in a staging environment before deploying to production to ensure stability.

By systematically going through these steps and making optimizations, you should be able to identify and mitigate the factors contributing to the high load times of your website on DigitalOcean.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.