by codedokode · 3mo ago · 0 comments
Of course one could optimize this - for example, while fsync is being executed, we could accept the queries from other clients and execute them, and once previous flush finishes, flush multiple transactions at once. However, I am not sure if Redis can do this due to being single-thread.
And obviously maybe there are problems with drivers, or with my consumer-level SSD and maybe "professional" SSDs can do more flushes per second.
Writing the code took less than a minute. I often do microbenchmarks now because it is so easy.
Redis AOF isn't one fsync per record—Redis can use group commit to share fsync across multiple commands. In other words, that could mean a difference of tens of times in your benchmark. I see it differently.
fio --rw=write --ioengine=sync --fdatasync=1 --directory=test-data --size=220m --bs=2300 --name=mytest
Consumer grade SSDs 100-500 iops, datacenter SSDs in thousands (like ~ 5 year old samsung model on Hetzher AFAIR had ~ 3000 iops in that test). Cheap VPSes - easily in 5-30 iops of this sortmore often then not, fsync/fdatasync is overlooked by programmers