nginx + DSCP (Differentied services)

Maxim Dounin mdounin at
Tue Dec 16 15:46:36 UTC 2014


On Tue, Dec 16, 2014 at 02:21:59PM +0000, Dani Bento wrote:

> Hello,
> We are using nginx-1.6 in a production environment for caching data
> from multiple remote origins.
> To improve our data distribution over the network we thought that using
> IP DiffServ/ToS to traffic shape by backend would be useful.
> We developed a small patch for the nginx core to mark packets. Because
> the nginx workers don't seem to have CAP_NET_ADMIN privileges we are
> using the TOS field instead of socket marks. This patch only marks
> client packets and not upstream/backend packets.

I had a module to set IP ToS for serveral years now, see here:

It doesn't seem to be used much though, and hence we don't import 
it (or an equivalent code) into nginx, at least yet.

> Besides that, we added an X-Accel-ClassID header so that the
> upstream/backend itself can choose the class id to use.

This doesn't looks like a good solution for me.  If you want 
allow backends to control ToS set, it may be a better idea to 
support variables in the directive in question.

> Do you find this an interesting feature to add to the nginx core? How
> can we proceed and submit a patch?

See above.  Just in case, some general guidelines on submitting 
patches can be found here:

Maxim Dounin

More information about the nginx-devel mailing list