Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
35a60441
R
redis
项目概览
别团等shy哥发育
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
35a60441
编写于
6月 30, 2011
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
slow log configuration implemented
上级
63d62eb7
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
42 addition
and
1 deletion
+42
-1
redis.conf
redis.conf
+18
-0
src/config.c
src/config.c
+22
-0
src/redis.h
src/redis.h
+1
-1
src/slowlog.c
src/slowlog.c
+1
-0
未找到文件。
redis.conf
浏览文件 @
35a60441
...
...
@@ -312,6 +312,24 @@ no-appendfsync-on-rewrite no
auto
-
aof
-
rewrite
-
percentage
100
auto
-
aof
-
rewrite
-
min
-
size
64
mb
################################## SLOW LOG ###################################
# The Redis Slow Log is a system to log queries that exceeded a specified
# execution time. The execution time does not include the I/O operations
# like talking with the client, sending the reply and so forth,
# but just the time needed to actually execute the command (this is the only
# stage of command execution where the thread is blocked and can not serve
# other requests in the meantime).
#
# You can configure the slow log with two parameters: one tells Redis
# what is the execution time, in microseconds, to exceed in order for the
# command to get logged, and the other parameter is the length of the
# slow log. When a new command is logged the oldest one is removed from the
# queue of logged commands.
slowlog
-
log
-
slower
-
than
10000
slowlog
-
log
-
len
1024
############################### ADVANCED CONFIG ###############################
# Hashes are encoded in a special way (much more memory efficient) when they
...
...
src/config.c
浏览文件 @
35a60441
...
...
@@ -296,6 +296,12 @@ void loadServerConfig(char *filename) {
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"cluster-config-file"
)
&&
argc
==
2
)
{
zfree
(
server
.
cluster
.
configfile
);
server
.
cluster
.
configfile
=
zstrdup
(
argv
[
1
]);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"slowlog-log-slower-than"
)
&&
argc
==
2
)
{
server
.
slowlog_log_slower_than
=
strtoll
(
argv
[
1
],
NULL
,
10
);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"slowlog-max-len"
)
&&
argc
==
2
)
{
server
.
slowlog_max_len
=
strtoll
(
argv
[
1
],
NULL
,
10
);
}
else
{
err
=
"Bad directive or wrong number of arguments"
;
goto
loaderr
;
}
...
...
@@ -466,6 +472,12 @@ void configSetCommand(redisClient *c) {
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"zset-max-ziplist-value"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<
0
)
goto
badfmt
;
server
.
zset_max_ziplist_value
=
ll
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"slowlog-log-slower-than"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
)
goto
badfmt
;
server
.
slowlog_log_slower_than
=
ll
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"slowlog-max-len"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<
0
)
goto
badfmt
;
server
.
slowlog_max_len
=
(
unsigned
)
ll
;
}
else
{
addReplyErrorFormat
(
c
,
"Unsupported CONFIG parameter: %s"
,
(
char
*
)
c
->
argv
[
2
]
->
ptr
);
...
...
@@ -637,6 +649,16 @@ void configGetCommand(redisClient *c) {
addReplyBulkLongLong
(
c
,
server
.
zset_max_ziplist_value
);
matches
++
;
}
if
(
stringmatch
(
pattern
,
"slowlog-log-slower-than"
,
0
))
{
addReplyBulkCString
(
c
,
"slowlog-log-slower-than"
);
addReplyBulkLongLong
(
c
,
server
.
slowlog_log_slower_than
);
matches
++
;
}
if
(
stringmatch
(
pattern
,
"slowlog-max-len"
,
0
))
{
addReplyBulkCString
(
c
,
"slowlog-max-len"
);
addReplyBulkLongLong
(
c
,
server
.
slowlog_max_len
);
matches
++
;
}
setDeferredMultiBulkLength
(
c
,
replylen
,
matches
*
2
);
}
...
...
src/redis.h
浏览文件 @
35a60441
...
...
@@ -529,7 +529,7 @@ struct redisServer {
long
long
stat_fork_time
;
/* time needed to perform latets fork() */
list
*
slowlog
;
long
long
slowlog_log_slower_than
;
unsigned
int
slowlog_max_len
;
unsigned
long
slowlog_max_len
;
/* Configuration */
int
verbosity
;
int
maxidletime
;
...
...
src/slowlog.c
浏览文件 @
35a60441
...
...
@@ -54,6 +54,7 @@ void slowlogInit(void) {
* This function will make sure to trim the slow log accordingly to the
* configured max length. */
void
slowlogPushEntryIfNeeded
(
robj
**
argv
,
int
argc
,
long
long
duration
)
{
if
(
server
.
slowlog_log_slower_than
<
0
)
return
;
/* Slowlog disabled */
if
(
duration
>
server
.
slowlog_log_slower_than
)
listAddNodeHead
(
server
.
slowlog
,
slowlogCreateEntry
(
argv
,
argc
,
duration
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录