Skip to main content

Introduction

Each environment deployed to Laravel Cloud runs on at least one App compute instance, which is assigned a specified amount of CPU processing power and available RAM. Your environment’s App compute instance is responsible for handling incoming HTTP traffic to the environment. In addition, you may add dedicated worker compute instances to your environment to process queued jobs or execute other background processes. You can manage the compute resources assigned to an environment from the environment’s infrastructure canvas dashboard.

App cluster

Your environment’s App cluster represents the primary compute and infrastructure that will run your application. This compute cluster can serve web traffic, scale to zero, and manage long-running processes such as queue workers. It can also run scheduled tasks. To scale or customize your environment’s App cluster, click the cluster in your environment’s infrastructure canvas dashboard.

Laravel Octane

Laravel Octane is available for Laravel applications only.
Laravel Cloud can run your application using Laravel Octane, which boots your application once and keeps it in memory for each request. When editing your App cluster, toggle on the “Use Octane as runtime” option. Then, save and deploy your environment. Laravel Cloud builds, configures, and serves your Laravel application using Laravel Octane and FrankenPHP.
Review the Laravel Octane documentation to learn about the caveats to keep in mind when building your application to run on Octane.
Before enabling the Laravel Octane runtime, make sure you have added Laravel Octane to your application using the Composer package manager.

Inertia SSR

Inertia SSR is available for Laravel and Rails applications.
Laravel Cloud can also serve your Inertia-based pages using server-side rendering. Inertia SSR pre-renders your HTML server-side before sending it to the client, which can improve your application’s SEO. When editing your App cluster, toggle on the “Use Inertia SSR” option. Then, save and deploy your environment. Laravel Cloud renders your application’s pages using Inertia’s SSR engine. In addition, if you are using one of Laravel’s official starter kits, you should update your environment’s build commands to use the npm run build:ssr command instead of npm run build:

Rails

Rails applications need the inertia_rails gem, version 3.20.0 or later, and its Puma plugin, which starts the SSR server alongside Puma. Add the plugin to your config/puma.rb file:
When Inertia SSR is on, Cloud sets INERTIA_SSR_ENABLED=true. Make sure your build commands also build your SSR bundle, such as by enabling ssrBuildEnabled in config/vite.json so assets:precompile builds it.

Worker clusters

Worker clusters run background processes on compute that is separate from your App cluster and web traffic. See Workers to learn how to create worker clusters and configure background processes.

Autoscaling

Laravel Cloud can automatically scale the compute resources attached to your environment based on demand, CPU usage, and memory usage. To configure your environment’s autoscaling strategy, click your environment’s App or Worker compute cluster on the infrastructure canvas dashboard. Then, select the autoscaling strategy that fits your environment. Laravel Cloud supports three autoscaling strategies:
  • None: run your App or Worker compute on a single instance without autoscaling.
  • Custom: automatically scale your App or Worker compute clusters up and down horizontally within a specified minimum and maximum replica range.
  • Unlimited: automatically scale your App or Worker compute clusters up and down indefinitely based on demand.
The maximum number of replicas depends on your plan. On the Growth plan, clusters may scale to 10 replicas by default. If you need more replicas, contact support to request a higher limit without changing plans. After you adjust your environment’s autoscaling strategy, redeploy the environment to apply the changes.
App clusters can add up to 10 replicas or triple their replica count every 15 seconds, whichever adds more. When demand drops, Laravel Cloud waits 5 minutes, then removes one replica per minute.

Default CPU threshold

When an App cluster has no CPU threshold of its own, Laravel Cloud adds replicas once CPU usage reaches 60% of the vCPUs your application can use. An application that serves requests from a single process can’t use more than one vCPU, so Laravel Cloud lowers the threshold on larger instances:
For example, a Node.js application on a 2 vCPU instance scales once CPU usage reaches 30%. Laravel Cloud counts the usable vCPUs for each runtime as follows:
  • Node.js, Bun, and Deno: Laravel Cloud counts one vCPU. With deno serve --parallel, it counts one vCPU per DENO_JOBS worker, or every vCPU when DENO_JOBS is unset.
  • Rails: With the start command Laravel Cloud generates, Laravel Cloud counts one vCPU per WEB_CONCURRENCY process, or one vCPU when WEB_CONCURRENCY is unset. With a custom start command, it counts every vCPU on the instance.
  • Ruby without a framework: Laravel Cloud counts one vCPU.
  • Other runtimes: Laravel Cloud counts every vCPU on the instance.

