OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: Task listing reads records one at a time; local Compile polls every 30 s regardless of poll_interval_ms

Open ragnos-dev opened this issue 2 weeks ago • 1 comments

Version

OpenViking v0.5.4 (9dfa9017a). The same code is on current main (checked 2026-11-13).

Summary

Two separate throughput problems in task handling:

  1. Listing tasks (openviking/service/task_store.py) reads every durable task record sequentially, so a list call on object storage with a few thousand records takes minutes.
  2. The local Compile client in openviking/service/compile_service.py is built with poll_interval_ms=30000 hard-coded, although the compile configuration has a poll_interval_ms setting (default 5000) that the remote client honours.

Reproduction

  1. Create a few thousand task records on a store with read latency and call the task list endpoint. Time grows linearly with the record count.
  2. Set poll_interval_ms low and run a local Compile. It still polls every 30 seconds.

Proposed fix

  • Read records in bounded concurrent groups (for example 16 at a time) with the same owner checks, filters and ordering.
  • Pass self._config.poll_interval_ms to the local client.

We run a local patch with both changes and are happy to open a PR (or split it in two).

ragnos-dev avatar Nov 13 '26 14:11 ragnos-dev

I looked into part 1 of this issue (part 2 was fixed by #7782) and reproduced it with the real TaskTracker / PersistentTaskStore over an in-memory AGFS double with a fixed read latency: 2000 records at 20 ms per read take about 49 s to list, with one read in flight at a time.

I opened #8356 with a small patch (about 60 changed lines in openviking/service/task_store.py plus one contract test). _list_owner_page() and _list_owner_payloads() share one reader that loads the owner's task files in groups of FILE_TASK_CONCURRENCY (8) through the existing bounded_map. Owner checks, filters, ordering and the handling of missing or malformed files stay the same. The same reproduction drops from 48.8 s to 6.5 s and returns identical tasks in identical order.

Two things I would like to confirm:

  1. @ragnos-dev you mentioned running a local patch. If you would rather open yours, I am happy to close mine, or to review yours.
  2. @qin-ctx #6265 removed the store-wide I/O limit so list reads cannot hold back state writes. My patch adds no shared limit and writes take no slot, but each listing can use up to 8 executor threads instead of 1. With the default 64-thread executor, 8 or more simultaneous listings can fill it; in my reproduction a state write then waited about 25 ms (50 ms reads) instead of about 1 ms. Is a per-listing bound of 8 acceptable here, or would you prefer a lower one?

I left list_durable() and the cleanup scan unchanged.

quiet-tensor avatar Nov 24 '26 08:11 quiet-tensor