comparison src/event/ngx_event_openssl.h @ 8078:5244d3b165ff

SSL: single allocation in session cache on 32-bit platforms. Given the present typical SSL session sizes, on 32-bit platforms it is now beneficial to store all data in a single allocation, since rbtree node + session id + ASN1 representation of a session takes 256 bytes of shared memory (36 + 32 + 150 = about 218 bytes plus SNI server name). Storing all data in a single allocation is beneficial for SNI names up to about 40 characters long and makes it possible to store about 4000 sessions in one megabyte (instead of about 3000 sessions now). This also slightly simplifies the code.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 12 Oct 2022 20:14:40 +0300
parents 38c71f9b2293
children bf02161f291e
comparison
equal deleted inserted replaced
8077:ec1fa010c3a5 8078:5244d3b165ff
132 132
133 typedef struct ngx_ssl_sess_id_s ngx_ssl_sess_id_t; 133 typedef struct ngx_ssl_sess_id_s ngx_ssl_sess_id_t;
134 134
135 struct ngx_ssl_sess_id_s { 135 struct ngx_ssl_sess_id_s {
136 ngx_rbtree_node_t node; 136 ngx_rbtree_node_t node;
137 u_char *id;
138 size_t len; 137 size_t len;
139 u_char *session;
140 ngx_queue_t queue; 138 ngx_queue_t queue;
141 time_t expire; 139 time_t expire;
140 u_char id[32];
142 #if (NGX_PTR_SIZE == 8) 141 #if (NGX_PTR_SIZE == 8)
143 void *stub; 142 u_char *session;
144 u_char sess_id[32]; 143 #else
144 u_char session[1];
145 #endif 145 #endif
146 }; 146 };
147 147
148 148
149 typedef struct { 149 typedef struct {