HTTP traffic autoscaling

For App clusters, Laravel Cloud automatically scales HTTP applications based on real-time traffic pressure in addition to your configured CPU and memory thresholds. Laravel Cloud scales based on whichever limit is reached first. Laravel Cloud’s ingress layer tracks the requests your application is processing. Laravel Cloud compares the highest number of in-flight requests from the last minute with the number of requests each replica can handle, and adds replicas when demand exceeds that capacity:
When traffic subsides, Laravel Cloud removes the excess replicas. Because this scaling signal is based on active requests instead of trailing CPU or memory metrics, faster response times reduce the number of replicas needed to serve the same amount of traffic. Each replica’s capacity depends on how your application serves requests.

Memory-based estimate

PHP-FPM applications, and applications whose runtime has no estimate of its own, use a memory-based estimate. Laravel Cloud estimates that each worker uses approximately 30 MB of memory and processes one request at a time. Each replica runs between 10 and 1,000 workers, and Laravel Cloud adds replicas once 70% of them are busy:
For example, a 512 MB PHP-FPM application runs 17 workers per replica, so Laravel Cloud adds replicas when a replica has more than 11 requests in flight.

Octane

When your App cluster runs Laravel Octane, each Octane worker processes one request at a time, and Laravel Cloud adds replicas once every worker is busy. By default, each replica runs a third of the PHP-FPM worker count, so a 512 MB replica runs 5 Octane workers. To change the number of Octane workers, set the LARAVEL_CLOUD_OCTANE_WORKERS environment variable. Laravel Cloud caps the value at one less than the PHP-FPM worker count for the instance size.

Gunicorn and Puma

Gunicorn and Puma process one request per thread. When your application uses the start command Laravel Cloud generates, each replica’s capacity is its full thread pool, and Laravel Cloud adds replicas once every thread is busy:
  • Gunicorn: The thread pool is WEB_CONCURRENCY workers multiplied by GUNICORN_THREADS threads.
  • Puma: The thread pool is WEB_CONCURRENCY processes multiplied by RAILS_MAX_THREADS threads. Laravel Cloud counts one process when WEB_CONCURRENCY is unset or 0, and three threads when RAILS_MAX_THREADS is unset.
If you use a custom start command, or configure Gunicorn through GUNICORN_CMD_ARGS or a gunicorn.conf.py file, Laravel Cloud uses the memory-based estimate instead.

Event loop runtimes

Laravel Rust, Laravel Go, Go, Rust, Node.js, Bun, Deno, and FastAPI applications serve many requests at once. Their capacity comes from load tests of each runtime, multiplied by the vCPUs the application can use and rounded down: For example, a Go application on a 2 vCPU instance handles 696 requests in flight per replica, while a Node.js application on the same instance handles 181, because Node.js runs your application in a single process. FastAPI uses these values only with the Uvicorn start command Laravel Cloud generates, which runs WEB_CONCURRENCY workers. With a custom start command or another server, FastAPI applications use the memory-based estimate. Applications on other runtimes use the memory-based estimate as well.

Disabling HTTP traffic autoscaling

Requests that stay open, such as server-sent event streams and long polling, count as in-flight requests for as long as they remain open. An application holding many of them may add replicas even when it has spare capacity. To scale these applications on CPU and memory only, add the following variable to your environment variables and redeploy your environment:

Scheduled autoscaling

Scheduled autoscaling is available on the Business and Enterprise plans. It lets you define time-based overrides for clusters that scale between a minimum and maximum number of replicas. Overrides are useful for predictable traffic patterns like product launches, marketing campaigns, or business hours. Each scheduled override temporarily changes your cluster’s:
  • minimum replicas
  • maximum replicas
  • CPU threshold
  • memory threshold
