[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A question about priorities

  I was doing a very simple experiment to test priorities with qdisc,
but the results to not turn out as expected. I describe the experiment
and problems below. 

Experiment: We have a client on one machine (433 Mhz,PII) which opens two
TCP connections with a server on another machine (500 Mhz, P2).
The machines are connected by a dedicated cross over cable.
The server dumps data on both the connections as fast as it can.
(In the server code, we repeatedly check using "select" which of the two
sockets has space and write 4k bytes to it. This continues indefinitely in a 
"while" loop. Thus we dump as much data as we can on both the connections 
in a fair manner.)

As expected when no priorities are set, both Connection 1 and 
Connection 2 receive equal amounts of data.

Now we give connection 1 priority over connection 2, by setting 
setsockopt( ..., SO_PRIORITY,...)  in the user space ,
and executing qdisc add dev eth0  root prio bands 16 priomap 0 1 2 ...

We expected now that connection 1 should receive close to 100% of the 
data, and connection 2 should not receive any data. 
But it turns that connection 1 gets only 55% of the data and connection
still gets 45% of the data (this is the case when the total bandwidth
is small, just 10Mb/s.)
This 55-45% reading is repeatedly the case for all the runs of our experiment.

A further puzzling thing is that when we used UDP instead of TCP,
 the higher priority connection was able to get 100% of the bandwidth.

Any explanations as to why are things not working out as they should with TCP.
Any other way of using qdisc to obtain the desired results under TCP?