Skip to contentSkip to conversation

Clamping tcp mss values to decrease latency

LARTC Ross Skaliotis 3 participants 11 messages Feb 25, 2002 – Feb 28, 2002

lore
Share & tools
lore
#0 lore raw

Hello,

I have an interesting question. I can't find a solution anywhere to this problem.

I have an adsl connection which is able to send a full data packet in about 150ms. I want to cut this time down to decrease latency while serving files, so I thought I'd try and reduce the packet size for the offending upload streams (my webserver). The trick is that I also want all other tcp connections to have the normal full packet size. Enter MSS-clamping. My pppoe client for linux can do mss clamping on every packet that goes out and come in. Not enough control. There is an option to do mss-clamping in iptables, however this only works in the forward table. I can't match and control outgoing web connections, just connections getting routed through the machine. Any ideas?

-Ross Skaliotis

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/

#1 lore raw

Hi,

MSS can be clamped per route. See ip tool and LARTC howto for syntax. I'm using it with great success. devik

Quoted 5 lines

MSS-clamping. My pppoe client for linux can do mss clamping on every packet that goes out and come in. Not enough control. There is an option to do mss-clamping in iptables, however this only works in the forward table. I can't match and control outgoing web connections, just connections getting routed through the machine. Any ideas?

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/

#2 lore raw
In reply to Ross Skaliotis
Quoted 5 lines · Ross Skaliotis

Hello,

I have an interesting question. I can't find a solution anywhere to this problem.

Quoted 9 lines

I have an adsl connection which is able to send a full data packet in about 150ms. I want to cut this time down to decrease latency while serving files, so I thought I'd try and reduce the packet size for the offending upload streams (my webserver). The trick is that I also want all other tcp connections to have the normal full packet size. Enter MSS-clamping. My pppoe client for linux can do mss clamping on every packet that goes out and come in. Not enough control. There is an option to do mss-clamping in iptables, however this only works in the forward table. I can't match and control outgoing web connections, just

Control and outgoing can be done with regular MTU settings. Just lower the MTU size of your ppp interface and the kernel will set a lower MSS automatically.

You can also set MTU per route.

Regards,

bert

Signature · 6 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
http://www.tk                              the dot in .tk
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
#3 lore raw
In reply to Ross Skaliotis
Quoted 9 lines
Quoted 5 lines

other tcp connections to have the normal full packet size. Enter MSS-clamping. My pppoe client for linux can do mss clamping on every packet that goes out and come in. Not enough control. There is an option to do mss-clamping in iptables, however this only works in the forward table. I can't match and control outgoing web connections, just

Control and outgoing can be done with regular MTU settings. Just lower the MTU size of your ppp interface and the kernel will set a lower MSS automatically.

Be VERY careful when doing it. There is too many websites blocking MTU discovery protocol and you will be no longer able to reach them. These system maintainers should be shot. :-\
Setting max MSS in route is better way ..

Quoted 1 line

You can also set MTU per route.

you probably wanted to say MSS here ?

devik

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/

#4 lore raw
In reply to Ross Skaliotis
Quoted 6 lines · Martin Devera
Quoted 6 lines
Quoted 5 lines

other tcp connections to have the normal full packet size. Enter MSS-clamping. My pppoe client for linux can do mss clamping on every packet that goes out and come in. Not enough control. There is an option to do mss-clamping in iptables, however this only works in the forward table. I can't match and control outgoing web connections, just

Quoted 8 lines
Quoted 3 lines

Control and outgoing can be done with regular MTU settings. Just lower the MTU size of your ppp interface and the kernel will set a lower MSS automatically.

Be VERY careful when doing it. There is too many websites blocking MTU discovery protocol and you will be no longer able to reach them. These system maintainers should be shot. :-\
Setting max MSS in route is better way ..

Not for locally generated packets - if you lower MTU, MSS will get set too.

Regards,

bert

Signature · 6 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
http://www.tk                              the dot in .tk
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
#5 lore raw
In reply to Ross Skaliotis
Quoted 6 lines
Quoted 4 lines

Be VERY careful when doing it. There is too many websites blocking MTU discovery protocol and you will be no longer able to reach them. These system maintainers should be shot. :-\
Setting max MSS in route is better way ..

Not for locally generated packets - if you lower MTU, MSS will get set too.

At my production server when I set MTU to 640 (I hoped in better link utilization) I suddenly was not able to reach some webs from it. I discovered that the are sending me 1500 byte packets with DF set and they didn't pay atttention to my MTU. It is obvious problem in MTU discovery.

You are roght that MSS is set to MTU but it is bad luck it you have small MSS but you can't reach some hosts.

MSS setting for routes works well for me even for localy generated flows. Is there some problem I don't see ?

regards, devik

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/

#6 lore raw
In reply to Ross Skaliotis

Yes, but is this able to sort streams by tcp port?

-Ross

Quoted 13 lines · Martin Devera

Hi,

MSS can be clamped per route. See ip tool and LARTC howto for syntax. I'm using it with great success. devik

Quoted 5 lines

MSS-clamping. My pppoe client for linux can do mss clamping on every packet that goes out and come in. Not enough control. There is an option to do mss-clamping in iptables, however this only works in the forward table. I can't match and control outgoing web connections, just connections getting routed through the machine. Any ideas?

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/

#7 lore raw
In reply to Ross Skaliotis

Hmm .. IIRC the fwmark can be used as routing
key. It might do the trick. Am I right Bert ?

Quoted 5 lines

Yes, but is this able to sort streams by tcp port?

Quoted 3 lines

MSS can be clamped per route. See ip tool and LARTC howto for syntax. I'm using it with great success. devik

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/

#8 lore raw
In reply to Ross Skaliotis
Quoted 11 lines · Martin Devera

At my production server when I set MTU to 640 (I hoped in better link utilization) I suddenly was not able to reach some webs from it. I discovered that the are sending me 1500 byte packets with DF set and they didn't pay atttention to my MTU. It is obvious problem in MTU discovery.

You are roght that MSS is set to MTU but it is bad luck it you have small MSS but you can't reach some hosts.

MSS setting for routes works well for me even for localy generated flows. Is there some problem I don't see ?

No ;-)

Signature · 6 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
http://www.tk                              the dot in .tk
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
#9 lore raw
In reply to Ross Skaliotis
Quoted 9 lines
Quoted 7 lines

discovery.

You are roght that MSS is set to MTU but it is bad luck it you have small MSS but you can't reach some hosts.

MSS setting for routes works well for me even for localy generated flows. Is there some problem I don't see ?

No ;-)

So short reply to my long mail ;-)) You are probably really short of your tea ;)
By the way I finally read your man pages - good work. Once I finish new htb I could write FIXME parts.
devik

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/

#10 lore raw
In reply to Ross Skaliotis
Quoted 2 lines · Martin Devera

Hmm .. IIRC the fwmark can be used as routing
key. It might do the trick. Am I right Bert ?

I think it might!

Signature · 6 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
http://www.tk                              the dot in .tk
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/