Skip to content

Poor append-only performance with large files #1054

Open
@andyp1per

Description

@andyp1per

My setup:

W25N01GV, 2Gbit chip, with 2k pages and 128k blocks

    fs_cfg.read_size = page_size;
    fs_cfg.prog_size = page_size;
    fs_cfg.block_size = block_size;
    fs_cfg.block_count = block_count;
    fs_cfg.metadata_max = page_size;
    fs_cfg.lookahead_size = 128;
    fs_cfg.cache_size = page_size;

I am trying to write an append-only log file at about 318kB/s which is 158 pages/s. The chip will easily do writes at 1MB/s.
I am only syncing the file per-block by using the algorithm in #564 (comment)
The subsystem is writing data a page (2k) at a time.

My logging subsystem is doing no reads (I instrumented read() to check) but I see pages being read at about 274/s.
Worse the write speed slows down as the file gets bigger - going down to 90kB/s. Start a new file and the write speed bounces back up.
sync takes about 11ms, which is slow but not awful.

So my questions:

  • what in littlefs is reading all the pages? It's going to severely limit the amount of writing I can do
  • will making the cache bigger help? If so at what cost?
  • Why the slowdown over time related to filesize.

I have read the DESIGN.md, numerous issues and the code but am no closer to understanding what is actually going on here and why the performance is so poor.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions