Skip to content

Spatial lookup: 2000-point sub-batches (was 500); rate shown per minute - #261

Merged
fcollman merged 1 commit into
masterfrom
larger-spatial-sub-batches
Oct 26, 2026
Merged

fcollman merged 1 commit into
masterfrom
larger-spatial-sub-batches

Conversation

@fcollman

Copy link
Copy Markdown
Collaborator

Larger sub-batches

Since #257, a 500-point spatial sub-batch takes about 2 s. Each sub-batch is a Celery task, and its result stays in Redis for result_expires (a day). A 337M-row upload on minnie (2026-10-26) therefore made about 1.35M tasks, and on the 1 GB Memorystore instance that meant:

  • about 850 MB of task results in total;
  • memory rising 15 points every 40 minutes;
  • about 1,200 client connections, 14 MB/s of traffic and 7–9k commands/s.

The default is now 2000 points: about 290 storage chunks and about 8 s per task, still far inside the spatial queue's 300 s visibility timeout. That is 4× fewer tasks, results and messages. The upload chain and the API now both read one constant, DEFAULT_SUPERVOXEL_BATCH_SIZE.

The batch size is fixed when a lookup starts, so this applies to runs started after deployment.

Rate label

The spatial workflow page appended "rows/sec" to processing_rate, but the backend stores that value per minute ("410506.00 rows/minute"). The page now says rows/min.

Tests

The full suite passes locally on fresh PostGIS 18 and Redis: 514 passed, 2 skipped.

🤖 Generated with Claude Code

Each sub-batch is a celery task whose result stays in redis for
result_expires (a day). With chunk-grouped lookups a 500-point sub-batch
takes ~2 s, so a 337M-row upload made ~1.35M tasks: ~850 MB of results on
minnie's 1 GB Memorystore instance, ~1,200 connections, 14 MB/s and 7-9k
commands/s (2026-10-26), memory rising 15 points every 40 min. 2000 points
(~290 storage chunks, ~8 s, far inside the spatial queue's 300 s
visibility timeout) makes 4x fewer tasks, results and messages. The
default is now one constant used by the upload chain and the API.

The spatial workflow page appended "rows/sec" to processing_rate, which
the backend stores per minute ("410506.00 rows/minute"); it now says
rows/min.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@fcollman
fcollman merged commit d751a88 into master Oct 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant