Distributed Certificate Generation Pipeline
Re-architected a large-scale document-generation workflow into a two-server processing pipeline, cutting runtime from ~2 days to ~6 hours.
Overview
Problem
Requirements
- Reduce total processing time for ~40,000 students well below the existing ~2-day runtime
- Process multiple documents concurrently without generating duplicate certificates
- Retry transient conversion or network failures without restarting the entire batch
- Separate document preparation from document conversion to remove the single-server bottleneck
Architecture
Technical Challenges
Safely processing jobs concurrently
Parallel processing improved throughput but required locking and job-status transitions to ensure the same document was not processed by multiple workers.
Handling external document-conversion failures
Microsoft Graph conversion could fail because of throttling, timeouts, or unsupported documents, requiring different retry and failure-handling strategies.
Separating a tightly coupled single-server workflow
The original process combined data loading, document generation, conversion, and storage in one flow, so the redesign had to split responsibilities without losing job state or reliability.
Key Decisions
Split document preparation and conversion across two servers
Separating the CPU and I/O-heavy preparation stage from the external document-conversion stage removed the single-server bottleneck and allowed both stages to operate independently.
Use bounded concurrency for Microsoft Graph conversion
Conversion requests were limited to a controlled number of concurrent operations to increase throughput without overwhelming the external API.
Solution
Performance & Scalability
- Reduced processing time for ~40,000 students from ~2 days to ~6 hours — an 87.5% reduction.
Results
- Reduced end-to-end processing time from ~48 hours to ~6 hours.
- Allowed individual failed jobs to retry without restarting the entire batch.
- Prevented duplicate document processing through job locking.
- Created an architecture that can be extended with additional workers if future load increases.
Lessons Learned
- Large throughput improvements often come from redesigning the workflow rather than simply increasing server resources.
- Once processing becomes concurrent, locking, retries, idempotency, and failure handling become critical parts of the architecture.