Book Image

High Performance with Laravel Octane

By : Roberto Butti
5 (2)
Book Image

High Performance with Laravel Octane

5 (2)
By: Roberto Butti

Overview of this book

Laravel Octane is a very powerful component in the Laravel ecosystem that can help you achieve remarkable app performance. With Laravel Octane, you will find tools (queues, cache, and tables) that facilitate a new asynchronous approach for improving application performance. This book highlights how Laravel Octane works, what steps to take in designing an application from the start, what tools you have at your disposal, and how to set up production environments. It provides complete coverage of the strategies, tools, and best practices to make your apps scalable and performant. This is especially important as optimization is usually the overlooked part in the application development lifecycle. You will explore the asynchronous approach in Laravel and be able to release high-performing applications that have a positive impact on the end-user experience. By the end of this book, you will find yourself designing, developing, and releasing high-performance applications.
Table of Contents (14 chapters)
Part 1: The Architecture
Part 2: The Application Server
Part 3: Laravel Octane – a Complete Tour
Part 4: Speeding Up

Exploring the Laravel ecosystem

Laravel is a great framework in the PHP ecosystem that helps developers to build web applications quickly and reliably.

It includes, as dependencies, some great tools from the PHP ecosystem, such as Symfony packages, and some other solid and mature packages such as Monolog for logging, Flysystem for accessing files and storage, and CommonMark for managing Markdown format.

From the Symfony world, Laravel includes packages such as Symfony/routing to manage routing, and http-foundation and http-kernel to manage HTTP communication.

All this is just to say that Laravel uses the best parts of the PHP ecosystem, puts them together, and provides tools, helpers, classes, and methods to simplify the usage of all the tools from the developer’s perspective.

In addition, Laravel is more than a framework. Laravel is an ecosystem.

Laravel also provides applications and services that are integrated with the framework.

For example, Laravel provides the following:

  • Cashier: For integration with Stripe and Paddle for the payment and subscription process.
  • Breeze, Jetstream, Sanctum, and Socialite: For managing authorization, authentication, the social login integration process, and exposing protected APIs.
  • Dusk and Pest: For testing.
  • Echo: For broadcasting events in real time.
  • Envoyer, Forge, and Vapor: For server or serverless management and to manage the deployment process.
  • Mix: For compiling JavaScript and CSS through a webpack configuration fully integrated with the Laravel frontend.
  • Horizon: A web user interface for monitoring queues based on Redis.
  • Nova: An administrator panel builder for Laravel applications.
  • Sail: A local development environment based on Docker.
  • Scout: A full-text search engine, backed by providers such as Algolia, Meilisearch, or simply by the MySQL or PostgreSQL database.
  • Spark: A boilerplate solution for managing billing/subscription in your application.
  • Telescope: UI module for showing debugging and insights.
  • Valet: A macOS-specific bundle of applications configured for running the PHP application. It has dependencies with nginx, PHP, and Dnsmasq.
  • Octane: For improving performance and optimizing resources.

In this book, we will analyze the last tool in this list: Laravel Octane.

We will go over the use of other tools within the Laravel ecosystem, such as Sail (for simplifying the installation process of a complete development environment), and Valet (for correctly setting up the local environment to run a web server and PHP). Also, Laravel Octane depends on important software that we will see in-depth throughout the book. Laravel Octane has strong requirements: it requires additional software such as Swoole or RoadRunner.

But one step at a time.

Before we delve into the tools and their configuration, it’s important to understand some basic mechanisms for managing HTTP requests.


HTTP is a protocol that defines rules, messages, and methods for fetching resources on the web, such as HTML documents (web pages) and assets. Clients (who require the resource) and servers (who serve the resource) communicate by exchanging messages. The client sends requests, and the server sends responses.

One of the goals of the book is to empower you to improve the performance of your web applications by doing different things, starting with designing the architecture of the application, choosing and using the right tools, writing code, and finally, releasing the application.

The tools we are going to analyze and use will do much of the work, but I think it is important to understand the underlying dynamics to have a good awareness of how the various tools work to enable you to configure, integrate, and use them to the best of their ability.

Before we get deeper into the workings of Laravel Octane, let me take you through how servers typically deal with HTTP requests by explaining the HTTP request lifecycle.