config for compression

This commit is contained in:
Doug Hoyte
2023-02-01 09:23:28 -05:00
parent 8d0c9952ab
commit 4f3a245407
4 changed files with 25 additions and 3 deletions

2
TODO
View File

@ -7,8 +7,6 @@ features
* limit on number of concurrent sync requests
* full-db scan limited by since/until
* `strfry sync` command always takes at least 1 second due to batching delay. figure out better way to flush
bool values in config
config for compression
less verbose default logging
make it easier for a thread to setup a quadrable env

View File

@ -127,6 +127,15 @@ config:
desc: "Maximum records that can be returned per filter"
default: 500
- name: relay__compression__enabled
desc: "Use permessage-deflate compression if supported by client. Reduces bandwidth, but slight increase in CPU"
default: true
noReload: true
- name: relay__compression__slidingWindow
desc: "Maintain a sliding window buffer for each connection. Improves compression, but uses more memory"
default: true
noReload: true
- name: relay__logging__dumpInAll
desc: "Dump all incoming messages"
default: false

View File

@ -69,7 +69,14 @@ void RelayServer::runWebsocket(ThreadPool<MsgWebsocket>::Thread &thr) {
hubGroup = hub.createGroup<uWS::SERVER>(uWS::PERMESSAGE_DEFLATE | uWS::SLIDING_DEFLATE_WINDOW, cfg().relay__maxWebsocketPayloadSize);
{
int extensionOptions = 0;
if (cfg().relay__compression__enabled) extensionOptions |= uWS::PERMESSAGE_DEFLATE;
if (cfg().relay__compression__slidingWindow) extensionOptions |= uWS::SLIDING_DEFLATE_WINDOW;
hubGroup = hub.createGroup<uWS::SERVER>(extensionOptions, cfg().relay__maxWebsocketPayloadSize);
}
if (cfg().relay__autoPingSeconds) hubGroup->startAutoPing(cfg().relay__autoPingSeconds * 1'000);

View File

@ -41,6 +41,14 @@ relay {
# Maximum records that can be returned per filter
maxFilterLimit = 500
compression {
# Use permessage-deflate compression if supported by client. Reduces bandwidth, but slight increase in CPU
enabled = true
# Maintain a sliding window buffer for each connection. Improves compression, but uses more memory
slidingWindow = true
}
logging {
# Dump all incoming messages
dumpInAll = false