Tweaking tcp buffer settings

Search This thread

swaaye

Senior Member
Mar 16, 2011
454
74
I'd like to tweak the tcp.rmem settings that come stock. The maximum buffer size (110208 bytes) is quite low for a high speed connection.

I've tried build.prop, init.rc, and init.local.rc. I checked the results with "sysctl -a | grep tcp".

/system/build.prop - no effect (is everybody around the web enjoying placebo?)
net.tcp.buffersize.default=4096,87380,524288,4096,16384,110208
net.tcp.buffersize.wifi=4096,87380,524288,4096,16384,110208

/system/etc/init.local.rc - doesn't seem to be used by the OS?
setprop net.tcp.buffersize.default 4096,87380,524288,4096,16384,110208;
setprop net.tcp.buffersize.wifi 4096,87380,524288,4096,16384,110208;

/init.rc - is seemingly recreated on each boot with some predefined numbers
setprop net.tcp.buffersize.default 4096,87380,524288,4096,16384,110208;
setprop net.tcp.buffersize.wifi 4096,87380,524288,4096,16384,110208;

[in these values the first three #s are receive (min,start,max), second three are send (min,start,max)]. TCP auto adjusts between min and max.

issuing the setprop commands by terminal works but that isn't really ideal. ;)
 
Last edited:

swaaye

Senior Member
Mar 16, 2011
454
74
defaults are (init.rc):
setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208

the first 110208 in these is the max allowed tcp receive buffer size and it really isn't ideal for say a 10+ mbps connection. A value of 262144 would be more appropriate. Even 524288 perhaps for 20-30 mbps though a 63mbps wifi connection is probably too slow for this to be beneficial.

good idea on just using a custom script.....
 

Helltoupee

Senior Member
Oct 23, 2008
59
9
I have successfully set up V6 Supercharger Script on CM9 so I would assume it should work on CM7 if that's what you are running. If you want to go that route. May be placebo effect but it seemed to make an improvement in many areas.

Sent from my CM9 Nook Tablet using Tapatalk
 

admiralspark

Senior Member
Jul 1, 2011
83
37
defaults are (init.rc):
setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208

the first 110208 in these is the max allowed tcp receive buffer size and it really isn't ideal for say a 10+ mbps connection. A value of 262144 would be more appropriate. Even 524288 perhaps for 20-30 mbps though a 63mbps wifi connection is probably too slow for this to be beneficial.

good idea on just using a custom script.....

I believe (and this is not a 100% sure guarantee) that the stock values are set in the source, in the driver code for the linux networking stack. If that's the case, the easiest way is to run the aforementioned script to just set it to different values on boot.
Can you get values through, say,
Code:
cat /proc/sys/net/ipv4/tcp_mem
?

The default allocated memory is based on system ram. But, if you're on a ~10mbps connection, you're not going to notice much of a pickup over stock with 26kb of tcp buffer. I mean, on a 10MBPS connection you should have low latency (well under 100ms), increasing the buffer won't 'speed it up'.

However, this site recommends setting it to 12MB (12582912), to increase performance on higher-latency connections (essentially, not local connections). Try that?