API · 2024
JMC API Optimization
Reworked a Laravel API for mobile apps to hit consistent sub-200 ms responses through indexing, eager loading, and caching.
- Role
- Web Developer
- Stack
- Laravel · MySQL · Redis · RabbitMQ
Case study
Problem
The mobile app backend at JMC Indonesia was slow and unpredictable. Large dataset syncs took minutes, responses wandered into the seconds, and order-sensitive workflows had no reliable ordering guarantee. The API needed to become fast, consistent, and trustworthy under real load.
Role & approach
As the backend engineer on the team I owned the API layer end to end — query tuning, data synchronization, and queue reliability.
Challenges & solutions
Response times over 200 ms. The first pass was query analysis: missing indexes, N+1 relation loads, and repeated cache-misses dominated the profile. I added strategic indexes on the hottest columns, replaced lazy relation access with eager loading, and introduced caching on read-heavy endpoints. The result was consistent sub-200 ms responses — measured, not assumed.
Large dataset synchronization. Full syncs of big tables blocked workers and sometimes failed partway, leaving inconsistent state. I switched to chunked batch processing so jobs processed data in slices, retried safely, and ran 60–80% faster while improving data reliability.
Order-sensitive workflows. Some pipelines had to process records in a strict order. I implemented FIFO queue logic so items were consumed in the exact sequence they were enqueued — no reordering, no dropped work.
Outcome
- Consistent API responses under 200 ms.
- Dataset syncs 60–80% faster with chunked batch processing.
- Production-ready applications delivered in about one week — roughly 80% faster MVPs.
- Reliable FIFO behavior for order-sensitive data workflows.