diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2022-10-12 20:14:40 +0300 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2022-10-12 20:14:40 +0300 |
| commit | 76876c160f6f66a1f906a74649f1242844d2b910 (patch) | |
| tree | 4d00e96e163193e6337b0f0a8baa00ed3b3d836e /src/event/ngx_event_openssl.h | |
| parent | 5c5c449ba0ba12708d2c9d121d46426eeaf911da (diff) | |
| download | nginx-76876c160f6f66a1f906a74649f1242844d2b910.tar.gz nginx-76876c160f6f66a1f906a74649f1242844d2b910.tar.bz2 | |
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.
Diffstat (limited to 'src/event/ngx_event_openssl.h')
| -rw-r--r-- | src/event/ngx_event_openssl.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h index 4d005ed75..2f12aab90 100644 --- a/src/event/ngx_event_openssl.h +++ b/src/event/ngx_event_openssl.h @@ -134,14 +134,14 @@ typedef struct ngx_ssl_sess_id_s ngx_ssl_sess_id_t; struct ngx_ssl_sess_id_s { ngx_rbtree_node_t node; - u_char *id; size_t len; - u_char *session; ngx_queue_t queue; time_t expire; + u_char id[32]; #if (NGX_PTR_SIZE == 8) - void *stub; - u_char sess_id[32]; + u_char *session; +#else + u_char session[1]; #endif }; |
