Jump to content

TTFB being too high


Recommended Posts

Hello,

My current TTFB for the main page is too high vXBzTus.png

 

My current config for nginx is this one

user  nginx;
pid   /var/run/nginx.pid;
worker_processes  auto;
worker_rlimit_nofile 1024;
worker_priority   -10;

events {
    worker_connections  1024;
    multi_accept on;
    use epoll;
}


http {

    ##
    # Basic Settings
    ##
    default_type        application/octet-stream;
    keepalive_timeout   10;
    keepalive_requests 1024;

    sendfile        on;

    set_real_ip_from 103.21.244.0/22;
    set_real_ip_from 103.22.200.0/22;
    set_real_ip_from 103.31.4.0/22;
    set_real_ip_from 104.16.0.0/12;
    set_real_ip_from 108.162.192.0/18;
    set_real_ip_from 131.0.72.0/22;
    set_real_ip_from 141.101.64.0/18;
    set_real_ip_from 162.158.0.0/15;
    set_real_ip_from 172.64.0.0/13;
    set_real_ip_from 173.245.48.0/20;
    set_real_ip_from 188.114.96.0/20;
    set_real_ip_from 190.93.240.0/20;
    set_real_ip_from 197.234.240.0/22;
    set_real_ip_from 198.41.128.0/17;
    set_real_ip_from 2400:cb00::/32;
    set_real_ip_from 2606:4700::/32;
    set_real_ip_from 2803:f800::/32;
    set_real_ip_from 2405:b500::/32;
    set_real_ip_from 2405:8100::/32;
    set_real_ip_from 2c0f:f248::/32;
    set_real_ip_from 2a06:98c0::/29;
    real_ip_header CF-Connecting-IP;


    ##
    # Logging Settings
    ##
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log;
    error_log   /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##
    gzip on;
    gzip_disable "msie6";
    gzip_vary on;
    gzip_comp_level 2;
    gzip_buffers 4 8k;
    gzip_min_length 1024;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/plain application/javascript application/x-javascript text/xml text/css application/json;



    client_body_buffer_size 1m;
    client_header_buffer_size 1k;
    client_max_body_size 50M;
    large_client_header_buffers 4 4k;
    client_body_timeout 15;
    client_header_timeout 15;
    send_timeout 15;


    open_file_cache max=20000 inactive=20s;
    open_file_cache_valid 60s;
    open_file_cache_min_uses 5;
    open_file_cache_errors on;
    tcp_nopush on;
    tcp_nodelay on;


    fastcgi_buffers 256 16k;
    fastcgi_buffer_size 128k;
    fastcgi_connect_timeout 3s;
    fastcgi_send_timeout 120s;
    fastcgi_read_timeout 120s;
    fastcgi_busy_buffers_size 129k;
    fastcgi_temp_file_write_size 256k;
    reset_timedout_connection on;
    server_names_hash_bucket_size 100; 

    ##
    # Configuration Includes
    ##
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

}

And php-fpm's config is the exact one posted by Makoto here

I use NGINX + PHP-FPM + OPCACHE +MariaDB + Redis + Cloudflare + Wasabi

The TTFB times vary from 800ms to 1200ms for the main page. Would anyone have any suggestions as to what I can do to decrease that? Also feel free to ask if you require any more information to check.

 

VPS Specs:

Eight cores Intel® Xeon® E5-2630v4

30 GB Ram

800 GB SSD

Ubuntu 18.04

Link to comment
Share on other sites

Yes, a very long waiting time.
How many html size does your site create
Do you use a guest cache page?
It is possible for some of your applications to create a server delay in the creation of html.
You can test your server with a simple html file in the root directory and compare the same time waiting server response.

Link to comment
Share on other sites

12 minutes ago, Adlago said:

Yes, a very long waiting time.
How many html size does your site create
Do you use a guest cache page?
It is possible for some of your applications to create a server delay in the creation of html.
You can test your server with a simple html file in the root directory and compare the same time waiting server response.

0vfwRxT.png

Yes, I use guest cache page with Redis, 5 days cache.

138ms TTFB for a "hello world" html page on the root directory 7oVW6B4.png

 

19 minutes ago, Steph40 said:

@Jock3r Test with this and post result.

https://www.bytecheck.com/

There is many factors to consider, example, where you are located and where you are located.  I personally prefer centos for server and I install centminmod: 

https://centminmod.com/ 

Without knowing you website, can't do much.

The website is currently under development so it's set as offline. Not released yet but I could PM you if you want to take a look further.

Link to comment
Share on other sites

On 3/18/2020 at 12:54 AM, Jock3r said:

The website is currently under development so it's set as offline. Not released yet but I could PM you if you want to take a look further.

Is your installation set to IN_DEV, or is the designers mode active? The former will definitely result in a higher TTFB, not sure about the latter but I guess that affects it too. 

A 5 day guest cache will cause your Redis cache size to explode by the way. That's the amount of time the HTML result for every single page visited by a guest will be stored in your memory. Not only will your cache size be enormous, but everything a guest see will be very outdated.

Since you are in development and don't have much traffic yet, you won't take much advantage of what the CloudFlare cache have to offer. Don't think that will affect the TTFB, but it will affect the total load time.

Link to comment
Share on other sites

1 hour ago, Martin A. said:

Is your installation set to IN_DEV, or is the designers mode active? The former will definitely result in a higher TTFB, not sure about the latter but I guess that affects it too. 

A 5 day guest cache will cause your Redis cache size to explode by the way. That's the amount of time the HTML result for every single page visited by a guest will be stored in your memory. Not only will your cache size be enormous, but everything a guest see will be very outdated.

Since you are in development and don't have much traffic yet, you won't take much advantage of what the CloudFlare cache have to offer. Don't think that will affect the TTFB, but it will affect the total load time.

Sorry my bad regarding the cache thing, I actually meant 5 minutes. I have neither enabled, I managed to find out what was the issue. An application I was using was causing that, made it load messages on ajax and that fixed it. TTFB now ranges from 400 to 750.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...