spacejam / rio

pure rust io_uring library, built on libc, thread & async friendly, misuse resistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How does this library help batching syscalls for network I/O?

kant777 opened this issue · comments

I am new to this library and I am trying to figure out how does this library help batching syscalls for network I/O. my use case is I am trying to use this library to broadcast a stream of messages m1,m2, m3....to all the connected sockets of my server. so if there are 1000 clients connected to my server I want to broadcast each message to all 1000 and I am trying to accomplish this is in as few syscalls as possible because called syscall.send on every socket descriptor seems to be the bottleneck of my server to scale. Latency is very important for my app.

Below are my questions/comments about rio library

  1. does calling ring.write_at makes a syscall? I am assuming the answer is no since it returns a Future however I assume calling ring.write_at.await? will make a syscall. so if I need to batch I need to call ring.write_at for each individual message I want to broadcast and add then call ring.submit_all? but then what I do with each each individual future I get from calling ring.write_at?
  2. How do I handle backpressure in my app if the submission queue is full? what I do? just keep retrying forever?