Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hanoi2005
redis
提交
419e1cca
R
redis
项目概览
hanoi2005
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
419e1cca
编写于
2月 25, 2011
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
less delays in diskstore when there are many writes. more work to do.
上级
900ab8fc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
3 deletion
+12
-3
src/dscache.c
src/dscache.c
+9
-3
src/redis.h
src/redis.h
+3
-0
未找到文件。
src/dscache.c
浏览文件 @
419e1cca
...
@@ -323,7 +323,10 @@ void freeIOJob(iojob *j) {
...
@@ -323,7 +323,10 @@ void freeIOJob(iojob *j) {
/* Every time a thread finished a Job, it writes a byte into the write side
/* Every time a thread finished a Job, it writes a byte into the write side
* of an unix pipe in order to "awake" the main thread, and this function
* of an unix pipe in order to "awake" the main thread, and this function
* is called. */
* is called.
*
* If privdata != NULL the function will try to put more jobs in the queue
* of IO jobs to process as more room is made. */
void
vmThreadedIOCompletedJob
(
aeEventLoop
*
el
,
int
fd
,
void
*
privdata
,
void
vmThreadedIOCompletedJob
(
aeEventLoop
*
el
,
int
fd
,
void
*
privdata
,
int
mask
)
int
mask
)
{
{
...
@@ -331,7 +334,6 @@ void vmThreadedIOCompletedJob(aeEventLoop *el, int fd, void *privdata,
...
@@ -331,7 +334,6 @@ void vmThreadedIOCompletedJob(aeEventLoop *el, int fd, void *privdata,
int
retval
,
processed
=
0
,
toprocess
=
-
1
;
int
retval
,
processed
=
0
,
toprocess
=
-
1
;
REDIS_NOTUSED
(
el
);
REDIS_NOTUSED
(
el
);
REDIS_NOTUSED
(
mask
);
REDIS_NOTUSED
(
mask
);
REDIS_NOTUSED
(
privdata
);
/* For every byte we read in the read side of the pipe, there is one
/* For every byte we read in the read side of the pipe, there is one
* I/O job completed to process. */
* I/O job completed to process. */
...
@@ -390,6 +392,7 @@ void vmThreadedIOCompletedJob(aeEventLoop *el, int fd, void *privdata,
...
@@ -390,6 +392,7 @@ void vmThreadedIOCompletedJob(aeEventLoop *el, int fd, void *privdata,
freeIOJob
(
j
);
freeIOJob
(
j
);
}
}
processed
++
;
processed
++
;
if
(
privdata
!=
NULL
)
cacheScheduleIOPushJobs
(
0
);
if
(
processed
==
toprocess
)
return
;
if
(
processed
==
toprocess
)
return
;
}
}
if
(
retval
<
0
&&
errno
!=
EAGAIN
)
{
if
(
retval
<
0
&&
errno
!=
EAGAIN
)
{
...
@@ -411,6 +414,7 @@ void *IOThreadEntryPoint(void *arg) {
...
@@ -411,6 +414,7 @@ void *IOThreadEntryPoint(void *arg) {
iojob
*
j
;
iojob
*
j
;
listNode
*
ln
;
listNode
*
ln
;
REDIS_NOTUSED
(
arg
);
REDIS_NOTUSED
(
arg
);
long
long
start
;
pthread_detach
(
pthread_self
());
pthread_detach
(
pthread_self
());
lockThreadedIO
();
lockThreadedIO
();
...
@@ -423,6 +427,7 @@ void *IOThreadEntryPoint(void *arg) {
...
@@ -423,6 +427,7 @@ void *IOThreadEntryPoint(void *arg) {
redisLog
(
REDIS_DEBUG
,
"[T] signal received"
);
redisLog
(
REDIS_DEBUG
,
"[T] signal received"
);
continue
;
continue
;
}
}
start
=
ustime
();
redisLog
(
REDIS_DEBUG
,
"[T] %ld IO jobs to process"
,
redisLog
(
REDIS_DEBUG
,
"[T] %ld IO jobs to process"
,
listLength
(
server
.
io_newjobs
));
listLength
(
server
.
io_newjobs
));
ln
=
listFirst
(
server
.
io_newjobs
);
ln
=
listFirst
(
server
.
io_newjobs
);
...
@@ -464,6 +469,7 @@ void *IOThreadEntryPoint(void *arg) {
...
@@ -464,6 +469,7 @@ void *IOThreadEntryPoint(void *arg) {
/* Signal the main thread there is new stuff to process */
/* Signal the main thread there is new stuff to process */
redisAssert
(
write
(
server
.
io_ready_pipe_write
,
"x"
,
1
)
==
1
);
redisAssert
(
write
(
server
.
io_ready_pipe_write
,
"x"
,
1
)
==
1
);
redisLog
(
REDIS_WARNING
,
"TIME (%c): %lld
\n
"
,
j
->
type
==
REDIS_IOJOB_LOAD
?
'L'
:
'S'
,
ustime
()
-
start
);
}
}
/* never reached, but that's the full pattern... */
/* never reached, but that's the full pattern... */
unlockThreadedIO
();
unlockThreadedIO
();
...
@@ -739,7 +745,7 @@ void cacheScheduleIO(redisDb *db, robj *key, int type) {
...
@@ -739,7 +745,7 @@ void cacheScheduleIO(redisDb *db, robj *key, int type) {
* scheduled completion time, but just do the operation ASAP. This is useful
* scheduled completion time, but just do the operation ASAP. This is useful
* when we need to reclaim memory from the IO queue.
* when we need to reclaim memory from the IO queue.
*/
*/
#define MAX_IO_JOBS_QUEUE 10
0
#define MAX_IO_JOBS_QUEUE 10
int
cacheScheduleIOPushJobs
(
int
flags
)
{
int
cacheScheduleIOPushJobs
(
int
flags
)
{
time_t
now
=
time
(
NULL
);
time_t
now
=
time
(
NULL
);
listNode
*
ln
;
listNode
*
ln
;
...
...
src/redis.h
浏览文件 @
419e1cca
...
@@ -637,6 +637,9 @@ dictType hashDictType;
...
@@ -637,6 +637,9 @@ dictType hashDictType;
* Functions prototypes
* Functions prototypes
*----------------------------------------------------------------------------*/
*----------------------------------------------------------------------------*/
/* Utils */
long
long
ustime
(
void
);
/* networking.c -- Networking and Client related operations */
/* networking.c -- Networking and Client related operations */
redisClient
*
createClient
(
int
fd
);
redisClient
*
createClient
(
int
fd
);
void
closeTimedoutClients
(
void
);
void
closeTimedoutClients
(
void
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录