phaistos-networks / TANK

A very high performance distributed log service
Apache License 2.0
938 stars 70 forks source link

Raw disk access? #49

Closed pkamenarsky closed 7 years ago

pkamenarsky commented 7 years ago

From the core concepts:

All bundles(which include messages) are stored physically in segments on each broker's underlying filesystem.

Is there performance to be gained by writing directly to disk, without the overhead of a filesystem? Most, if not all of the filesystem features wouldn't be needed anyway.

markpapadakis commented 7 years ago

Not really. If you bypass the kernel buffer, each write is effectively a blocking write. DirectIO is required for AIO, and it can be useful if your application tends to its own caching needs (no need to cache both on the application and on the kernel), but for Tank and other such systems, it makes no real sense to use direct I/O IMO.

pkamenarsky commented 7 years ago

I see - so there are no guarantees that a write is going to be persisted to disk in case of a crash, correct?

markpapadakis commented 7 years ago

Tank will periodically (every few ms) will fdatasync() so that writes will persist to disk, and, worse case scenario, you will lose some 100s of ms worth of data if the OS crashes between commits. I think it's a good compromise.