Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
e173f7a0
Commit
e173f7a0
authored
Jul 02, 2014
by
antirez
Browse files
Latency monitor trheshold value is now configurable.
This commit adds both support for redis.conf and CONFIG SET/GET.
parent
cc4df5a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
redis.conf
View file @
e173f7a0
...
@@ -654,6 +654,27 @@ slowlog-log-slower-than 10000
...
@@ -654,6 +654,27 @@ slowlog-log-slower-than 10000
# You can reclaim memory used by the slow log with SLOWLOG RESET.
# You can reclaim memory used by the slow log with SLOWLOG RESET.
slowlog
-
max
-
len
128
slowlog
-
max
-
len
128
################################ LATENCY MONITOR ##############################
# The Redis latency monitoring subsystem samples different operations
# at runtime in order to collect data related to possible sources of
# latency of a Redis instance.
#
# Via the LATENCY command this information is available to the user that can
# print graphs and obtain reports.
#
# The system only logs operations that were performed in a time equal or
# greater than the amount of milliseconds specified via the
# latency-monitor-threshold configuration directive. When its value is set
# to zero, the latency monitor is turned off.
#
# By default latency monitoring is disabled since it is mostly not needed
# if you don't have latency issues, and collecting data has a performance
# impact, that while very small, can be measured under big load. Latency
# monitoring can easily be enalbed at runtime using the command
# "CONFIG SET latency-monitor-threshold <milliseconds>" if needed.
latency
-
monitor
-
threshold
0
############################# Event notification ##############################
############################# Event notification ##############################
# Redis can notify Pub/Sub clients about events happening in the key space.
# Redis can notify Pub/Sub clients about events happening in the key space.
...
...
src/config.c
View file @
e173f7a0
...
@@ -451,6 +451,14 @@ void loadServerConfigFromString(char *config) {
...
@@ -451,6 +451,14 @@ void loadServerConfigFromString(char *config) {
argc
==
2
)
argc
==
2
)
{
{
server
.
slowlog_log_slower_than
=
strtoll
(
argv
[
1
],
NULL
,
10
);
server
.
slowlog_log_slower_than
=
strtoll
(
argv
[
1
],
NULL
,
10
);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"latency-monitor-threshold"
)
&&
argc
==
2
)
{
server
.
latency_monitor_threshold
=
strtoll
(
argv
[
1
],
NULL
,
10
);
if
(
server
.
latency_monitor_threshold
<
0
)
{
err
=
"The latency threshold can't be negative"
;
goto
loaderr
;
}
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"slowlog-max-len"
)
&&
argc
==
2
)
{
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"slowlog-max-len"
)
&&
argc
==
2
)
{
server
.
slowlog_max_len
=
strtoll
(
argv
[
1
],
NULL
,
10
);
server
.
slowlog_max_len
=
strtoll
(
argv
[
1
],
NULL
,
10
);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"client-output-buffer-limit"
)
&&
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"client-output-buffer-limit"
)
&&
...
@@ -787,6 +795,9 @@ void configSetCommand(redisClient *c) {
...
@@ -787,6 +795,9 @@ void configSetCommand(redisClient *c) {
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"slowlog-max-len"
))
{
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"slowlog-max-len"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<
0
)
goto
badfmt
;
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<
0
)
goto
badfmt
;
server
.
slowlog_max_len
=
(
unsigned
)
ll
;
server
.
slowlog_max_len
=
(
unsigned
)
ll
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"latency-monitor-threshold"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<
0
)
goto
badfmt
;
server
.
latency_monitor_threshold
=
ll
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"loglevel"
))
{
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"loglevel"
))
{
if
(
!
strcasecmp
(
o
->
ptr
,
"warning"
))
{
if
(
!
strcasecmp
(
o
->
ptr
,
"warning"
))
{
server
.
verbosity
=
REDIS_WARNING
;
server
.
verbosity
=
REDIS_WARNING
;
...
@@ -996,6 +1007,8 @@ void configGetCommand(redisClient *c) {
...
@@ -996,6 +1007,8 @@ void configGetCommand(redisClient *c) {
config_get_numerical_field
(
"lua-time-limit"
,
server
.
lua_time_limit
);
config_get_numerical_field
(
"lua-time-limit"
,
server
.
lua_time_limit
);
config_get_numerical_field
(
"slowlog-log-slower-than"
,
config_get_numerical_field
(
"slowlog-log-slower-than"
,
server
.
slowlog_log_slower_than
);
server
.
slowlog_log_slower_than
);
config_get_numerical_field
(
"latency-monitor-threshold"
,
server
.
latency_monitor_threshold
);
config_get_numerical_field
(
"slowlog-max-len"
,
config_get_numerical_field
(
"slowlog-max-len"
,
server
.
slowlog_max_len
);
server
.
slowlog_max_len
);
config_get_numerical_field
(
"port"
,
server
.
port
);
config_get_numerical_field
(
"port"
,
server
.
port
);
...
@@ -1785,6 +1798,7 @@ int rewriteConfig(char *path) {
...
@@ -1785,6 +1798,7 @@ int rewriteConfig(char *path) {
rewriteConfigNumericalOption
(
state
,
"cluster-migration-barrier"
,
server
.
cluster_migration_barrier
,
REDIS_CLUSTER_DEFAULT_MIGRATION_BARRIER
);
rewriteConfigNumericalOption
(
state
,
"cluster-migration-barrier"
,
server
.
cluster_migration_barrier
,
REDIS_CLUSTER_DEFAULT_MIGRATION_BARRIER
);
rewriteConfigNumericalOption
(
state
,
"cluster-slave-validity-factor"
,
server
.
cluster_slave_validity_factor
,
REDIS_CLUSTER_DEFAULT_SLAVE_VALIDITY
);
rewriteConfigNumericalOption
(
state
,
"cluster-slave-validity-factor"
,
server
.
cluster_slave_validity_factor
,
REDIS_CLUSTER_DEFAULT_SLAVE_VALIDITY
);
rewriteConfigNumericalOption
(
state
,
"slowlog-log-slower-than"
,
server
.
slowlog_log_slower_than
,
REDIS_SLOWLOG_LOG_SLOWER_THAN
);
rewriteConfigNumericalOption
(
state
,
"slowlog-log-slower-than"
,
server
.
slowlog_log_slower_than
,
REDIS_SLOWLOG_LOG_SLOWER_THAN
);
rewriteConfigNumericalOption
(
state
,
"latency-monitor-threshold"
,
server
.
latency_monitor_threshold
,
REDIS_DEFAULT_LATENCY_MONITOR_THRESHOLD
);
rewriteConfigNumericalOption
(
state
,
"slowlog-max-len"
,
server
.
slowlog_max_len
,
REDIS_SLOWLOG_MAX_LEN
);
rewriteConfigNumericalOption
(
state
,
"slowlog-max-len"
,
server
.
slowlog_max_len
,
REDIS_SLOWLOG_MAX_LEN
);
rewriteConfigNotifykeyspaceeventsOption
(
state
);
rewriteConfigNotifykeyspaceeventsOption
(
state
);
rewriteConfigNumericalOption
(
state
,
"hash-max-ziplist-entries"
,
server
.
hash_max_ziplist_entries
,
REDIS_HASH_MAX_ZIPLIST_ENTRIES
);
rewriteConfigNumericalOption
(
state
,
"hash-max-ziplist-entries"
,
server
.
hash_max_ziplist_entries
,
REDIS_HASH_MAX_ZIPLIST_ENTRIES
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment