0
0
Laravelframework~8 mins

Why notifications reach users effectively in Laravel - Performance Evidence

Choose your learning style9 modes available
Performance: Why notifications reach users effectively
MEDIUM IMPACT
This concept affects how quickly and reliably notifications appear to users, impacting perceived responsiveness and engagement.
Sending notifications to users without blocking the main request
Laravel
dispatch(function () use ($users, $message) { Notification::send($users, new NewMessageNotification($message)); })->delay(now()->addSeconds(1)); // queued notification
Queues notifications to send asynchronously, freeing the main request to respond faster.
📈 Performance GainNon-blocking notification sending reduces INP and improves perceived responsiveness.
Sending notifications to users without blocking the main request
Laravel
Notification::send($users, new NewMessageNotification($message)); // synchronous sending inside controller
Sends notifications synchronously during the HTTP request, blocking response and increasing wait time.
📉 Performance CostBlocks rendering and user interaction until notification sending completes, increasing INP.
Performance Comparison
PatternServer ProcessingResponse DelayUser Interaction DelayVerdict
Synchronous notification sendingHigh CPU and I/O during requestBlocks response until completeDelays user interaction[X] Bad
Queued asynchronous notification sendingOffloaded to queue workersImmediate response to clientMinimal delay in interaction[OK] Good
Rendering Pipeline
Notifications sent synchronously block server response, delaying browser rendering and user interaction. Queued notifications allow the server to respond immediately, letting the browser paint and become interactive faster.
Server Processing
Network Response
Browser Rendering
User Interaction
⚠️ BottleneckServer Processing when notifications are sent synchronously
Core Web Vital Affected
INP
This concept affects how quickly and reliably notifications appear to users, impacting perceived responsiveness and engagement.
Optimization Tips
1Always queue notifications to avoid blocking HTTP responses.
2Use Laravel's built-in queue system for asynchronous notification delivery.
3Monitor request durations in DevTools to detect synchronous notification sending.
Performance Quiz - 3 Questions
Test your performance knowledge
What is the main performance benefit of queuing notifications in Laravel?
AIt allows the server to respond faster by sending notifications asynchronously.
BIt reduces the size of the notification payload.
CIt improves the visual design of notifications.
DIt caches notifications on the client side.
DevTools: Network
How to check: Open DevTools Network tab, observe the time taken for the notification-triggering request to complete.
What to look for: Long request duration indicates synchronous notification sending; short duration suggests asynchronous handling.