Slowing down and measuring an interface.
From: Will Hartung (willh_at_msoft.com)
Date: 01/26/05
- Next message: keith: "Re: OT: Safe Riddles"
- Previous message: H. S.: "Re: Error message for dial up PPP for ADSL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 25 Jan 2005 18:36:33 -0800
Hi all!
We want to see how well our system works over much slower network
connections than our internal 100M network connections. We're pretty sure
the system is unusable over a 56K modem, but we want a better idea of at
what level it is usable.
I've been playing with the tc command.
Here's a sample of what I've been doing:
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root tbf rate 25kbit latency 50ms burst 1540
The '25kbit' is the "knob" I've been tweaking to speed up and slow down the
site.
To be fair, I simply don't understand the 'latency' or 'burst' options. I
just don't grok what they do.
Now, what I have done is I've taken a server machine and placed it on a
crossover cable and connected it to the eth0 interface. My client PC is on
eth1, and I use the linux box (debian, 2.4 kernel) basically as a router.
I connect to the app with my PC and visually "judge" performance. I also
download 10M files through the web browser and see what Mozilla says is the
data rate. I notice that the data rate presented by Mozilla has pretty much
nothing to do with the '25kbit' value, save that if I use a value 1/2 as
large, it goes basically twice as slow. But for '25kbit' I'm getting about
500KB/sec to start and it eventually slows down to 150KB/sec towards the end
as measured by Mozilla.
The other thing I've done is I've written a Java program that connects to a
custom little Java server program. It then proceeds to exchange blocks of
meaningless data.
What is really strange is that I get a completely asymetrical behavior on
the Java program. For example, with a 25kbit setting, I'll get a measured
11KB doing an upload, but like 200KB for download.
I'm perfectly willing to blame my Java program, but I'd think that
transfering data over the socket should be reasonably straightforward.
So, anyway, my questions:
1) Is there a better technique for slowing down an interface on Linux than
what I'm using (I'm aware of tcng, but I really don't understand all of the
qdisc things and what not. Networking isn't my real forte', so I've been
applying this stuff rather hamfisted. I really just want a brute force knob
to affect the entire interface, I'm not trying to make my SSH connections
run better with competing bittorrents...)
2) By adjusting the 'rate' parameter and not adjusting the 'latency' and
'burst' options, am I just creating a lot of errors and such? Should those
other parameters change along with my 'rate'?
3) Can anyone explain why my traffic is so one sided using my crude Java
program? When I simply reset the interface, the java program reports ~8MBps
in both directions. Why doesn't the tc command affect both directions? With
tcng, there was an "ingress" and "egress" specifier to handle incoming and
outgoing traffic (though I'm not using tcng at this point). But since I'm
using the linux box as a router, I would think that during "upload" from my
PC to the server, the egress side would affect the traffic going from PC to
Linux to Server. And when I "download", the egress side would affect traffic
going from Server to Linux to PC. That doesn't make any sense to me.
4) Any suggestions on making my Java program any more reliable and
consistent? i.e. Why does Mozilla get such different numbers of measured BPS
than my Java program? The Java program is pretty darn basic. The heart of
the program looks like this:
socket = new Socket(host, port);
InputStream is = socket.getInputStream();
Then I call a util function (there's a similarly sophisticated "writeBytes"
function)
public static void readBytes(InputStream is, int totalCnt)
throws IOException
{
int blocksize = 8192;
byte buffer[] = new byte[blocksize];
int totalRcvd = 0;
while(totalRcvd != totalCnt) {
int amtToRead = blocksize;
if (amtToRead > (totalCnt - totalRcvd)) {
amtToRead = totalCnt - totalRcvd;
}
int amtRcvd = is.read(buffer, 0, amtToRead);
totalRcvd = totalRcvd + amtRcvd;
}
}
Any thoughts y'all can provide to give me a hint would be really
appreciated. I'm reasonably happy with the tc command I'm using for
throttling, but I would like to get more consistent and better numbers from
my measuring "devices".
Thanx!
Regards,
Will Hartung
(willh@msoft.com)
- Next message: keith: "Re: OT: Safe Riddles"
- Previous message: H. S.: "Re: Error message for dial up PPP for ADSL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|