canonical / canonical/dqlite

posix_fallocate extremely slow on ext3 file system

Open
#653 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C
Stars
4.4k
Forks
254
PR merge metrics
No merged PRs in 30d

Description

posix_fallocate is extremely slow on ext3 file system (~12s for 8mb file) when file is opened with O_DSYNC flag.
This causes overall slowdown in dqlite execution when log/snapshot files are to be written. For instance, the average response time per request increases from 5ms for 1000 requests to a sluggish 25ms for 10,000 requests on our 3 node cluster setup.

I tried manualling setting fallocate to false in uv_fs.c [here](https://github.com/LakshK98/dqlite/blob/2eadfe4dd6f06272aa95283892544e6347870c31/src/raft/uv_fs.c#L202) so that the fallocate emulation logic is executed. This reduces avg response time for 10k requests to around 5-6 ms.

Would it possible to set fallocate to false on ext3 file systems in probeFallocate?

Contributor guide

Open the contributing guide

Research direction

The report points to src/raft/uv_fs.c, including probeFallocate and the fallocate handling around line 202. Read that path first, then verify behavior on ext3 with O_DSYNC; done means ext3 selects the emulation path without regressing other filesystems.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
database, operating-systems, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.