Sangeetha-Grantha

Track: Bulk Import - Performance Optimization

ID: TRACK-006 Status: Completed Owner: Sangita Grantha Architect Created: 2026-01-22 Updated: 2026-01-22

Problem Statement

The current Bulk Import worker implementation uses aggressive polling (750ms interval) across multiple worker threads (6 total). This results in excessive “SELECT … FOR UPDATE” queries even when the system is idle, spamming the database logs and consuming unnecessary resources.

Goal

Reduce database load by optimizing the worker polling mechanism while maintaining responsiveness during active imports.

Implementation Plan

Phase 1: Immediate Relief (Config & Indexing)

Phase 2: Architectural Improvements (Refactoring)

Technical Approach

  1. Backoff: Simple delay(currentInterval) where currentInterval doubles on empty result, resets on success.
  2. Batching: LIMIT 5 in the claim query, return List<Task>.