Interview frequency: …
Short answer
It runs the application on high-speed servers (FrankenPHP or Swoole) while keeping it loaded in memory; state leaks occur when request data is stored in global variables or Singletons.
Explanation
Octane removes Laravel's startup time for every request. However, because one process serves thousands of successive requests, any variable stored in a Singleton or static variable remains after a request ends and can leak one user's data to another. Octane provides hooks for cleanup tasks (Warmers & Terminators) and listeners to reset sensitive state between requests.
Code example
// Very dangerous in Octane: leaks data between users
class BadService {
public static ?User $currentUser = null;
}Common mistakes
- Using Singletons to store information about the current request or active user in an Octane environment.
Follow-up questions
- What is the main difference between php artisan queue:work and queue:listen?
- How do bind, singleton, and scoped differ in Laravel's Service Container?