TOPIC COLLECTION
Reliability and Performance.
A collection of 6 practical ideas to make everyday Laravel work a little smoother.
06 TIPS01Make Retried Jobs IdempotentQueue workers may retry work after a timeout or lost acknowledgement, even when part of the job already ran. Make repeating the same operation safe by…Reliability and Performance02Suppress Duplicate Job Dispatches with ShouldbeuniqueWhen only one queued job per resource should be pending, implement ShouldBeUnique and return a resource-specific key. Laravel uses that key to hold a cache…Reliability and Performance03Prevent Concurrent Jobs from Updating the Same ResourceUse WithoutOverlapping when two jobs may both be queued but must not modify the same resource at the same time. This is different from unique dispatch:…Reliability and Performance04Back Off Between Retries of Transient FailuresImmediate retries can overload a service that is already failing. Set a bounded retry count and increase the delay between attempts for temporary network or…Reliability and Performance05Keep Scheduled Tasks Safe Across Multiple ServersWhen every server runs Laravel's scheduler, use onOneServer() to elect one runner and withoutOverlapping() to prevent a slow execution from starting again…Reliability and Performance06Serve Stale Cache Data While Refreshing ItFor expensive values that can be briefly stale, Cache::flexible() returns a fresh value immediately and refreshes a stale value after the response. This…Reliability and Performance