S
sherkhan
Hello Everyone.
I have come across this article (http://dast.nlanr.net/Projects/
Autobuf_v1.0/autotcp.html) called "Automatic TCP window tuning". After
my first newbie file transfer I wrote and found that it was just
extremely slow over net, compared to http or ftp. I have been thinking
of reasons. After reading the article I modified the server and
clients.. in the following way..
server...
/*setting socket Opttions to windows size to 780K.. 780 * 1024
*/
int window_size = 2000 * 1024;
mySocket = socket(AF_INET, SOCK_STREAM, 0);
setsockopt(mySocket, SOL_SOCKET, SO_SNDBUF,
(char *) &window_size, sizeof(window_size));
setsockopt(mySocket, SOL_SOCKET, SO_RCVBUF,
(char *) &window_size, sizeof(window_size));
on client...
/*set Socket Option.. 1000 * 1024*/
int window_size = 780 * 1024;
s = socket(AF_INET, SOCK_STREAM, 0);
setsockopt(s, SOL_SOCKET, SO_SNDBUF,
(char *) &window_size, sizeof(window_size));
setsockopt(s, SOL_SOCKET, SO_RCVBUF,
(char *) &window_size, sizeof(window_size));
/*End Of set Socket Option*/
with this I got a better transfer rate.. I mean 10 times faster.
its even better in LAN. I got 1 GB transfered in 200 secs. faster than
it took to create the file.
Now I have a question, do Apache (HTTP server) and FTP servers employ
such a TCP window tunning. Is it hard coded ( I mean is there a
optimum value known ?) for all types of networks ?
since even when I download a file through HTTP its nearly the same
speed, as I achieved by increasing the TCP window.
cheers.
I have come across this article (http://dast.nlanr.net/Projects/
Autobuf_v1.0/autotcp.html) called "Automatic TCP window tuning". After
my first newbie file transfer I wrote and found that it was just
extremely slow over net, compared to http or ftp. I have been thinking
of reasons. After reading the article I modified the server and
clients.. in the following way..
server...
/*setting socket Opttions to windows size to 780K.. 780 * 1024
*/
int window_size = 2000 * 1024;
mySocket = socket(AF_INET, SOCK_STREAM, 0);
setsockopt(mySocket, SOL_SOCKET, SO_SNDBUF,
(char *) &window_size, sizeof(window_size));
setsockopt(mySocket, SOL_SOCKET, SO_RCVBUF,
(char *) &window_size, sizeof(window_size));
on client...
/*set Socket Option.. 1000 * 1024*/
int window_size = 780 * 1024;
s = socket(AF_INET, SOCK_STREAM, 0);
setsockopt(s, SOL_SOCKET, SO_SNDBUF,
(char *) &window_size, sizeof(window_size));
setsockopt(s, SOL_SOCKET, SO_RCVBUF,
(char *) &window_size, sizeof(window_size));
/*End Of set Socket Option*/
with this I got a better transfer rate.. I mean 10 times faster.
its even better in LAN. I got 1 GB transfered in 200 secs. faster than
it took to create the file.
Now I have a question, do Apache (HTTP server) and FTP servers employ
such a TCP window tunning. Is it hard coded ( I mean is there a
optimum value known ?) for all types of networks ?
since even when I download a file through HTTP its nearly the same
speed, as I achieved by increasing the TCP window.
cheers.