<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ktls on Ubuntu Tips</title><link>https://ubuntips.com/tags/ktls/</link><description>Recent content in Ktls on Ubuntu Tips</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Thu, 26 Nov 2026 06:13:03 +0800</lastBuildDate><atom:link href="https://ubuntips.com/tags/ktls/index.xml" rel="self" type="application/rss+xml"/><item><title>kTLS with nginx: 44 % less CPU on big files, and a 200 ms stall</title><link>https://ubuntips.com/posts/ktls-with-nginx-and-a-200-ms-stall/</link><pubDate>Thu, 26 Nov 2026 06:00:00 +0800</pubDate><guid>https://ubuntips.com/posts/ktls-with-nginx-and-a-200-ms-stall/</guid><description>&lt;p&gt;With kernel TLS, nginx and OpenSSL do the handshake as usual and then hand the session keys to the kernel. From then on the kernel encrypts. That lets nginx use &lt;code&gt;sendfile()&lt;/code&gt; on HTTPS too, so file data never passes through user space. The usual claim is a big CPU saving on static files.&lt;/p&gt;&#10;&lt;p&gt;Turning it on takes three things:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;OpenSSL built with &lt;code&gt;enable-ktls&lt;/code&gt;. My build tool now has &lt;code&gt;KTLS=1&lt;/code&gt; for that.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;ssl_conf_command Options KTLS;&lt;/code&gt; and &lt;code&gt;sendfile on;&lt;/code&gt; in nginx.&lt;/li&gt;&#10;&lt;li&gt;The &lt;code&gt;tls&lt;/code&gt; kernel module.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;I used the harness from &lt;a href="https://ubuntips.com/posts/nginx-with-openssl-aws-lc-or-boringssl/"&gt;the TLS-library post&lt;/a&gt;, with OpenSSL 3.5 and 4.1, each with and without kTLS.&lt;/p&gt;</description></item></channel></rss>