Case Study

Performance Optimization: Background Processing & N+1 Query Fixes

Turning a 5–10 minute blocking process into a background job, and cutting a 1–1.5 minute page load down to 2–5 seconds.

The problem

An internal business system had two major performance bottlenecks: a core process that blocked users for 5–10 minutes while it ran, and a separate page taking 1–1.5 minutes to load because of inefficient database queries.

The approach

Part 1 — the blocking process. The slow operation involved AI integration and summary generation. I moved it into a background job and queue, so instead of staring at a loading screen for 5–10 minutes the user carries on working and the system notifies them when it is done.

Part 2 — the N+1 queries. I identified and fixed N+1 query problems that were forcing the database to run redundant repeated queries on page load, replacing them with proper eager loading.

Stack

Laravel, queues and background jobs, Eloquent eager loading, query profiling

Outcome

Reduced a 5–10 minute blocking wait to a background process the user no longer has to sit through, and cut page load time from 1–1.5 minutes down to 2–5 seconds.

Got a project like this?

Tell me what you're building or what's broken. I'll come back with a straight assessment of scope, approach, and timeline.