-
Notifications
You must be signed in to change notification settings - Fork 702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use MSG_ZEROCOPY for plaintext replication traffic #1543
base: unstable
Are you sure you want to change the base?
Changes from all commits
855a059
0a33aaa
7199031
756ab02
b9a8086
35562ce
6caf217
bbedd5b
bec3ff2
a04d132
929bc75
f39f7d3
a47b959
82f7303
a1c3e52
469fd9b
3a11ce9
63a583e
0d5a2c7
d81949c
425366f
22d3258
359728f
89e614e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -39,14 +39,17 @@ | |||||||||||||||||||||||||||||||||
#define AE_OK 0 | ||||||||||||||||||||||||||||||||||
#define AE_ERR -1 | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
#define AE_NONE 0 /* No events registered. */ | ||||||||||||||||||||||||||||||||||
#define AE_READABLE 1 /* Fire when descriptor is readable. */ | ||||||||||||||||||||||||||||||||||
#define AE_WRITABLE 2 /* Fire when descriptor is writable. */ | ||||||||||||||||||||||||||||||||||
#define AE_BARRIER 4 /* With WRITABLE, never fire the event if the \ | ||||||||||||||||||||||||||||||||||
READABLE event already fired in the same event \ | ||||||||||||||||||||||||||||||||||
loop iteration. Useful when you want to persist \ | ||||||||||||||||||||||||||||||||||
things to disk before sending replies, and want \ | ||||||||||||||||||||||||||||||||||
to do that in a group fashion. */ | ||||||||||||||||||||||||||||||||||
#define AE_NONE 0 /* No events registered. */ | ||||||||||||||||||||||||||||||||||
#define AE_READABLE 1 << 0 /* Fire when descriptor is readable. */ | ||||||||||||||||||||||||||||||||||
#define AE_WRITABLE 1 << 1 /* Fire when descriptor is writable. */ | ||||||||||||||||||||||||||||||||||
#define AE_BARRIER 1 << 2 /* With WRITABLE, never fire the event if the \ | ||||||||||||||||||||||||||||||||||
READABLE event already fired in the same event \ | ||||||||||||||||||||||||||||||||||
loop iteration. Useful when you want to persist \ | ||||||||||||||||||||||||||||||||||
things to disk before sending replies, and want \ | ||||||||||||||||||||||||||||||||||
to do that in a group fashion. */ | ||||||||||||||||||||||||||||||||||
#define AE_ERROR_QUEUE 1 << 3 /* Fire when descriptor has a message on the \ | ||||||||||||||||||||||||||||||||||
Comment on lines
+43
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||
message queue. */ | ||||||||||||||||||||||||||||||||||
#define AE_NUM_EVENT_TYPES 3 /* Total number of events we can fire in one pass */ | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
#define AE_FILE_EVENTS (1 << 0) | ||||||||||||||||||||||||||||||||||
#define AE_TIME_EVENTS (1 << 1) | ||||||||||||||||||||||||||||||||||
|
@@ -75,9 +78,10 @@ typedef int aeCustomPollProc(struct aeEventLoop *eventLoop); | |||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
/* File event structure */ | ||||||||||||||||||||||||||||||||||
typedef struct aeFileEvent { | ||||||||||||||||||||||||||||||||||
int mask; /* one of AE_(READABLE|WRITABLE|BARRIER) */ | ||||||||||||||||||||||||||||||||||
int mask; /* one of AE_(READABLE|WRITABLE|BARRIER|ERROR_QUEUE) */ | ||||||||||||||||||||||||||||||||||
aeFileProc *rfileProc; | ||||||||||||||||||||||||||||||||||
aeFileProc *wfileProc; | ||||||||||||||||||||||||||||||||||
aeFileProc *errfileproc; | ||||||||||||||||||||||||||||||||||
void *clientData; | ||||||||||||||||||||||||||||||||||
} aeFileEvent; | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2545,6 +2545,19 @@ static int updateExtendedRedisCompat(const char **err) { | |
return 1; | ||
} | ||
|
||
static int applyTcpTxZerocopy(const char **err) { | ||
#ifndef HAVE_MSG_ZEROCOPY | ||
if (server.tcp_tx_zerocopy) { | ||
*err = "TCP zerocopy is not supported by this system"; | ||
return 0; | ||
} | ||
return 1; | ||
#else | ||
UNUSED(err); | ||
return 1; | ||
#endif | ||
} | ||
|
||
static int updateSighandlerEnabled(const char **err) { | ||
UNUSED(err); | ||
if (server.crashlog_enabled) | ||
|
@@ -3188,6 +3201,7 @@ standardConfig static_configs[] = { | |
createBoolConfig("cluster-slot-stats-enabled", NULL, MODIFIABLE_CONFIG, server.cluster_slot_stats_enabled, 0, NULL, NULL), | ||
createBoolConfig("hide-user-data-from-log", NULL, MODIFIABLE_CONFIG, server.hide_user_data_from_log, 1, NULL, NULL), | ||
createBoolConfig("import-mode", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.import_mode, 0, NULL, NULL), | ||
createBoolConfig("tcp-tx-zerocopy", NULL, MODIFIABLE_CONFIG, server.tcp_tx_zerocopy, CONFIG_DEFAULT_TCP_TX_ZEROCOPY, NULL, applyTcpTxZerocopy), | ||
|
||
/* String Configs */ | ||
createStringConfig("aclfile", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, server.acl_filename, "", NULL, NULL), | ||
|
@@ -3289,6 +3303,7 @@ standardConfig static_configs[] = { | |
createIntConfig("rdma-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.rdma_ctx_config.port, 0, INTEGER_CONFIG, NULL, updateRdmaPort), | ||
createIntConfig("rdma-rx-size", NULL, IMMUTABLE_CONFIG, 64 * 1024, 16 * 1024 * 1024, server.rdma_ctx_config.rx_size, 1024 * 1024, INTEGER_CONFIG, NULL, NULL), | ||
createIntConfig("rdma-completion-vector", NULL, IMMUTABLE_CONFIG, -1, 1024, server.rdma_ctx_config.completion_vector, -1, INTEGER_CONFIG, NULL, NULL), | ||
createIntConfig("tcp-zerocopy-min-write-size", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.tcp_zerocopy_min_write_size, CONFIG_DEFAULT_ZERO_COPY_MIN_WRITE_SIZE, INTEGER_CONFIG, NULL, NULL), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this falls under the "configurations we do not want users to mess with". agree 10K is the recommended sweet spot, but not sure if this needs any kind of tunability option ATM. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also didn't have it at first - but in tests it was much easier to deterministically trigger zero copy writes if I can play with the minimum write size.
I can move it to a DEBUG command if we would prefer, if we have concerns about maintaining new configs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure why it makes the test much easier? I thiknk DEBUG command is fine and also a HIDDEN config which is named prefixed/suffixed with 'debug' is fine IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ultimately we have no control over if a call to
At a higher level - can I ask why it would be bad to expose such a config to the user? I can imagine that a combination of network hardware and kernel version may impact what setting makes sense here. I don't expect many folks to play with it - but it isn't a confusing setting and it isn't like maintenance cost will be high. |
||
|
||
/* Unsigned int configs */ | ||
createUIntConfig("maxclients", NULL, MODIFIABLE_CONFIG, 1, UINT_MAX, server.maxclients, 10000, INTEGER_CONFIG, NULL, updateMaxclients), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.