redis connection tuning

This commit is contained in:
Grant Limberg 2022-06-22 10:30:58 -07:00
parent 17bc9d3085
commit 9d4336d296
No known key found for this signature in database
GPG Key ID: 8F2F97D3BE8D7735

View File

@ -216,7 +216,11 @@ PostgreSQL::PostgreSQL(const Identity &myId, const char *path, int listenPort, R
opts.port = _rc->port; opts.port = _rc->port;
opts.password = _rc->password; opts.password = _rc->password;
opts.db = 0; opts.db = 0;
opts.keep_alive = true;
opts.connect_timeout = std::chrono::seconds(5);
poolOpts.size = 25; poolOpts.size = 25;
poolOpts.wait_timeout = std::chrono::milliseconds(1000);
poolOpts.connection_lifetime = std::chrono::minutes(5);
if (_rc->clusterMode) { if (_rc->clusterMode) {
fprintf(stderr, "Using Redis in Cluster Mode\n"); fprintf(stderr, "Using Redis in Cluster Mode\n");
_cluster = std::make_shared<sw::redis::RedisCluster>(opts, poolOpts); _cluster = std::make_shared<sw::redis::RedisCluster>(opts, poolOpts);