# Keepalive\_timeout timeout causes high TTFB

**URL:** <https://www.ruby-forum.com/t/keepalive-timeout-timeout-causes-high-ttfb/242778>\
**Category:** NGINX\
**Created:** [July 24, 2015, 3:41pm UTC](https://www.ruby-forum.com/t/keepalive-timeout-timeout-causes-high-ttfb/242778 "2015-07-24T15:41:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [July 24, 2015, 3:41pm UTC](https://www.ruby-forum.com/t/keepalive-timeout-timeout-causes-high-ttfb/242778/1 "2015-07-24T15:41:11Z")

</div>

I am trying to further optimize SSL but if i enable keepalive\_timeout i  
get  
high TTFB as shown in the report below

> **[Pingdom Tools](https://tools.pingdom.com)**
>
> Full Page Test Analysis

When i disable keepalive\_timeout , TTFB is fixed but nginx recommand  
keepalive\_timeout :  
[http://nginx.org/en/docs/http/configuring\_https\_servers.html](http://nginx.org/en/docs/http/configuring_https_servers.html)

Why does this happen ?

I welcome any other advice to further optimise SSL

Thanks

listen 443 spdy default\_server reuseport;  
ssl on;  
ssl\_certificate /etc/ssl/filterbypass.me.crt; #(or .pem)  
ssl\_certificate\_key /etc/ssl/filterbypass.me.key.nopass;  
ssl\_protocols TLSv1 TLSv1.1 TLSv1.2;  
#keepalive\_timeout 70;  
#ssl\_ciphers  
ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM;  
ssl\_ciphers  
ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;  
ssl\_prefer\_server\_ciphers on;  
ssl\_buffer\_size 8k;  
ssl\_session\_cache shared:SSL:20m;  
ssl\_dhparam /etc/ssl/dhparam.pem;  
ssl\_session\_timeout 45m;  
ssl\_stapling on;  
ssl\_stapling\_verify on;  
ssl\_trusted\_certificate /etc/ssl/trustchain.crt;  
resolver 8.8.8.8 8.8.4.4 valid=300s;  
resolver\_timeout 5s;  
add\_header Strict-Transport-Security “max-age=31536000;  
includeSubDomains”;

Posted at Nginx Forum:

> **[keepalive\_timeout timeout causes high TTFB](https://forum.nginx.org/read.php?2,260541,260541#msg-260541)**
>
> I am trying to further optimize SSL but if i enable keepalive\_timeout i get high TTFB as shown in the report below http://tools.pingdom.com/fpt/#!/KggzF When i disable keepalive\_timeout , TTFB is fixed but nginx recommand keepalive\_timeout :...

---

<div class="post-metadata">

**Author:** ![khav](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e56c9b/32.png) [@khav](https://www.ruby-forum.com/u/khav)\
**Post date:** [July 24, 2015, 4:30pm UTC](https://www.ruby-forum.com/t/keepalive-timeout-timeout-causes-high-ttfb/242778/2 "2015-07-24T16:30:52Z")

</div>

On Friday 24 July 2015 09:40:40 khav wrote:

> I am trying to further optimize SSL but if i enable keepalive\_timeout i get  
> high TTFB as shown in the report below
> 
> [Website Speed Test | Pingdom Tools](http://tools.pingdom.com/fpt/#!/KggzF)
> 
> When i disable keepalive\_timeout , TTFB is fixed but nginx recommand  
> keepalive\_timeout :  
> [Configuring HTTPS servers](http://nginx.org/en/docs/http/configuring_https_servers.html)
> 
> Why does this happen ?  
> [..]

In the report above SPDY protocol was used, but the keepalive\_timeout  
directive configures a timeout for https keepalive connections, and  
has no effect with SPDY.

I believe it was just a coincidence, and big TTFB caused by something  
else.

wbr, Valentin V. Bartenev