You can configure overrides as one-time or recurring schedules. Recurring schedules support daily, weekday, weekend, or weekly patterns. Each schedule uses its own timezone, so the configured start and end times match the hours that matter to your team. If multiple schedules overlap, Laravel Cloud applies the most specific matching override. One-time schedules take precedence over recurring schedules. Among recurring schedules, schedules for specific days of the week take precedence over weekday or weekend schedules, and weekday or weekend schedules take precedence over daily schedules.
Laravel Cloud applies scheduled autoscaling changes automatically around the configured boundary times, typically within about one minute.

Scheduled autoscaling limitations

  • Scheduled autoscaling is available only for clusters that scale between a defined minimum and maximum replica count.
  • Recurring schedules must start and end on the same day. If you need an overnight window, create two schedules.
  • One-time schedules run once, then automatically stop applying after their scheduled window ends.

Compute classes

Laravel Cloud applications run on the latest generation of AWS Graviton EC2 servers, which have an optimized cost-to-performance ratio. Laravel Cloud offers two classes of compute:

Flex

Lightweight and cost-efficient. A good fit for development environments or applications that need the flexibility to support periodic traffic bursts.

Pro

Larger compute sizes designed for sustained, heavy utilization. Best for large-scale, mission-critical production applications.
Within each class, there are multiple sizes of CPU and RAM available. Prices vary by region. See Plans and Pricing for more information.

Compute metrics

To view your environment’s compute metrics, open the Metrics tab of your environment. For your environment’s App and worker clusters, the charts show CPU usage averaged across all replicas and the memory usage of the busiest replica. See Compute metrics for what each chart means.

Scale to zero

Your environment can scale to zero when it does not receive an inbound network request to your application (port 8080) within a specified time limit, known as the sleep timeout. While an environment is sleeping, Laravel Cloud does not charge you for its compute until it wakes again. New Flex compute sizes wake in under 500 milliseconds when the environment receives a new inbound request, which is fast enough that your application’s users will not notice. Legacy Flex sizes use the previous wake behavior and typically take 5-20 seconds to wake. To enable scale to zero, click your environment’s App cluster on the infrastructure canvas dashboard and enable the Scale to zero toggle. Then, save the compute cluster settings and redeploy the environment.

Scheduled tasks and queues

For Laravel Rust and Laravel PHP applications, a sleeping environment wakes automatically to run scheduled tasks. For applications that use scheduled tasks, Cloud wakes the App cluster to run commands on the schedules you configure in Cloud. Queued jobs do not wake a sleeping environment. If your jobs must keep processing while your environment sleeps, use managed queues or a worker cluster that stays awake. If you use Symfony’s Scheduler component instead of Laravel Cloud’s scheduled tasks, run it on an always-awake worker cluster. When your environment wakes for a scheduled task or a manual wake interval, it stays awake for the duration of the sleep timeout. Any inbound request resets this timer. Make sure your scheduled tasks and background processes can complete within that window.
If a queued job is still running when the sleep timeout elapses, the App cluster will stop and the job may be interrupted. We recommend managed queues for queued jobs so that scale to zero never interrupts background processing.

Manual wake interval

You may configure a manual wake interval to wake an environment on a fixed schedule, which is useful for self-managed background processes, such as queue workers, that must run periodically. As with scheduled tasks, a wake interval shorter than your sleep timeout can keep the environment awake continuously.

Worker clusters

Each worker cluster can either stay awake at all times or follow the App cluster and sleep alongside it. You may configure this behavior within the worker cluster’s settings.

Limitations

  • Only Flex compute sizes can scale to zero.
  • Sub-500 millisecond wake times apply to new Flex sizes only. Legacy Flex sizes keep their previous wake behavior.

Maintenance mode

This section applies to Laravel applications. Symfony applications handle maintenance mode differently.
By default, Laravel uses the file driver for maintenance mode. If you run php artisan down from the Commands tab, the maintenance mode state will not persist across deployments or apply to multiple replicas. To keep the maintenance mode state consistent across your application and its replicas, set the maintenance mode driver to cache and use either a database or Laravel Valkey (Redis-compatible) as the maintenance mode state backend in your environment variables.