Merge pull request #2030 from kaomakino/kaomakino/quickack

TCP_QUICKACK test
This commit is contained in:
Vishesh Yadav 2019-09-10 17:06:12 -07:00 committed by GitHub
commit e005ef8e9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 9 deletions

View File

@ -870,14 +870,19 @@ int worker_process_main(mako_args_t *args, int worker_id, mako_shmhdr_t *shm) {
/* enable knobs if specified */
if (args->knobs[0] != '\0') {
if (args->verbose >= VERBOSE_DEBUG) {
printf("DEBUG: Setting client konbs: %s\n", args->knobs);
}
err = fdb_network_set_option(FDB_NET_OPTION_KNOB, (uint8_t *)args->knobs,
strlen(args->knobs));
if (err) {
fprintf(stderr, "ERROR: fdb_network_set_option: %s\n",
fdb_get_error(err));
char delim[] = ", ";
char *knob = strtok(args->knobs, delim);
while (knob != NULL) {
if (args->verbose >= VERBOSE_DEBUG) {
printf("DEBUG: Setting client knobs: %s\n", knob);
}
err = fdb_network_set_option(FDB_NET_OPTION_KNOB, (uint8_t *)knob,
strlen(knob));
if (err) {
fprintf(stderr, "ERROR: fdb_network_set_option: %s\n",
fdb_get_error(err));
}
knob = strtok(NULL, delim);
}
}

View File

@ -118,6 +118,8 @@ FlowKnobs::FlowKnobs(bool randomize, bool isSimulated) {
init( MAX_PACKET_SEND_BYTES, 256 * 1024 );
init( MIN_PACKET_BUFFER_BYTES, 4 * 1024 );
init( MIN_PACKET_BUFFER_FREE_BYTES, 256 );
init( FLOW_TCP_NODELAY, 1 );
init( FLOW_TCP_QUICKACK, 0 );
//Sim2
init( MIN_OPEN_TIME, 0.0002 );

View File

@ -139,6 +139,8 @@ public:
int MAX_PACKET_SEND_BYTES;
int MIN_PACKET_BUFFER_BYTES;
int MIN_PACKET_BUFFER_FREE_BYTES;
int FLOW_TCP_NODELAY;
int FLOW_TCP_QUICKACK;
//Sim2
//FIMXE: more parameters could be factored out

View File

@ -409,7 +409,16 @@ private:
void init() {
// Socket settings that have to be set after connect or accept succeeds
socket.non_blocking(true);
socket.set_option(boost::asio::ip::tcp::no_delay(true));
if (FLOW_KNOBS->FLOW_TCP_NODELAY & 1) {
socket.set_option(boost::asio::ip::tcp::no_delay(true));
}
if (FLOW_KNOBS->FLOW_TCP_QUICKACK & 1) {
#ifdef __linux__
socket.set_option(boost::asio::detail::socket_option::boolean<IPPROTO_TCP, TCP_QUICKACK>(true));
#else
TraceEvent(SevWarn, "N2_InitWarn").detail("Message", "TCP_QUICKACK not supported");
#endif
}
platform::setCloseOnExec(socket.native_handle());
}