Configurable pool size.

master
Nicolas Favre-Felix 14 years ago
parent a6c61cfe11
commit fd404c4adf

@ -37,6 +37,7 @@ conf_read(const char *filename) {
conf->verbosity = WEBDIS_NOTICE;
conf->daemonize = 0;
conf->database = 0;
conf->pool_size_per_thread = 2;
j = json_load_file(filename, 0, &error);
if(!j) {
@ -84,6 +85,8 @@ conf_read(const char *filename) {
conf->daemonize = 1;
} else if(strcmp(json_object_iter_key(kv), "database") == 0 && json_typeof(jtmp) == JSON_INTEGER) {
conf->database = json_integer_value(jtmp);
} else if(strcmp(json_object_iter_key(kv), "pool_size") == 0 && json_typeof(jtmp) == JSON_INTEGER) {
conf->pool_size_per_thread = json_integer_value(jtmp);
}
}

@ -16,6 +16,9 @@ struct conf {
short http_port;
short http_threads;
/* pool size, one pool per worker thread */
int pool_size_per_thread;
/* daemonize process, off by default */
int daemonize;

@ -5,6 +5,8 @@
#include "pool.h"
#include "slog.h"
#include "websocket.h"
#include "conf.h"
#include "server.h"
#include <stdlib.h>
#include <stdio.h>
@ -25,7 +27,7 @@ worker_new(struct server *s) {
(void)ret;
/* Redis connection pool */
w->pool = pool_new(w, 8); /* FIXME: change the number? use conf? */
w->pool = pool_new(w, s->cfg->pool_size_per_thread);
return w;

Loading…
Cancel
Save