5 ms·
When I was writing a game engine and doing a multithreaded resource loading system using job queues, I was concerned about TLB shootdowns, but was unable to rea
by Negitivefrags 3y ago
When I was writing a game engine and doing a multithreaded resource loading system using job queues, I was concerned about TLB shootdowns, but was unable to really experience the issues with them.
I tried both regular IO and mmap and was unable to make regular IO as fast as mmap.
This is on a machine with 32 real cores running 64 job threads, saturating all of them with jobs. The jobs are a mixture of small (metadata) and big (textures and models) files. In theory, this should be a pretty bad situation for the TLB shootdown, and I was concerned about them.
But in reality it seemed to be fine, and a fair amount faster than with regular IO due to being able to have one less extra copy of the data.
- vlovich123 3y agoYou’d be surprised how difficult it can be to create such a scenario and detect when you do, especially using a synthetic benchmark. In terms of regular io, did you remember to do O_DIRECT? Also yes, I/O paths are slower than mmap for pure throughput in most cases. Databases are a special snowflake though. In some ways you’d want the I/O layer in the kernel like with a filesystem which is why databases typically go the other way and try to bypass the kernel to keep their code in user space