Repository navigation
perf: cut peak RSS by 89%, disk by 34%, and live TopK latency by 29x while preserving durability - #1886
Closed
VibeSWE wants to merge 777 commits into
Closed
perf: cut peak RSS by 89%, disk by 34%, and live TopK latency by 29x while preserving durability#1886VibeSWE wants to merge 777 commits into
VibeSWE wants to merge 777 commits into
Conversation
The floating quay.io/parseablehq/quest:main image now expects 202 from stream deletion. This server still deletes synchronously and returns 200, so TestSmokeRbacBasic and TestSmokeRoles fail on main and on every pull request. The previous image digest is no longer available from the registry, so build Quest from the last source commit before that change. The compose files take the image and pull policy from QUEST_IMAGE and QUEST_PULL_POLICY and keep their previous defaults. Refs #151 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…dary' into feat/postgres-metastore
…tore The cache branch made the object-store stream listing probe datasets sixteen at a time. That code now lives in the shared document metastore macro, so the bounded probe and its helper move there, and the two tests the cache branch added move into the object-store metastore tests. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ci: build Quest from a pinned source commit
…adata-boundary refactor: route metadata lifecycle operations through the Metastore trait
…t-cache perf: cache and validate small Parquet files to cut object-store round trips per query
feat: opt-in PostgreSQL metastore with import, export and verify tooling
Share the pinned source definition and select an image-only service when QUEST_IMAGE is supplied. Preserve CI no-build/no-pull behavior and avoid ref-derived tags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ci: default local compose runs to the pinned Quest build
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…config fix(kafka): take destination tenant from trusted config, not message headers
Ports upstream parseablehq/parseable 0de90cf. Addresses in 64:ff9b::/96 (RFC 6052) and 64:ff9b:1::/48 (RFC 8215) embed an IPv4 destination, so a target resolving to one could reach a private IPv4 address past the policy. They now need allow_private plus an allowlist match, like other private ranges. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… endpoints Ports the protobuf handling of upstream parseablehq/parseable 3767d38. Requests with Content-Type application/x-protobuf were rejected as unsupported. They are now decoded into the typed export request and flattened by the protobuf flatteners the crate already had, then staged through the same push_logs path, flatten budget and field-count check as OTLP JSON. A malformed body is a 400 and produces no rows. The payload limit the routes already apply is re-checked before decoding. prost goes from 0.13 to 0.14 to match the version opentelemetry-proto implements Message with; the lockfile only loses the unused 0.13 copy. Upstream's surrounding refactor of flatten_and_push_logs and its dataset-tag header handling are not part of this port. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…r review - A successful protobuf export now carries Content-Type application/x-protobuf, as OTLP/HTTP requires (the full-success response encodes to zero bytes). JSON responses are unchanged. - The decode error no longer repeats prost's own "failed to decode Protobuf message" prefix. - Drop the payload-size re-check: the routes' PayloadConfig rejects an oversized body with 413 before the handler runs, so it could not fire. Without it the handler-level content-type test for protobuf is back. - The truncation test claimed more than it proves: a body cut between two top-level entries is a valid shorter request. - The ingestion UI said protobuf has to be converted by a collector. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Compare the same typed fixtures in a release decode and flatten example and in paired local-store experiments. Record server instructions and CPU time, require SQL row and identity parity, and probe the OTLP HTTP contract. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Address the Astra 6.2 review of the progressive certified-bounds TopK: - Never split a file scan with a pushed-down limit into per-file units (each copy would re-apply the limit). - Keep uncertified files of a split scan in at most min(target_partitions, original group count) size-balanced groups. - Count every unit, unbounded ones included, against one shared target_partitions budget of running partitions. - Reserve held TopK rows and merge buffers in the query memory pool. - Build per-file units from a file-less template config (linear planning) and prune pending bounded units only when the threshold changes, by popping the prunable suffix of the best-first queue. - Require a no-NULL certificate on every byte-range piece of a file. - Give each execution fresh unit state (reset scan work queues) and its own dynamic filter, rebound into the Parquet scans and marked complete when the run ends. - Let bounded units use spare budget once unbounded units have run for OVERLAP_DELAY; thresholds from completed units already prune safely. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Address Astra 6.2 Review B findings on parallel log clustering (Q3): - P0-2: clustered row groups stop taking rows at 128 MiB of Arrow data (CLUSTER_ROW_GROUP_MAX_BYTES), counted per decoded batch identically in the parallel source and the sequential fallback, so both writers cut the same groups. Groups of ordinary rows are unchanged and byte-identical. Each row group now reports the bytes its finished rows actually retain (allocations deduplicated, so IPC-shared buffers count once); once one exceeds 64 MiB the rest of the file is read, encoded and appended one group at a time with no read-ahead or overlap. - P0-3/P1-6: FieldStatsAccumulator tracks retained value bytes and approximate mode. Inline clustered stats are dropped immediately when they exceed MAX_INLINE_FIELD_STATS_BYTES (16 MiB) or become approximate, and the upload path rereads the file. The staged stats cache refuses entries over 16 MiB and evicts oldest entries beyond 64 MiB total. - P1-5: after the first byte-limit split, later row groups go straight to the split-aware encoder (sticky), and row-limit splits are predicted without encoding twice. - P2: docs narrow the row-group time-pruning claim and describe the 64 MiB / 128 MiB actual-byte thresholds and stats dropping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…istency, and staging two-phase filter
…ck, cancellation, and empty-batch merge
… 'f519901e' into t3/investigate-ingest-performance
… float eq pruning
…performance perf(ingest,staging,query): single-hop ingest, parallel Parquet conversion, certified-bounds TopK, and filter-first staging scans
Upload verification - P_VERIFY_UPLOAD_HEAD defaults to true again, as upstream checks every upload unconditionally: the size the store reports for an uploaded Parquet file is compared with the staged file before the file is published in the manifest and its staged source is deleted. Only an explicit false/0/no/off opts out, and that is logged. - A single PUT (S3, GCS, Azure) now fails before the request unless the file read is exactly as long as it was measured, as a multipart upload already did. The read is capped one byte past that length. Local filesystem store - Non-Parquet put_object (manifest.json, .stream.json, .schema, ...) is committed through a synced private file and an atomic rename instead of a truncating write in place. The replacement carries the replaced file's mode. A name that only a write through it can serve keeps the in-place write, now synced: a symlink, a file with other hard links, a file of another owner, one this process may not write to. - A staged Parquet file that cannot be hard-linked is streamed once into a private file and renamed over the destination. A destination that appears during the copy no longer costs a second full copy, and no path for a .parquet key reads the file into memory any more. The copy must have the length of its source. - The copy uses std::io::copy on Linux (copy_file_range, then sendfile) and keeps the 256 KiB streaming loop elsewhere. - Every publication syncs the directory entries up to the store root, not only the object's own directory, so a crash cannot drop a newly created date=/hour=/minute= directory with the objects in it. A failed directory sync fails the upload instead of being discarded. - The first cross-device hard-link failure logs once that staging and data on one filesystem allow zero-copy hard links. - Private files of atomic writes all use the reserved upload prefix and are left out of the metadata inventory, so one that a crash leaves behind cannot stop the offline migration. GCS and Azure multipart - Parts are read and sent one at a time through the S3 part-upload helper instead of slicing a whole-file buffer, with its exact-length check, and the upload is aborted on a read, part or completion failure and on cancellation, so no parts are left behind. Upload memory budget - P_MAX_UPLOAD_MEMORY_BYTES (default 256 MiB, read in object_storage.rs) caps the bytes of staged files that concurrent uploads buffer: one part per multipart upload, the whole file for a single PUT. A file reserves its share after its upload slots and before its claim starts, so waiting for memory cannot make the claim expire. The local filesystem store buffers nothing and takes none. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A `LIMIT` over staging memory reversed every cached batch when the scan was planned: a copy of up to the whole staging cache per query, outside any budget. Several other allocations of the query path were larger than what they hold or not accounted at all. Staging memory scans (stream_schema_provider): - A scan with a limit is now `ReversedStagingMemoryExec`. It keeps the captured batches as they are and reads them newest first as it is polled. It applies the exact time filters itself, takes only the rows the limit still asks for, and copies just those, in reverse order. Rows and schema are those of the eager reversal; the scan now stops at its limit itself instead of leaving that to the limit above it. - Scans without a limit are unchanged. Batch adaptation (utils/arrow/batch_adapter): - The fields a batch lacks are presented by one all-null array per distinct type, shared by all such fields and kept for the next batch of as many rows, instead of one new array per field per batch. Every batch is still validated against the whole table schema. - A column whose type only widens into the table's (nested nullability, list item names) is relabelled around its own buffers. `cast` remains the fallback. Query session (query/mod): - The predicate cache of each Parquet reader defaults to 64 MiB instead of 1 GiB, lowered so that the readers of one query stay within a quarter of the query pool, but not below 8 MiB. `P_PARQUET_PREDICATE_CACHE_SIZE` sets it explicitly. - DataFusion spills into `<staging>/.query_spill` instead of the temporary directory of the operating system, which is memory in many containers. The directory is locked by the process using it, which removes what a crashed process left there. Without it, spilling goes where it did. `P_QUERY_SPILL_DIR` names another base directory. Small-file cache (query/small_file_cache): - Admission reserves what the manifests record plus 64 KiB, capped at a maximal body per file, instead of a maximal body for every file, which turned the cache off for scans of more than 256 small files. - A body larger than recorded is reserved for when it is loaded, or not kept, so a view never holds more than it reserved. - Dropping a view returns its reservation exactly once, also when its locks are poisoned. Custom header fields (utils/arrow): - The column repeating a header value is built in buffers of its exact size instead of a value buffer that doubles as it fills. A column too long for 32-bit offsets is an error instead of a panic. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…trim ingest buffers Cuts transient and retained memory on the ingest, sync and query-planning paths without changing what is stored or how it is read back. Manifest codec (catalog/manifest.rs) - encode_manifest compresses the JSON as serde writes it; the uncompressed JSON (15-25x the stored size) is never held whole. - encode_manifest_blocking borrows the manifest instead of taking a clone: it serializes a chunk of file entries at a time and hands each chunk to the blocking pool for zstd. Output decompresses to the JSON serde writes. - decode_manifest parses a compressed manifest through a 1 MiB window, one file entry at a time, with serde_json's slice parser. Only the layout the encoders write is taken; any other layout and every failure falls back to the previous whole-buffer decode, so results and errors are unchanged. Plain-JSON manifests are parsed exactly as before. - DECODE_PERMITS is half the cores, clamped to 2..=4. - The staged Parquet footer cache is bounded by 64 MiB of ParquetMetaData::memory_size as well as by entries, and evicts the oldest footer in O(1) instead of scanning for it. - Manifest::memory_size / File::memory_size estimate decoded size. Metadata cache (metastore/metadata_cache.rs) - Every kind of entry has a byte limit next to its entry limit: 128 MiB of decoded manifests, 32 MiB of stream JSONs, 4 MiB per listing kind. - Values are charged when their load completes. Room is made one entry at a time: entries past their TTL, then the ones filled longest ago. The drain-everything cliff at capacity is gone, slots that are still loading are the last to go, and a value over the limit by itself is kept alone. - Expired entries are dropped whenever the cache is used. - clear_metadata_cache() and evict_expired(); soft memory-pressure relief calls evict_expired(). Schema writes (metastore/metastores/document_metastore.rs) - put_schema writes nothing when the get_schema the same task made just before returned the same schema (top-level field order aside): a sync whose staged schema adds nothing no longer rewrites the schema object and no longer invalidates the stream's cached metadata. Ingest (handlers/http/ingest.rs, event/format/json.rs) - A flat body is dropped once its batch is known to be staged as built, before the request waits for its turn to stage. - JsonBytes returns a single-chunk body as that chunk, and sizes the buffer of a multi-chunk body from Content-Length (at most 2 MiB ahead). - decode_rows_direct makes a column when a row first names its field; a field no row names becomes a null column without a pre-sized builder. - Finished columns of batches of 100 rows or more give back buffer capacity beyond 25% + 4 KiB of what they use. Smaller batches are left alone, so the staging writer's size-based compression choice is the same. Allocator (main.rs) - cache_oblivious:false: no padding page on every large allocation. dirty_decay_ms and narenas are unchanged. Not compiled or run locally; unit tests are added for each area. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ertified p_timestamp bounds to ProgressiveTopK
…pK bounds, unit-local dynamic filter, interior time-filter stripping
…tatistics override
…_is_certified_bounded
Contributor
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request |
Author
|
Opened against upstream by mistake instead of our fork VibeEngineeringAI/parseable; closing immediately. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduces Parseable's peak memory footprint by 88.7% (
7.33 GiB → 0.83 GiB), Parquet disk footprint by 33.7% (95.3 → 63.2 MiB/1M, or 46.9% /50.6 MiB/1Mwith opt-in severity clustering), disk write amplification by 28.1% (488 → 351 B/line), and live ingest+query CPU by 30.3% (3.23 → 2.25 cores), while making live TopK queries 29× faster at p50 (701 → 23.9 ms) and 170× faster at p95 (7,070 → 41.6 ms) with zero durability regressions and exact row-count parity.Matched Benchmark Results (
150,000 lines/s,5,000 streams,27M rows)Measured on GCP
gboat xlarge(Parseablepinned to8 vCPUs / 24 GiB,logs-benchmarkpinned to 8 separate vCPUs; 60s pure-ingest warmup + 12 concurrent livequery5krounds + 75s conversion drain + 5 post-drain Parquet-only rounds):7e40406c, EXDEV)f6a45b78, same-FS default)f6a45b78, EXDEV default)level+appcluster (opt-in)7.329 GiB0.826 GiB(−88.7%)0.896 GiB(−87.8%)0.718 GiB(−90.2%)7.185 GiB0.759 GiB(−89.4%)0.842 GiB(−88.3%)0.672 GiB(−90.6%)2.911 GiB0.252 GiB(−91.3%)0.253 GiB(−91.3%)0.275 GiB(−90.6%)0.244 GiB0.174 GiB(−28.7%)0.179 GiB(−26.6%)0.169 GiB(−30.7%)3.23 cores2.25 cores(−30.3%)2.14 cores(−33.7%)3.02 cores(−6.5%)487.96 B/line350.72 B/line(−28.1%)416.93 B/line(−14.6%)337.67 B/line(−30.8%)95.31 MiB/1M63.16 MiB/1M(−33.7%)63.16 MiB/1M(−33.7%)50.59 MiB/1M(−46.9%)recent_errorsp50 / p95701.3 / 7,070.1 ms23.9 / 41.6 ms(29× / 170×)26.8 / 34.1 ms(26× / 207×)34.2 / 74.2 mserrors_by_appp50 / p95474.2 / 681.2 ms289.1 / 484.0 ms(1.64×)328.9 / 411.8 ms(1.44×)384.0 / 488.5 msapp_errorsp50 / p95226.6 / 713.2 ms281.8 / 438.3 ms(1.63× p95)288.1 / 446.1 ms(1.60× p95)334.0 / 500.3 mstotal_countp50 / p9546.3 / 221.3 ms14.1 / 40.8 ms(3.3× / 5.4×)22.2 / 43.2 ms(2.1× / 5.1×)44.5 / 58.8 msrecent_errorsp50 / p951,152.8 / 1,742.6 ms595.9 / 675.5 ms(1.93×)868.0 / 919.8 ms(1.33×)43.9 / 66.9 ms(26.3×)errors_by_appp50196.1 ms213.9 ms220.2 ms79.3 ms(2.47×)app_errorsp50194.6 ms192.6 ms200.1 ms72.7 ms(2.68×)total_countp505.3 ms6.0 ms5.4 ms15.0 ms0 / 00 / 00 / 00 / 0sql == stats)27,092,000(exact)27,042,000(exact)27,032,000(exact)27,052,000(exact)Key Changes
1. Storage Durability & Zero-Copy LocalFS Upload (
src/storage/)P_STAGING_DIRandP_FS_DIRshare a mount.2. Bounded Staging Memory & Indexed Arrow IPC Reader (
src/parseable/staging/)min(10% RAM, 512 MiB)with bounded per-segment cap) and enabled LZ4 IPC staging compression by default (P_STAGING_IPC_COMPRESSION), cutting staging disk writes while keeping peak RSS under1 GiB.AcknowledgedIpcIndextracking per-batch byte offsets, row counts, and certifiedp_timestampmin/max/null bounds so disk-backed staging scans support zero-body-readCOUNT(*)folding, time-range pruning, narrow column projection pushdown, and two-phase filter-first decoding.preadsyscall overhead on wide scans while enabling narrow-projection sparse reads at64 KiB(NARROW_SPARSE_MIN_MESSAGE_BYTES) and wide two-phase sparse reads at256 KiB.3. Progressive Certified TopK & Query Memory Hygiene (
src/query/)p_timestamp-certified single-partition staging units (StagingDiskScanExec, starting at[2, 4, 8, 16, 32, 64, 128]newest messages and stripping intermediateRepartitionExecnodes) soProgressiveTopKExecestablishes a TopK cutoff in milliseconds and prunes older staging slices and Parquet files unopened.p_timestampfooter statistics to leased staged Parquet files (validate_staging_parquet_with_schema) and per-file manifest statistics to single-file published Parquet scans so no staging/boundary Parquet file runs uncertified ahead of Slice 0.SortExec::with_dynamic_filter_expr) conjoined with the run-wide dynamic filter insideProgressiveTopKExecso each Parquet unit prunes its own older row groups.p_timestampfilters and droppedp_timestampIPC decoding for interior staging batches whenp_timestampis not projected (speeding up liveerrors_by_app/app_errors), bounded DataFusion spill directories safely without following symlinks, and bounded query cache reservations.4. Parquet Encoding, Conversion & Streaming Manifests (
src/parseable/streams.rs,src/metastore/,src/ingest/)P_LOG_SEVERITY_CLUSTER_COLUMN=level+app,levelavailable opt-in for50.6 MiB/1Mstorage and~44 mspost-drain TopK).src/parseable/streams/crash_recovery_tests.rs) covering Zstd Parquet + compressed zero-memory staging across all 4 crash boundaries.5. HotTier, Kafka & CLI Bounds (
src/connectors/kafka/,src/storage/hot_tier.rs,src/cli.rs)Verification
cargo clippy --lib --bins -- -D warnings: PASS (0 warnings)cargo clippy --lib --bins --features kafka -- -D warnings: PASS (0 warnings)cargo test --lib: 2,182 passed, 0 failed (25 ignored), includingordered_topkexhaustive DataFusion differential property test, new single-file Parquet TopK & staged Parquet certified-stats unit tests, and 4-boundary crash recovery testscargo test --lib --features kafka connectors::kafka: 69 passed, 0 failed (1 ignored)gboat xlarge: 0 drops, 0 query errors, exactsql_count == stats_lifetime_countparity on every arm