4 ms·
Running things in kernel space doesn't make them faster.
by tga_d 4y ago
Running things in kernel space doesn't make them faster.
- insanitybit 4y agoIt can absolutely make things faster. If your program is running on data that exists in the kernel you don't need to copy it over to userland/ perform expensive context switching.
- tga_d 4y agoIt can make things faster is not the same as simply running it in the kernel will make it faster. There are definitely certain situations that making use of fewer context switches helps with, and where page mapping isn't sufficient, but if you just write an entire user-space web server, then just compile it as a kernel module, expecting it to see a notable performance improvement, you're going to be disappointed. edit to clarify: the reason it won't help (much) is because most of the things it would help with have already been optimized via features like CoW pages, the VDSO, sendfile, etc.
- insanitybit 4y agoWeb server sounds like exactly the kind of workload that will benefit from moving to the kernel.
- sitkack 4y agohttps://en.wikipedia.org/wiki/In-kernel_web_server https://en.wikipedia.org/wiki/In-kernel_web_server
- insanitybit 4y agoYeah, unikernels try to exploit the benefits as well.
- kaba0 4y agoWould that really give a sizable benefit over, say async IO? Especially an “automatic” one like Java’s Loom?
- insanitybit 4y agoYes, it can still have significant benefits. Async IO is an attempt to get around the performance issues and, given lots of kernel support that largely does not exist today, it can bridge the gap to a degree, but it's never going to match just avoiding the entire issue. You can use things like XDP to get a lot of performance back but 0 context switches/ 0 copies is always going to be faster.