mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
MINOR: compression: always create the compression pool
Surprisingly, the compression pool was created at runtime on first use, which is not very convenient, has performance and reliability impacts, and even makes monitoring less easy. Let's move the pool creation at startup time instead. This even removes the need for the spinlock in case USE_ZLIB is not defined.
This commit is contained in:
parent
3bfcd10218
commit
e548974ca8
@ -40,7 +40,7 @@
|
|||||||
#include <proto/stream.h>
|
#include <proto/stream.h>
|
||||||
|
|
||||||
|
|
||||||
#if defined(USE_SLZ) || defined(USE_ZLIB)
|
#if defined(USE_ZLIB)
|
||||||
__decl_hathreads(static HA_SPINLOCK_T comp_pool_lock);
|
__decl_hathreads(static HA_SPINLOCK_T comp_pool_lock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -158,13 +158,6 @@ static inline int init_comp_ctx(struct comp_ctx **comp_ctx)
|
|||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (unlikely(pool_comp_ctx == NULL)) {
|
|
||||||
HA_SPIN_LOCK(COMP_POOL_LOCK, &comp_pool_lock);
|
|
||||||
if (unlikely(pool_comp_ctx == NULL))
|
|
||||||
pool_comp_ctx = create_pool("comp_ctx", sizeof(struct comp_ctx), MEM_F_SHARED);
|
|
||||||
HA_SPIN_UNLOCK(COMP_POOL_LOCK, &comp_pool_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
*comp_ctx = pool_alloc(pool_comp_ctx);
|
*comp_ctx = pool_alloc(pool_comp_ctx);
|
||||||
if (*comp_ctx == NULL)
|
if (*comp_ctx == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
@ -716,6 +709,11 @@ static void __comp_fetch_init(void)
|
|||||||
slz_make_crc_table();
|
slz_make_crc_table();
|
||||||
slz_prepare_dist_table();
|
slz_prepare_dist_table();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_ZLIB) || defined(USE_SLZ)
|
||||||
|
pool_comp_ctx = create_pool("comp_ctx", sizeof(struct comp_ctx), MEM_F_SHARED);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(USE_ZLIB) && defined(DEFAULT_MAXZLIBMEM)
|
#if defined(USE_ZLIB) && defined(DEFAULT_MAXZLIBMEM)
|
||||||
global.maxzlibmem = DEFAULT_MAXZLIBMEM * 1024U * 1024U;
|
global.maxzlibmem = DEFAULT_MAXZLIBMEM * 1024U * 1024U;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user