diff --git a/odissey.conf b/odissey.conf index 07f13b3f..e4a1181e 100644 --- a/odissey.conf +++ b/odissey.conf @@ -37,8 +37,9 @@ nodelay yes keepalive 7200 readahead 8192 client_max 100 +pipeline 32768 cache 100 -cache_chunk 131072 +cache_chunk 34768 cache_coroutine 128 resolvers 1 workers 1 diff --git a/sources/config.c b/sources/config.c index 9c1c1296..de8fe89c 100644 --- a/sources/config.c +++ b/sources/config.c @@ -64,6 +64,7 @@ enum OD_LREADAHEAD, OD_LWORKERS, OD_LRESOLVERS, + OD_LPIPELINE, OD_LCACHE, OD_LCACHE_CHUNK, OD_LCACHE_COROUTINE, @@ -136,6 +137,7 @@ static od_keyword_t od_config_keywords[] = od_keyword("readahead", OD_LREADAHEAD), od_keyword("workers", OD_LWORKERS), od_keyword("resolvers", OD_LRESOLVERS), + od_keyword("pipeline", OD_LPIPELINE), od_keyword("cache", OD_LCACHE), od_keyword("cache_chunk", OD_LCACHE_CHUNK), od_keyword("cache_coroutine", OD_LCACHE_COROUTINE), @@ -929,6 +931,11 @@ od_config_parse(od_config_t *config) if (! od_config_next_number(config, &scheme->resolvers)) return -1; continue; + /* pipeline */ + case OD_LPIPELINE: + if (! od_config_next_number(config, &scheme->pipeline)) + return -1; + continue; /* cache */ case OD_LCACHE: if (! od_config_next_number(config, &scheme->cache)) diff --git a/sources/frontend.c b/sources/frontend.c index 402a4231..fd5d054e 100644 --- a/sources/frontend.c +++ b/sources/frontend.c @@ -460,7 +460,7 @@ static inline int od_frontend_stream_hit_limit(od_client_t *client) { od_instance_t *instance = client->system->instance; - return shapito_stream_used(client->stream) >= instance->scheme.cache_chunk_ra; + return shapito_stream_used(client->stream) >= instance->scheme.pipeline; } static od_frontend_rc_t diff --git a/sources/periodic.c b/sources/periodic.c index 2d511a46..dce92b78 100644 --- a/sources/periodic.c +++ b/sources/periodic.c @@ -72,20 +72,23 @@ od_periodic_stats(od_router_t *router) int stream_count = 0; int stream_count_allocated = 0; int stream_total_allocated = 0; + int stream_cache_size = 0; shapito_cache_stat(&instance->stream_cache, &stream_count, - &stream_count_allocated, &stream_total_allocated); + &stream_count_allocated, &stream_total_allocated, + &stream_cache_size); int count_machine = 0; int count_coroutine = 0; int count_coroutine_cache = 0; machinarium_stat(&count_machine, &count_coroutine, &count_coroutine_cache); od_log(&instance->logger, "stats", NULL, NULL, - "clients %d, stream cache (%d:%d allocated, %d cached), " + "clients %d, stream cache (%d:%d allocated, %d cached %d bytes), " "coroutines (%d active, %d cached)", router->clients, stream_count_allocated, stream_total_allocated, stream_count, + stream_cache_size, count_coroutine, count_coroutine_cache); } diff --git a/sources/scheme.c b/sources/scheme.c index a766ae84..b197f88d 100644 --- a/sources/scheme.c +++ b/sources/scheme.c @@ -48,9 +48,9 @@ void od_scheme_init(od_scheme_t *scheme) scheme->client_max_set = 0; scheme->client_max = 0; scheme->cache = 100; - scheme->cache_chunk = 16 * 1024; - scheme->cache_chunk_ra = 14 * 1024; + scheme->cache_chunk = 32 * 1024; scheme->cache_coroutine = 0; + scheme->pipeline = 30 * 1024; od_list_init(&scheme->storages); od_list_init(&scheme->routes); od_list_init(&scheme->listen); @@ -583,12 +583,6 @@ int od_scheme_validate(od_scheme_t *scheme, od_logger_t *logger) return -1; } - /* set pipeline cache chunk watermark to 90% */ - if (scheme->cache_chunk > 0) - scheme->cache_chunk_ra = scheme->cache_chunk - (scheme->cache_chunk / 10); - else - scheme->cache_chunk_ra = scheme->readahead; - /* log format */ if (scheme->log_format == NULL) { od_error(logger, "config", NULL, NULL, "log is not defined"); @@ -869,6 +863,8 @@ void od_scheme_print(od_scheme_t *scheme, od_logger_t *logger, int routes_only) if (scheme->client_max_set) od_log(logger, "config", NULL, NULL, "client_max %d", scheme->client_max); + od_log(logger, "config", NULL, NULL, + "pipeline %d", scheme->pipeline); od_log(logger, "config", NULL, NULL, "cache %d", scheme->cache); od_log(logger, "config", NULL, NULL, diff --git a/sources/scheme.h b/sources/scheme.h index 4137fe40..a3b03621 100644 --- a/sources/scheme.h +++ b/sources/scheme.h @@ -143,8 +143,8 @@ struct od_scheme int client_max; int cache; int cache_chunk; - int cache_chunk_ra; int cache_coroutine; + int pipeline; /* temprorary storages */ od_list_t storages; /* routes */ diff --git a/third_party/shapito b/third_party/shapito index 16a740ec..1e8fd09f 160000 --- a/third_party/shapito +++ b/third_party/shapito @@ -1 +1 @@ -Subproject commit 16a740ecc531f7996826f872fa270e01b086e50f +Subproject commit 1e8fd09fa52f214d1e1852c1872c69ba14c9c0b7