Browse Source

[core] server.chunkqueue-chunk-sz = 4096

server.chunkqueue-chunk-sz = 4096 (default)
Can be configured any integral value greater than 0.
Value is rounded up to next 1024 if not an even multiple of 1k.

Sites with large request or response headers may benefit from
an 8k or 16k chunk size.  Embedded systems might choose to minimize
memory use by using a 1k chunk size.
personal/stbuehler/fix-fdevent
Glenn Strauss 4 years ago
parent
commit
70d7d0a0a1
  1. 5
      src/chunk.c
  2. 1
      src/chunk.h
  3. 8
      src/configfile.c

5
src/chunk.c

@ -31,6 +31,11 @@ static chunk *chunk_buffers;
static array *chunkqueue_default_tempdirs = NULL;
static unsigned int chunkqueue_default_tempfile_size = DEFAULT_TEMPFILE_SIZE;
void chunkqueue_set_chunk_size (size_t sz)
{
chunk_buf_sz = sz > 0 ? ((sz + 1023) & ~1023uL) : 4096;
}
void chunkqueue_set_tempdirs_default_reset (void)
{
chunkqueue_default_tempdirs = NULL;

1
src/chunk.h

@ -54,6 +54,7 @@ void chunkqueue_chunk_pool_clear(void);
void chunkqueue_chunk_pool_free(void);
chunkqueue *chunkqueue_init(void);
void chunkqueue_set_chunk_size (size_t sz);
void chunkqueue_set_tempdirs_default_reset (void);
void chunkqueue_set_tempdirs_default (array *tempdirs, unsigned int upload_temp_file_size);
void chunkqueue_append_file(chunkqueue *cq, buffer *fn, off_t offset, off_t len); /* copies "fn" */

8
src/configfile.c

@ -175,6 +175,7 @@ static int config_insert(server *srv) {
int ret = 0;
buffer *stat_cache_string;
array *http_parseopts;
unsigned int chunk_sz = 0;
config_values_t cv[] = {
{ "server.bind", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 0 */
@ -236,7 +237,7 @@ static int config_insert(server *srv) {
{ "server.upload-dirs", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_SERVER }, /* 45 */
{ "server.core-files", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 46 */
{ "server.compat-module-load", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 47 */
{ "unused-slot-moved-to-mod-openssl", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 48 */
{ "server.chunkqueue-chunk-sz", NULL, T_CONFIG_INT, T_CONFIG_SCOPE_SERVER }, /* 48 */
{ "etag.use-inode", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 49 */
{ "etag.use-mtime", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 50 */
@ -303,6 +304,7 @@ static int config_insert(server *srv) {
cv[45].destination = srv->srvconf.upload_tempdirs;
cv[46].destination = &(srv->srvconf.enable_cores);
cv[47].destination = &(srv->srvconf.compat_module_load);
cv[48].destination = &chunk_sz;
cv[52].destination = &(srv->srvconf.reject_expect_100_with_417);
cv[55].destination = srv->srvconf.breakagelog_file;
@ -528,6 +530,10 @@ static int config_insert(server *srv) {
srv->srvconf.log_request_header_on_error = 1;
}
if (0 != chunk_sz) {
chunkqueue_set_chunk_size(chunk_sz);
}
if (0 != stat_cache_choose_engine(srv, stat_cache_string)) {
ret = HANDLER_ERROR;
}

Loading…
Cancel
Save