Cutting an Overnight Batch Job in Half
Case Study · Development & Enhancements

Cutting an Overnight Batch Job in Half

A state government agency's month-end benefits batch run had grown to consume most of the overnight processing window. Targeted refactoring brought it back under control.

Government Performance Optimization Code Refactoring Batch Processing
10 Weeks
Engagement duration
-58%
Batch runtime reduction
Missed overnight windows since
The Challenge

A Batch Window That Kept Shrinking

Month-end benefits eligibility recalculation had grown over the years to the point where it occasionally ran past the start of business hours, delaying case-worker access to updated records.

Performance

Runtime Growing Faster Than Caseload

Batch runtime had grown disproportionately to the increase in case volume, pointing to inefficiencies in the underlying logic rather than simple data growth.

Operational Risk

Encroaching on Business Hours

Several recent month-end runs had extended into the morning, delaying case workers' access to updated eligibility data on the busiest day of the month.

Root Cause Unknown

No Clear Bottleneck Identified

Internal staff suspected database queries but had no profiling data to confirm where time was actually being spent across the multi-hour job.

The Approach

Profile First, Then Refactor With Evidence

Rather than guessing at fixes, the engagement started with detailed profiling to identify exactly where the batch job was spending its time.

Batch Job Profiling

Execution traces captured across a full production run to break down time spent in DataWindow retrieval, business logic loops, and database round-trips.

Query & DataWindow Optimization

Row-by-row eligibility checks were identified as the dominant cost and rewritten as set-based DataWindow operations, cutting redundant database round-trips.

Logic Consolidation & Refactoring

Duplicated eligibility-rule logic scattered across multiple scripts was consolidated into shared functions, reducing both runtime and future maintenance cost.

Parallel Validation Runs

The refactored batch job ran in parallel against the legacy version across two full month-end cycles, comparing output record-for-record before cutover.

Batch Runtime Cut by More Than Half Profiling-driven refactoring reduced month-end runtime by 58%, turning a job that regularly ran past business hours into one with comfortable headroom.
Root Cause Found Instead of Guessed At Detailed execution profiling replaced staff speculation about slow database queries, pinpointing row-by-row eligibility checks as the actual bottleneck before any code was touched.
Zero Overnight Window Overruns Since Go-Live Case workers now reliably have updated eligibility data before business hours, removing a recurring operational risk on the busiest day of the month.
The Impact

The Business Impact

  • Month-end batch runtime cut by more than half, verified through profiling
  • Zero overnight window overruns since the refactored job went live
  • Case workers gain updated eligibility data reliably before business hours
  • Duplicated eligibility logic consolidated, cutting future maintenance effort
  • Batch job now has measurable headroom to absorb future caseload growth
  • Profiling approach adopted as a template for other agency batch processes
"We stopped guessing at what was slow and started measuring it — the fix followed naturally once we could see where the time actually went." — OptiSol Development & Enhancements Lead

Let's Talk

Start a Conversation

Tell us what you are running today and where you need expert support.

"*" indicates required fields

Free initial consultation Confidential assessment solutions@optisolbusiness.com

Global Presence

Where We Operate

Five global locations. One connected engineering team.

New York skyline representing the United States office
HQ

United States

North America

India landmark representing the delivery centre
Delivery Hub

India

Chennai · Coimbatore

London skyline representing the United Kingdom office
Europe

United Kingdom

Client services

Australian coastline representing the Australia office
APAC

Australia

Regional operations

Dubai skyline representing the UAE office
Middle East

UAE

Client services