I am trying to write an application that will need to be written to disk very quickly. I hit my target performance for writing to disk, and that's great.
However, I noticed that writing to disk uses CPU time so fast: one core is maximized, the other 80%, and the other 2 10-20%. Therefore, I heard that O_DIRECT can reduce CPU consumption by avoiding all these copies in kernel space and then copying to disk.
I conducted a small test program that confirmed this: CPU usage drops to 50% of a single core - much better.
However, I never had the same bandwidth as with regular recording, and to make it fast, I had to use a really large recording size (something like 130 MB!)
So the question is what I think:
- Is there a better way to reduce CPU usage than O_DIRECT for writing? or
- How can I get a similar throughput for what the kernel gets?
My environment is Linux, I use RAID 50, and I can write records until I get the optimal write size. There will be only one writer at a time.
source share