Skip to content
Permalink
Browse files
Impose minimum buffer sizes when auto-tuning TCP
For nodes with extremely low capacity, the send/recv buffer sizes shrink
unacceptable low. According to 'man tcp' the buffer sizes only seem to
shrink when under memory pressure, but its not exactly clear how
auto-tuning is implemented in the real kernel.

refs #62
  • Loading branch information
robgjansen committed Sep 12, 2012
1 parent 23d0968 commit 3652ead7192b1764dac1448d83947a787b203db0
Showing with 24 additions and 0 deletions.
  1. +16 −0 src/configuration/shd-configuration.h
  2. +8 −0 src/node/descriptor/shd-tcp.c
@@ -151,6 +151,22 @@ typedef guint64 SimulationTime;
*/
#define CONFIG_TCPAUTOTUNE TRUE

/**
* Minimum size of the send buffer per socket when TCP-autotuning is used.
* This value was computed from "man tcp"
*
* @todo change this to a command line option accessible via #Configuration
*/
#define CONFIG_SEND_BUFFER_MIN_SIZE 16384

/**
* Minimum size of the receive buffer per socket when TCP-autotuning is used.
* This value was computed from "man tcp"
*
* @todo change this to a command line option accessible via #Configuration
*/
#define CONFIG_RECV_BUFFER_MIN_SIZE 87380

/**
* Default size of the send buffer per socket if TCP-autotuning is not used.
* This value was computed from "man tcp"
@@ -310,6 +310,14 @@ static void _tcp_autotune(TCP* tcp) {
/* the delay bandwidth product is how many bytes I can receive at once to keep the pipe full */
guint64 receivebuf_size = (guint64) (rtt_milliseconds * receive_bottleneck_bw * 1.25);

/* keep minimum buffer size bounds */
if(sendbuf_size < CONFIG_SEND_BUFFER_MIN_SIZE) {
sendbuf_size = CONFIG_SEND_BUFFER_MIN_SIZE;
}
if(receivebuf_size < CONFIG_RECV_BUFFER_MIN_SIZE) {
receivebuf_size = CONFIG_RECV_BUFFER_MIN_SIZE;
}

/* make sure the user hasnt already written to the buffer, because if we
* shrink it, our buffer math would overflow the size variable
*/

0 comments on commit 3652ead

Please sign in to comment.