Santekno
Projects/B-Side Reconciliation Script Optimization
ByteDance logoPart of ByteDance · Software Engineer, Promotion Platform Team
Backend / APILive

B-Side Reconciliation Script Optimization

Audited and standardized 27 reconciliation scripts across multiple regions to cut alert noise with a single reusable optimization pattern.

2025-b-side-reconciliation · main
# E-Commerce / Reconciliation
$ go -X POST /2025-b-side-reconciliation/v1/sync
→ 201 Created
{ "status": "ok" }
publish 2025-b-side-reconciliation.synced
Role
Backend Engineer
Timeline
2025
Team
2
Domain
E-Commerce / Reconciliation
Stack
5 tech
Status
Live
01

Overview

The B-Side Reconciliation Script Optimization was an initiative to clean up a set of reconciliation scripts that were generating noisy, low-signal alerts and slowing down operations. I owned the systematic assessment and optimization end-to-end, turning a repetitive maintenance burden into a standardized, reusable pattern.

A backend has no screens, so its "UI" is the operational surface: script runs, alert reports, and self-test validation.

Ops view — reconciliation script execution & alert flow
Report — before/after alert-noise comparison
Self-test — correctness & edge-case validation
03

Problem & Solution

Problem

The existing scripts produced excessive alert noise, but the root cause was inefficient query structures and redundant comparison logic rather than genuine data discrepancies. The noise reduced operational trust, slowed troubleshooting, and made the scripts hard to read and maintain across regions.

Solution

I deep-dived into a single underperforming script, isolated a consistently inefficient query segment, and recognized it as a repeatable pattern. Instead of one-off fixes I abstracted and refactored the script structure, designed a reusable optimization pattern, and applied it consistently across 9 scripts deployed in multiple regions — improving a total of 27 reconciliation scripts with a standardized approach and thorough self-testing.

04

Workflow

Three actors interact with the service; the diagrams are written in English to stay consistent across both languages.

flowchart diagram

run

query

compare

signal

Scheduler

Reconciliation Script

Managed RDS (multiple regions)

Reconciliation Logic

Alert Channel

Use case interaction
sequence diagram
On-callRDSReconciliation ScriptSchedulerOn-callRDSReconciliation ScriptSchedulertrigger runoptimized comparison queryreconciliation rowsevaluate real discrepancieshigh-signal alert only
Sequence flow
05

Architecture

flowchart diagram

alerts

Reconciliation Platform

Optimized Scripts

Managed RDS · Region A

Managed RDS · Region B

Managed RDS · Region C

Ops / On-call

System architecture
Architecture notes

Each optimized script runs on the reconciliation platform against a managed RDS (relational database) across multiple regions, executing streamlined comparison queries and emitting only high-signal alerts to on-call. The shared optimization pattern keeps behavior and structure consistent across those deployments, so future updates and reasoning stay simple.

state diagram

pattern applied

edge cases

audited

refactored

self_tested

released

Script optimization lifecycle
06

Features

Audit
  • SQL query pattern analysis
  • Alert-noise root-cause identification
Optimization
  • Reusable query optimization pattern
  • Script refactor for readability
  • Cross-region standardization
Validation
  • Self-test documentation
  • Edge-case correctness checks
07

Tech Stack

language
Go
platform
reconciliation platform
database
Managed RDS (relational database)
infra
Multi-region
observability
Alerting
08

Engineering Challenges

01
Alert noise from inefficient queries

Scripts produced noisy, low-signal alerts driven by inefficient query structures and redundant comparison logic rather than real data issues. Fix: root-cause query optimization that lifted the actionable signal-to-noise ratio without sacrificing accuracy.

02
Applying one fix across 27 scripts and multiple regions

The same inefficiency repeated across 9 scripts in multiple regions. Fix: an abstracted, reusable optimization pattern applied consistently to all 27 reconciliation scripts, improving cross-region consistency.

03
Preserving accuracy during large-scale refactor

Refactoring many production scripts risked regressions. Fix: detailed self-test documentation covering correctness, edge cases, and expected outcomes before release.

09

Outcomes

27
reconciliation scripts optimized
9
scripts standardized per region
3
regions covered
4x
faster per-script development
10

Lessons Learned

This project reinforced the value of thinking in scalable optimization patterns rather than isolated fixes. By addressing root causes I cut per-script development time from ~1 day to ~2 hours while preserving accuracy and significantly improving readability and long-term maintainability.

11

Related Santekno Tutorials

Interested in working together?

Order, payment, or high-traffic event pipelines — let's talk architecture and trade-offs.