Performance: interval reads, event transforms, query copies, and HTTP exports
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- rust, sqlite
- Ambito
- backend, databases, performance
Direzione di ricerca
La issue fa riferimento a cinque PR specifiche (#676, #674, #673, #675, #677), ciascuna delle quali mira a un diverso collo di bottiglia delle prestazioni. Inizia esaminando le PR collegate per comprendere le modifiche alle interval queries, a union_no_overlap, a merge_events_by_keys, alla copia degli argomenti di query e alla serializzazione dell’esportazione HTTP. Esegui i benchmark inclusi nelle PR per verificare i miglioramenti. La validazione richiede la comprensione di Rust, degli indici SQLite e del modello dei dati degli eventi di ActivityWatch.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Track five independent performance improvements identified while reviewing 02ae248. Each fix has its own PR, independently based on master.
- Reduce historical scanning for bounded event interval queries — #676. Add a selectively used endtime-first index while preserving overlap semantics, tie ordering, and fast limited newest-first reads. The PR documents index storage/migration costs and measured bulk-insert overhead.
- Make
union_no_overlaplinear in input size and emitted fragments — #674. Replace repeated middle-of-vector insertions with a pending remainder and move events where possible. - Reduce allocations in
merge_events_by_keys— #673. Remove the unused per-group map, use the entry API, and move the first event into each group instead of cloning its JSON. - Avoid deep event-list copies for read-only query functions — #675. Borrow simple variable/literal arguments without changing query language value semantics. Related background: #119, #122, #183.
- Bound HTTP export memory — #677. Serialize one row at a time into a private temporary file and serve the completed file, preserving the export format, acknowledged writes, and pre-download HTTP errors. Temporary disk use and datastore-worker occupancy are documented tradeoffs.
Initial local probes (synthetic data, not end-to-end application measurements):
- A recent interval containing 1,001 events in a million-row in-memory SQLite database took 44.9 ms with the current index versus 0.41 ms with a forced end-time-first index. This is evidence to evaluate query selection, not a recommendation to replace the existing index unconditionally.
- Overlap merging took 176 ms at 16,000 events per input and 632 ms at 32,000 events per input.
- A grouping prototype reduced 50,000 distinct groups from 22.6 ms to 10.3 ms; with 100 groups the improvement was 11.2 ms to 10.3 ms.
Android context: ActivityWatch/aw-android#229 fixes saving WebView exports and persists queued payloads in cache files. It does not remove full-payload buffering in the Rust HTTP export path; the WebView bridge also still assembles a complete string. This item targets the Rust HTTP path only.
Validation should include representative scaling benchmarks, regression coverage for behavior and edge cases, and independent crate/API checks per PR. Checklist items remain open until their fixes are merged.
Implementation validation uses synthetic in-memory data and isolated temporary test databases only; no live database or running server was used. Reproducible benchmarks/examples are included in the PRs. Additional comparisons against upstream 02ae248:
- Rust interval benchmark, one million rows: recent 1,001-row retrieval ≈24.1 ms → 0.40 ms; recent count ≈19.7 ms → 19 µs. A 10,000-row insert probe measured ≈20% overhead for maintaining the extra index.
- Query workload, 50,000 events and 20 duration sums: ≈118.8 ms → 15.8 ms, including retrieval.
- Export serializer, 100,000 events with 256-character titles: peak RSS ≈194 MiB materialized → 52 MiB incremental. This includes the synthetic in-memory input database and excludes temporary-file I/O; it is not an HTTP throughput measurement.
- Lingua principale
- Rust
- Stelle
- 317
- Fork
- 99
- Merge medio
- 1g 13h
- PR unite (30g)
- 66
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ActivityWatch/aw-server-rust
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
ActivityWatch/aw-server-rust#767 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
ActivityWatch/aw-server-rust#763 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
ActivityWatch/aw-server-rust#724 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
ActivityWatch/aw-server-rust#717 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
ActivityWatch/aw-server-rust#714 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ActivityWatch/aw-server-rust
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
trezor/trezor-firmware#7997 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
oxidecomputer/management-gateway-service#506 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
scylladb/nodejs-rs-driver#566 ·
I maintainer di solito rispondono entro 1 giorno
-
A-ABI needs-triage relnotes relnotes-needs-review relnotes-tracking-issue T-lang T-libs T-opsem
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno