Re: SO_REUSEPORT - can it be done in kernel?

Eric Dumazet
2011-03-02T02:00:09Z

Le mercredi 02 mars 2011 à 08:23 +0800, Herbert Xu a écrit :
> On Tue, Mar 01, 2011 at 05:31:24PM +0100, Eric Dumazet wrote:
> >
> > This wont work for tcp streams, you could imagine a multi-threaded
> > application using a shared tcp socket as well. Too many OOO packets.
>
> Think about it, a TCP socket cannot be used by a multi-threaded app
> in a scalable way.

Well...

If you think about it, SO_REUSEPORT patch has exactly the same goal :

Let each thread use a different socket, to scale without kernel limits.

We cant modify TX selection each time we want to "fix" a problem without
changing user side (not adding an API), and as side effect make non
optimal applications become miserable.

We added RPS and XPS that works correctly if each socket is used by one
thread. Maybe we need to add an user API or automatically detect a
particular DGRAM socket is used by many different threads to :

0) Decide OOM is ok for this workload (many threads issuing send() at
the same time)

1) Setup several receive queues (up to num_possible_cpus())

2) Use an appropriate TX queue selection