• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Optimize Nginx TLS Record Size For HTTP/2 TLS (Ubuntu, CentOS)

By Abhishek Ghosh October 13, 2016 10:55 am Updated on October 13, 2016

Optimize Nginx TLS Record Size For HTTP/2 TLS (Ubuntu, CentOS)

Advertisement

Previously we published some guides on optimising HTTP/2. Here is How to Optimize Nginx TLS Record Size For HTTP/2 TLS in Ubuntu & CentOS For Better PageLoading Speed. Easy to Follow Guide By Anyone.
We are taking it granted that the user who is reading is using Nginx either on CentOS from CentminMod build or using Ubuntu’s nginx-extras.

 

What You Exactly Say While Talking To Optimize Nginx TLS Record Size?

 

We promise that we will not deliver theory on TCP or TLS. We are talking around ssl_buffer_size size directive of Nginx configuration.

On the Internet data are transmitted using a multilayer protocol stack. We are interested in the area of TCP and TLS. TCP reliably deliver packets in the original order. If we have a service like HTTPS, then all encrypted TLS data will be sent via TCP. At the level of TCP, upon whitelisting a connection, the server may send no more than 3 packets for the old and 10 initcwnd packets. Then the server will wait for an acknowledgment from the client. Nginx uses a special buffer (which is indicated by the directive ssl_buffer_size), which controls the size of the TLS record. The browser can use the data only after receiving a complete TLS record. The maximum default size in Nginx of that ssl_buffer_size is 16k. Taking the opportunity of 10, this can cause minute delay in obtaining useful content.

Advertisement

---

Some associates HTTP/2 with ALPN with tweaking the directive http2_chunk_size. By default it is 8k. That is not exactly correct. But obviously, end result as TTFB will get affected.

optimize-nginx-tls-record-size-for-http-2-tls

 

Optimize Nginx TLS Record Size For HTTP/2 TLS (Ubuntu, CentOS)

 

Cloudflare has patch for supporting dynamic record sizing with Nginx, obviously it is useful if you are compiling Nginx from source. That is easiest in case of using CentminMod :

Vim
1
https://github.com/cloudflare/sslconfig/tree/master/patches

nginx-extras package do support change of Nginx TLS Record Size aka ssl_buffer_size size as default function. Cloudflare patch adds the dynamic function. You can actually control it.

ssl_dyn_rec_size_lo indicates what TLS record size to start with which defaults to 1369 bytes. ssl_dyn_rec_size_hi indicates what TLS record size will grow to which defaults to 4229 bytes.
ssl_dyn_rec_threshold is the number of records to be send before changing the record size. ssl_dyn_rec_timeout dynamically reduces the size to ssl_dyn_rec_size_lo if there is idling. If this value is 0 then dynamic TLS record sizes are disabled and the fixed ssl_buffer_size will be used. There is no way of tuning of the ssl_dyn_rec settings. To enable with default settings, you would (may) need to set the following directive ssl_dyn_rec_enable on;. Nginx hardcodes 16KB size in ngx_event_openssl but with nginx-extras, you can actually adjust ssl_buffer_size. It is directly related to processor, hence cipher :

Vim
1
2
http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_buffer_size
https://software.intel.com/en-us/articles/improving-openssl-performance

When using OpenSSL 1.0.2 or higher, it is possible to specify multiple curves (1.11.0), for example:

Vim
1
ssl_ecdh_curve prime256v1:secp384r1;

We will suggest you to test with :

Vim
1
ssl_buffer_size 4k;

When ssl_buffer_size set to lower than default 16k value i.e. ssl_buffer_size is set to 1400 bytes, first byte should load just faster. ssl_buffer_size 6 to 8k is more than enough to ensure a minimum TTFB in most cases.

For different devices and also test higher value like :

Vim
1
ssl_buffer_size 64k;

We think, this much is enough for most of the common users.

 

How To Test and Optimize Nginx TLS Record Size?

 

Wireshark is a network protocol analyser which can be difficult to use by an ordinary user. We will suggest to allow some time (for cache) after change and test on WebPageTest. Obviously, this website as example never depends on ONLY this website’s domain and server. Time to First Byte of 60 ms to 80 ms is acceptable. Obviously if we load a plain text on this domain, it will load within a second! Actually PageSpeed Insights is overall practical. You are running to optimize Nginx TLS record size but your CSS is blocking – that is not acceptable.

Tagged With http2_chunk_size , nginx database optimize ttfb , nginx ssl buffer size http2 , nginx tls dynamic record size , optimize nginx ssl , paperuri:(2099935beaeb22e2fc49159d763faca0) , ssl_buffer_size 64k downloads
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Optimize Nginx TLS Record Size For HTTP/2 TLS (Ubuntu, CentOS)

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • Optimizing Nginx HTTP/2 TLS : Basic Principles

    We hope that most of the readers are using latest version of deb GNU/Linux (like Ubuntu 16.04 LTS) or latest CentOS which fully supports HTTP/2. In case you are using Ubuntu 14.04 or older Ubuntu, please read our old guide to upgrade your server to make compatible with HTTP/2. This Article on Optimizing Nginx HTTP/2 TLS […]

  • Steps To Install Nginx Plus on Ubuntu Server (HP Cloud)

    Here Are the Steps To Install Nginx Plus on Ubuntu Server Running on HP Cloud. Nginx Plus is the Paid Version of Nginx with Extra Features.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Market ShareNovember 29, 2023
  • Affiliate Marketing Condition/Commission ModelsNovember 28, 2023
  • How Affiliate Marketing WorksNovember 28, 2023
  • Phases of Product DevelopmentNovember 27, 2023
  • Sub-Areas of Direct MarketingNovember 27, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy