Skip to content

Zero-block cache ignored? #240

Description

@martona

First of all huge thanks for creating and maintaining this project, it's fantastic!

I do have an issue I'm not sure what to do about. Upon startup, s3backer lists nonzero blocks and sets up the bitfield cache; from the stats file this appears to work as expected (showing the case of a brand-new block device on an empty bucket):

2025-06-15 17:31:57 INFO: starting non-zero block survey
2025-06-15 17:31:57 INFO: mounting /mnt/s3backer
2025-06-15 17:31:58 INFO: non-zero block survey completed (0 non-zero blocks reported)
http_normal_blocks_read      0
http_normal_blocks_written   0
http_zero_blocks_read        0
http_zero_blocks_written     0
http_empty_blocks_read       0
http_empty_blocks_written    0
http_gets                    16
http_puts                    1
http_deletes                 0
...
zero_block_cache_size        67108864 blocks
zero_block_cache_read_hits   0
zero_block_cache_write_hits  0
...

Then I go and create a filesystem, write a few gigabytes, and stats is showing this:

http_normal_blocks_read      25
http_normal_blocks_written   15344
http_zero_blocks_read        13080
http_zero_blocks_written     2
http_empty_blocks_read       0
http_empty_blocks_written    0
http_gets                    41
http_puts                    15345
http_deletes                 2
...
zero_block_cache_size        67095784 blocks
zero_block_cache_read_hits   12
zero_block_cache_write_hits  3
...

Am I wrong to expect 0 in http_zero_blocks_read , and a high value in cache_xxx_hits?

I wouldn't care about a few thousand unnecessary network reads (amazon will kill me on storage fees, the cost of the initial requests is just noise) but they seem to strongly impact performance as the worker threads seem to flap between "we're all checking for zero blocks" (not good) and "we're busy doing PUTs)" (great).

I'm seeing this in nbd mode as well as legacy. s3backer is built from a git pull as of a few days ago. I can provide more details and help troubleshoot if needed, but I wanted to confirm first that I'm not misinterpreting what the behavior should be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions