Knowledgebase

Understanding the Request Lifecycle Print

  • phplaravel, performance, database, troubleshooting, guide, howto, solution, zillionkinghost
  • 0

What happens on every request.

THE SEQUENCE

The request reaches the single entry point The framework is bootstrapped Service providers are registered and booted The request passes through global middleware A route is matched Route middleware runs The controller executes A response is produced Middleware runs on the way out The response is sent Terminating work runs

WHY UNDERSTANDING IT MATTERS

It tells you where to intervene, and where a problem could be.

WHAT RUNS ON EVERY SINGLE REQUEST

Bootstrapping and all service providers.

WHAT THAT IMPLIES

Work performed in a provider's boot method costs every request.

WHAT TO AVOID THERE

Database queries External calls Anything slow

WHAT DEFERRED PROVIDERS DO

Register only when their service is actually needed.

WHAT TERMINATING MIDDLEWARE IS FOR

Work after the response is sent, so the user does not wait.

WHAT TO CHECK WHEN EVERY PAGE IS SLOW

What runs during bootstrapping.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot