Why your API feels slow, drawn on a napkin
A client once told me: "the signup button takes 4 seconds, fix the database." The database was fine. The endpoint was sending a welcome email before answering the user. Here is the whole problem in one sketch:
The fix: answer first, work later
The user does not need the email to exist before they see "account created". They need the promise that it will exist. So we split the timeline: respond right away, and push the slow work onto a queue that a worker chews through in the background.
In Laravel this is three lines
Push the work to a queued job and return immediately:
SendWelcomeEmail::dispatch($user); inside the controller, php artisan queue:work on the server, and QUEUE_CONNECTION=redis in the environment. That is the entire pattern.
At Tamkeen I spent a good part of six months moving work out of requests and into queues. Same servers, same database, and endpoints that used to take seconds started answering in double-digit milliseconds.
Notes from readers