tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Writing to multiple descriptors with one system call

Hi is there some undocumented system call that allows a user process to
write to multiple descriptors in one go?

What I'm looking for is a variation of writev() system call, e.g.:

size_t write2v(int *d, int dcnt, const struct iovec *iov, int iovcnt);

So the application builds an array of file descriptors and an array of
iovec structures. It then calls write2v(), which goes through each file
descriptor and writes buffers from iovec structures.

Such system call can be quite useful for event driven web servers,
which handle large numbers of open connections. There may be 100s of
active connections, all requesting the same small size files, index.html
for example.

I profiled a simple event driven server, with 5000 simultaneous
connections. About 80% of the time was spent in write() system call.

I looked at do_filewritev() in sys/kern/sys_generic.c to see if it can
be adapted to handle multiple file descriptors. I'm not a kernel
developer, so I'm not quite sure if it's possible to do something like
that and how it would interact with the rest of the system.

Any thoughts?

Home | Main Index | Thread Index | Old Index