the-moisrex / webpp

C++ web framework | web development can be done with C++ as well.
https://t.me/webpp
MIT License
125 stars 9 forks source link

Zero-Copy Transfer #363

Open the-moisrex opened 1 year ago

the-moisrex commented 1 year ago

In unix-like systems, it's possible to send files using "sendfile" (or other syscalls) to gain a little bit of performance boost but it would mean we can't use things like "gzip" and in-memory caching and what not.

sendfile only works with the type of file descriptors that can work with mmap-like functions; meaning:

The mmap() function shall be supported for the following memory objects:

  • Regular files

  • Shared memory objects

  • Typed memory objects

Starting with kernel 2.6.17, Linux provides three new (nonstandard) system calls—splice(), vmsplice(), and tee()—that provide a superset of the functionality of sendfile().

Is is a good idea for view_manager to store the files as differently?

the-moisrex commented 1 year ago

I'm not sure if sendmsg, and recvmmsg have MSG_ZEROCOPY flag or not.