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
1c0c4367
Commit
1c0c4367
authored
Apr 30, 2019
by
antirez
Browse files
Threaded IO: ability to disable reads from threaded path.
parent
90d720e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
1c0c4367
...
...
@@ -2723,6 +2723,7 @@ int handleClientsWithPendingWritesUsingThreads(void) {
* pending read clients and flagged as such. */
int
postponeClientRead
(
client
*
c
)
{
if
(
io_threads_active
&&
server
.
io_threads_do_reads
&&
!
(
c
->
flags
&
(
CLIENT_MASTER
|
CLIENT_SLAVE
|
CLIENT_PENDING_READ
)))
{
c
->
flags
|=
CLIENT_PENDING_READ
;
...
...
@@ -2734,7 +2735,7 @@ int postponeClientRead(client *c) {
}
int
handleClientsWithPendingReadsUsingThreads
(
void
)
{
if
(
!
io_threads_active
)
return
0
;
if
(
!
io_threads_active
||
!
server
.
io_threads_do_reads
)
return
0
;
int
processed
=
listLength
(
server
.
clients_pending_read
);
if
(
processed
==
0
)
return
0
;
...
...
src/server.c
View file @
1c0c4367
...
...
@@ -2315,6 +2315,7 @@ void initServerConfig(void) {
server
.
always_show_logo
=
CONFIG_DEFAULT_ALWAYS_SHOW_LOGO
;
server
.
lua_time_limit
=
LUA_SCRIPT_TIME_LIMIT
;
server
.
io_threads_num
=
CONFIG_DEFAULT_IO_THREADS_NUM
;
server
.
io_threads_do_reads
=
CONFIG_DEFAULT_IO_THREADS_DO_READS
;
server
.
lruclock
=
getLRUClock
();
resetServerSaveParams
();
...
...
src/server.h
View file @
1c0c4367
...
...
@@ -88,6 +88,7 @@ typedef long long mstime_t; /* millisecond time type. */
#define CONFIG_DEFAULT_CLIENT_TIMEOUT 0
/* Default client timeout: infinite */
#define CONFIG_DEFAULT_DBNUM 16
#define CONFIG_DEFAULT_IO_THREADS_NUM 1
/* Single threaded by default */
#define CONFIG_DEFAULT_IO_THREADS_DO_READS 0
/* Read + parse from threads? */
#define CONFIG_MAX_LINE 1024
#define CRON_DBS_PER_CALL 16
#define NET_MAX_WRITES_PER_EVENT (1024*64)
...
...
@@ -1069,6 +1070,7 @@ struct redisServer {
int
gopher_enabled
;
/* If true the server will reply to gopher
queries. Will still serve RESP2 queries. */
int
io_threads_num
;
/* Number of IO threads to use. */
int
io_threads_do_reads
;
/* Read and parse from IO threads? */
/* RDB / AOF loading information */
int
loading
;
/* We are loading data from disk if true */
...
...
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