Add new tunable "tune.ssl.maxrecord".
Over SSL/TLS, the client can decipher the data only once it has received
a full record. With large records, it means that clients might have to
download up to 16kB of data before starting to process them. Limiting the
record size can improve page load times on browsers located over high
latency or low bandwidth networks. It is suggested to find optimal values
which fit into 1 or 2 TCP segments (generally 1448 bytes over Ethernet
with TCP timestamps enabled, or 1460 when timestamps are disabled), keeping
in mind that SSL/TLS add some overhead. Typical values of 1419 and 2859
gave good results during tests. Use "strace -e trace=write" to find the
best value.
This trick was first suggested by Mike Belshe :
http://www.belshe.com/2010/12/17/performance-and-the-tls-record-size/
Then requested again by Ilya Grigorik who provides some hints here :
http://ofps.oreilly.com/titles/
9781449344764/_transport_layer_security_tls.html#ch04_00000101
- tune.sndbuf.client
- tune.sndbuf.server
- tune.ssl.cachesize
+ - tune.ssl.lifetime
+ - tune.ssl.maxrecord
- tune.zlib.memlevel
- tune.zlib.windowsize
lifetime. The real usefulness of this setting is to prevent sessions from
being used for too long.
+tune.ssl.maxrecord <number>
+ Sets the maximum amount of bytes passed to SSL_write() at a time. Default
+ value 0 means there is no limit. Over SSL/TLS, the client can decipher the
+ data only once it has received a full record. With large records, it means
+ that clients might have to download up to 16kB of data before starting to
+ process them. Limiting the value can improve page load times on browsers
+ located over high latency or low bandwidth networks. It is suggested to find
+ optimal values which fit into 1 or 2 TCP segments (generally 1448 bytes over
+ Ethernet with TCP timestamps enabled, or 1460 when timestamps are disabled),
+ keeping in mind that SSL/TLS add some overhead. Typical values of 1419 and
+ 2859 gave good results during tests. Use "strace -e trace=write" to find the
+ best value.
+
tune.zlib.memlevel <number>
Sets the memLevel parameter in zlib initialization for each session. It
defines how much memory should be allocated for the intenal compression
#ifdef USE_OPENSSL
int sslcachesize; /* SSL cache size in session, defaults to 20000 */
unsigned int ssllifetime; /* SSL session lifetime in seconds */
+ unsigned int ssl_max_record; /* SSL max record size */
#endif
#ifdef USE_ZLIB
int zlibmemlevel; /* zlib memlevel */
global.tune.ssllifetime = ssllifetime;
}
+ else if (!strcmp(args[0], "tune.ssl.maxrecord")) {
+ if (*(args[1]) == 0) {
+ Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
+ global.tune.ssl_max_record = atol(args[1]);
+ }
#endif
else if (!strcmp(args[0], "tune.bufsize")) {
if (*(args[1]) == 0) {
*/
while (buf->o) {
try = buf->o;
+
+ if (global.tune.ssl_max_record && try > global.tune.ssl_max_record)
+ try = global.tune.ssl_max_record;
+
/* outgoing data may wrap at the end */
if (buf->data + try > buf->p)
try = buf->data + try - buf->p;