mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
lzf compression switched off by default now, with config file option to enable it in redis.conf
This commit is contained in:
parent
483049a737
commit
121f70cfae
8
redis.c
8
redis.c
@ -301,6 +301,7 @@ struct redisServer {
|
|||||||
char *appendfilename;
|
char *appendfilename;
|
||||||
char *requirepass;
|
char *requirepass;
|
||||||
int shareobjects;
|
int shareobjects;
|
||||||
|
int rdbcompression;
|
||||||
/* Replication related */
|
/* Replication related */
|
||||||
int isslave;
|
int isslave;
|
||||||
char *masterauth;
|
char *masterauth;
|
||||||
@ -1141,6 +1142,7 @@ static void initServerConfig() {
|
|||||||
server.appendfilename = "appendonly.aof";
|
server.appendfilename = "appendonly.aof";
|
||||||
server.requirepass = NULL;
|
server.requirepass = NULL;
|
||||||
server.shareobjects = 0;
|
server.shareobjects = 0;
|
||||||
|
server.rdbcompression = 0;
|
||||||
server.sharingpoolsize = 1024;
|
server.sharingpoolsize = 1024;
|
||||||
server.maxclients = 0;
|
server.maxclients = 0;
|
||||||
server.maxmemory = 0;
|
server.maxmemory = 0;
|
||||||
@ -1341,6 +1343,10 @@ static void loadServerConfig(char *filename) {
|
|||||||
if ((server.shareobjects = yesnotoi(argv[1])) == -1) {
|
if ((server.shareobjects = yesnotoi(argv[1])) == -1) {
|
||||||
err = "argument must be 'yes' or 'no'"; goto loaderr;
|
err = "argument must be 'yes' or 'no'"; goto loaderr;
|
||||||
}
|
}
|
||||||
|
} else if (!strcasecmp(argv[0],"rdbcompression") && argc == 2) {
|
||||||
|
if ((server.rdbcompression = yesnotoi(argv[1])) == -1) {
|
||||||
|
err = "argument must be 'yes' or 'no'"; goto loaderr;
|
||||||
|
}
|
||||||
} else if (!strcasecmp(argv[0],"shareobjectspoolsize") && argc == 2) {
|
} else if (!strcasecmp(argv[0],"shareobjectspoolsize") && argc == 2) {
|
||||||
server.sharingpoolsize = atoi(argv[1]);
|
server.sharingpoolsize = atoi(argv[1]);
|
||||||
if (server.sharingpoolsize < 1) {
|
if (server.sharingpoolsize < 1) {
|
||||||
@ -2488,7 +2494,7 @@ static int rdbSaveStringObjectRaw(FILE *fp, robj *obj) {
|
|||||||
|
|
||||||
/* Try LZF compression - under 20 bytes it's unable to compress even
|
/* Try LZF compression - under 20 bytes it's unable to compress even
|
||||||
* aaaaaaaaaaaaaaaaaa so skip it */
|
* aaaaaaaaaaaaaaaaaa so skip it */
|
||||||
if (len > 20) {
|
if (server.rdbcompression && len > 20) {
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
retval = rdbSaveLzfStringObject(fp,obj);
|
retval = rdbSaveLzfStringObject(fp,obj);
|
||||||
|
52
redis.conf
52
redis.conf
@ -19,28 +19,6 @@ port 6379
|
|||||||
# Close the connection after a client is idle for N seconds (0 to disable)
|
# Close the connection after a client is idle for N seconds (0 to disable)
|
||||||
timeout 300
|
timeout 300
|
||||||
|
|
||||||
# Save the DB on disk:
|
|
||||||
#
|
|
||||||
# save <seconds> <changes>
|
|
||||||
#
|
|
||||||
# Will save the DB if both the given number of seconds and the given
|
|
||||||
# number of write operations against the DB occurred.
|
|
||||||
#
|
|
||||||
# In the example below the behaviour will be to save:
|
|
||||||
# after 900 sec (15 min) if at least 1 key changed
|
|
||||||
# after 300 sec (5 min) if at least 10 keys changed
|
|
||||||
# after 60 sec if at least 10000 keys changed
|
|
||||||
save 900 1
|
|
||||||
save 300 10
|
|
||||||
save 60 10000
|
|
||||||
|
|
||||||
# The filename where to dump the DB
|
|
||||||
dbfilename dump.rdb
|
|
||||||
|
|
||||||
# For default save/load DB in/from the working directory
|
|
||||||
# Note that you must specify a directory not a file name.
|
|
||||||
dir ./
|
|
||||||
|
|
||||||
# Set server verbosity to 'debug'
|
# Set server verbosity to 'debug'
|
||||||
# it can be one of:
|
# it can be one of:
|
||||||
# debug (a lot of information, useful for development/testing)
|
# debug (a lot of information, useful for development/testing)
|
||||||
@ -58,6 +36,36 @@ logfile stdout
|
|||||||
# dbid is a number between 0 and 'databases'-1
|
# dbid is a number between 0 and 'databases'-1
|
||||||
databases 16
|
databases 16
|
||||||
|
|
||||||
|
################################ SNAPSHOTTING #################################
|
||||||
|
#
|
||||||
|
# Save the DB on disk:
|
||||||
|
#
|
||||||
|
# save <seconds> <changes>
|
||||||
|
#
|
||||||
|
# Will save the DB if both the given number of seconds and the given
|
||||||
|
# number of write operations against the DB occurred.
|
||||||
|
#
|
||||||
|
# In the example below the behaviour will be to save:
|
||||||
|
# after 900 sec (15 min) if at least 1 key changed
|
||||||
|
# after 300 sec (5 min) if at least 10 keys changed
|
||||||
|
# after 60 sec if at least 10000 keys changed
|
||||||
|
save 900 1
|
||||||
|
save 300 10
|
||||||
|
save 60 10000
|
||||||
|
|
||||||
|
# Compress string objects using LZF when dump .rdb databases?
|
||||||
|
# For default that's set to 'no' because uses too much CPU time.
|
||||||
|
# You want to switch this to 'yes' only if you have a lot of very compressible
|
||||||
|
# data inside your dataset and are using replication.
|
||||||
|
rdbcompression no
|
||||||
|
|
||||||
|
# The filename where to dump the DB
|
||||||
|
dbfilename dump.rdb
|
||||||
|
|
||||||
|
# For default save/load DB in/from the working directory
|
||||||
|
# Note that you must specify a directory not a file name.
|
||||||
|
dir ./
|
||||||
|
|
||||||
################################# REPLICATION #################################
|
################################# REPLICATION #################################
|
||||||
|
|
||||||
# Master-Slave replication. Use slaveof to make a Redis instance a copy of
|
# Master-Slave replication. Use slaveof to make a Redis instance a copy of
|
||||||
|
Loading…
Reference in New Issue
Block a user