Skip to content

Add mutation snapshot cache and conditional-write batching to PostgresTaskStore with telemetry and config - #222

Closed
MisterVVP wants to merge 1 commit into
dev-continue-postgresql-write-path-optimizationfrom
dev-conduct-performance-experiments-for-codex
Closed

MisterVVP wants to merge 1 commit into
dev-continue-postgresql-write-path-optimizationfrom
dev-conduct-performance-experiments-for-codex

Conversation

@MisterVVP

@MisterVVP MisterVVP commented Aug 24, 2026 •

Copy link
Copy Markdown
Owner

Motivation

  • Reduce PostgreSQL load and improve write concurrency by caching recent task snapshots and batching conditional writes (including generated-task creates).
  • Provide observability for mutation cache behavior and conditional-write batching to guide tuning during performance runs.
  • Expose configuration knobs to control cache capacity and batching behavior for performance testing and deployment tuning.

Description

  • Added new options to PostgresStoreOptions (mutation_cache_capacity, conditional_write_batch_size, conditional_write_batch_delay_microseconds, generated_task_batch_size) and validation for batch-size limits in ValidatePostgresStoreOptions.
  • Extended the TaskStore interface with GetMutationSnapshot, CreateGeneratedTaskIfAbsent, and telemetry types MutationCacheTelemetrySnapshot and ConditionalBatchTelemetrySnapshot and plumbed implementations into PostgresTaskStore.
  • Implemented a sharded LRU MutationSnapshotCache and integrated it into PostgresTaskStore to serve GetMutationSnapshot, eagerly populate on mutation, and invalidate on conflicts or external updates; added exposure of mutation-cache telemetry via GetMutationCacheTelemetrySnapshot.
  • Implemented ConditionalWriteBatcher that coalesces conditional update/create requests into multi-row SQL operations running on a background worker with queueing/delay and telemetry; wired two batchers (regular conditional writes and generated-task creates) and fall back to immediate persistence when batchers are disabled or single-threaded.
  • Adjusted UpsertTask to return the resulting revision, updated callers to populate the mutation cache after upserts/updates, and added PersistConditionalWrite to centralize conditional write logic used by batcher and direct paths.
  • Instrumented performance driver and performance result structures to gather mutation-cache and conditional-batch telemetry, added new environment variables to configure the features in performance scenarios, and added a conformance test verifying cache reload on external conflict (PostgresMutationCacheReloadsAfterExternalRevisionConflict).

@MisterVVP MisterVVP added the codex Automatic label added by codex agent. Should not be used label Aug 24, 2026 — with ChatGPT Codex Connector
@MisterVVP MisterVVP added AI agent AI agent contribution performance Performance improvement related tasks based on benchmark results. Performance tests changes. and removed codex Automatic label added by codex agent. Should not be used labels Aug 24, 2026
@MisterVVP MisterVVP self-assigned this Aug 24, 2026
@MisterVVP MisterVVP closed this Aug 24, 2026
@MisterVVP
MisterVVP deleted the dev-conduct-performance-experiments-for-codex branch August 24, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI agent AI agent contribution performance Performance improvement related tasks based on benchmark results. Performance tests changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant