odissey: add pipeline configuration

This commit is contained in:
Dmitry Simonenko 2018-02-27 18:38:53 +03:00
parent 2f6aabb4a0
commit bb34b84101
7 changed files with 21 additions and 14 deletions

View File

@ -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

View File

@ -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))

View File

@ -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

View File

@ -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);
}

View File

@ -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,

View File

@ -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 */

2
third_party/shapito vendored

@ -1 +1 @@
Subproject commit 16a740ecc531f7996826f872fa270e01b086e50f
Subproject commit 1e8fd09fa52f214d1e1852c1872c69ba14c9c0b7