public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [network feature request] Optimized sys_accept and sys_connect
@ 2015-06-03  1:59 Alexey Syrnikov
  0 siblings, 0 replies; only message in thread
From: Alexey Syrnikov @ 2015-06-03  1:59 UTC (permalink / raw)
  To: linux-kernel

Hello, kernel developers.

Many network server (HTTP for example) currently work in such way:

  accept -> read (once) -> write (typically once) -> close

So, this sequence can be optimized by making accept and read in one
syscall. When socket ready to accept it can already have data (delivered
in 3-rd tcp packet in 3-way handshake with SYN+ACK). Making accept and
read at once we will

1) reduce syscalls (one in place of two)
2) reduce network latancy (at least for 1 mks, it is ~1000 CPU ticks for
syscall)
The cost: new syscall and bit of code

Because some protocols requires server at first send data to connected
client, this syscall can also do accept+write. This behavior can be
switched by some flag (accept+read or accept+write). I call it
sys_accept_plus :)

The same apply to connect+write. Network client at connecting stage
already knows which HTTP request they need to send. So making connect
and write in one syscall we will

1) make one syscall (not two)
2) reduce network latency
3) send GET request with the same (in most cases single) TCP packet as
last SYN+ACK without waiting sys_write (as in separate connect and write).
Costs are same: one extra syscall and bit of code.

This is sys_connect_plus.

I did not think about error reporting (userspace code need to know when
error happens at first or second stage and some errors have same codes).

What do You think about such feature?

Alex

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-03  2:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-03  1:59 [network feature request] Optimized sys_accept and sys_connect Alexey Syrnikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox