Laravel Cloud Scale to Zero: How It Works | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com) [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles  ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    How Laravel Cloud's Scale to Zero Works: Checkpoint/Restore Explained        On this page       1. [  The Problem with the Original Scale to Zero ](#the-problem-with-the-original-scale-to-zero)
2. [  Checkpoint/Restore: The 20x Wake-Time Improvement ](#checkpointrestore-the-20x-wake-time-improvement)
3. [  The Hardest Engineering Challenges ](#the-hardest-engineering-challenges)
4. [  Fleet-Wide Reliability ](#fleet-wide-reliability)
5. [  OS-Level Integration on Bottlerocket ](#os-level-integration-on-bottlerocket)
6. [  Storage Performance vs. Cost ](#storage-performance-vs-cost)
7. [  How Compute, Database, and Cache Wake as a Unit ](#how-compute-database-and-cache-wake-as-a-unit)
8. [  Thundering Herd and Scheduled Tasks ](#thundering-herd-and-scheduled-tasks)
9. [  Failure Modes and Monitoring ](#failure-modes-and-monitoring)
10. [  Key Takeaways ](#key-takeaways)

  ![How Laravel Cloud's Scale to Zero Works: Checkpoint/Restore Explained](https://cdn.msaied.com/189/fc98120edde1924638e65eb1213fe43a.png)

 [  Laravel ](https://msaied.com/articles?category=laravel)  #Laravel Cloud   #Scale to Zero   #CRIU   #Checkpoint Restore   #Flex Compute   #Infrastructure  

 How Laravel Cloud's Scale to Zero Works: Checkpoint/Restore Explained 
=======================================================================

     15 Jun 2026      4 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

  10 sections  

1. [  01   The Problem with the Original Scale to Zero  ](#the-problem-with-the-original-scale-to-zero)
2. [  02   Checkpoint/Restore: The 20x Wake-Time Improvement  ](#checkpointrestore-the-20x-wake-time-improvement)
3. [  03   The Hardest Engineering Challenges  ](#the-hardest-engineering-challenges)
4. [  04   Fleet-Wide Reliability  ](#fleet-wide-reliability)
5. [  05   OS-Level Integration on Bottlerocket  ](#os-level-integration-on-bottlerocket)
6. [  06   Storage Performance vs. Cost  ](#storage-performance-vs-cost)
7. [  07   How Compute, Database, and Cache Wake as a Unit  ](#how-compute-database-and-cache-wake-as-a-unit)
8. [  08   Thundering Herd and Scheduled Tasks  ](#thundering-herd-and-scheduled-tasks)
9. [  09   Failure Modes and Monitoring  ](#failure-modes-and-monitoring)
10. [  10   Key Takeaways  ](#key-takeaways)

       The Problem with the Original Scale to Zero
-------------------------------------------

Laravel Cloud's first scale-to-zero implementation had a fundamental flaw: sleep meant complete removal. When an app went idle, it was evicted from the compute cluster entirely. The next incoming request had to trigger a full scheduling cycle—image pull, process initialization, and all. That added up to roughly **10 seconds** of wake time.

For any app with real traffic, that latency was unacceptable. Compute could sleep, but databases and caches had to stay running around the clock to avoid compounding the delay further.

Checkpoint/Restore: The 20x Wake-Time Improvement
-------------------------------------------------

The new [Flex compute](https://cloud.laravel.com/docs/compute#compute-classes) on Laravel Cloud replaces cold boots with **container checkpoint/restore**, built on [CRIU (Checkpoint/Restore In Userspace)](https://github.com/checkpoint-restore/criu) and the [zeropod](https://github.com/ctrox/zeropod) runtime.

Instead of removing the app when it goes idle, the runtime writes a complete snapshot of the process state to disk on the compute node—memory pages, open file descriptors, everything. When a new HTTP request or command execution arrives, the runtime restores from that snapshot rather than booting from scratch.

The result: **wake times under 500 milliseconds**, a 20x improvement over the previous architecture.

> "On request, the container runtime restores the app processes from the in-memory state and is able to respond to the incoming request within hundreds of milliseconds." — Cyrill Troxler, Senior Software Engineer of Infrastructure at Laravel

The Hardest Engineering Challenges
----------------------------------

### Fleet-Wide Reliability

Making checkpoint/restore work for a single app is straightforward. Making it work reliably across a large, heterogeneous fleet of apps with different runtimes and configurations is not. The team had to handle edge cases across a wide range of app setups.

### OS-Level Integration on Bottlerocket

Laravel Cloud's infrastructure runs on [Bottlerocket](https://aws.amazon.com/bottlerocket/), Amazon's container-optimized Linux distribution, with SELinux enforcing strict security policies. Installing a custom container runtime on that stack required package-level integration work not supported out of the box.

The team initially considered maintaining their own Bottlerocket variant—a significant ongoing burden. They eventually found a way to install the runtime on the official upstream version, avoiding that maintenance overhead entirely.

### Storage Performance vs. Cost

Sleeping apps write their in-memory state to local disk on the compute node. That storage must be fast enough to restore within hundreds of milliseconds, but cost-effective enough to operate across a global fleet. Balancing IOPS against storage size required multiple iterations.

How Compute, Database, and Cache Wake as a Unit
-----------------------------------------------

The three components of a Laravel Cloud stack don't rely on a central orchestrator. They signal each other through normal client connections:

1. **Compute** wakes on an incoming HTTP connection or command execution.
2. Once the app container is restored, it opens **TCP connections** to MySQL and Laravel Valkey using standard client drivers.
3. Those TCP connections are what wake the database and cache.

This keeps coordination lightweight and eliminates an extra orchestration layer and failure point. For Valkey specifically, because the runtime restores full in-memory state, the **cache is warm** the moment the app reconnects—no cache-warming overhead.

Thundering Herd and Scheduled Tasks
-----------------------------------

- **Concurrent requests during wake:** The first request triggers the restore. Subsequent requests are queued and forwarded concurrently once the app is ready—no requests are dropped.
- **Scheduled tasks:** A central scheduler running outside customer workloads handles waking apps and executing `schedule:run`. Your app doesn't need to be running for the scheduler to know it has work to do.
- **Queue workers:** For immediate queue processing without a scheduled interval, [managed queues](https://laravel.com/blog/managed-queues-autoscaling-queue-workers-on-laravel-cloud) run on always-warm infrastructure.

Failure Modes and Monitoring
----------------------------

If a checkpoint/restore wake fails, the system falls back to a cold start automatically. The request still succeeds—it just takes longer. The team monitors the custom runtime itself (not the sleeping app) and automatically restarts the runtime if health checks fail.

Key Takeaways
-------------

- Wake times dropped from ~10 seconds to under 500 ms using CRIU-based checkpoint/restore.
- The full stack (compute, database, cache) sleeps and wakes as a coordinated unit via TCP connections.
- Bottlerocket + SELinux integration required significant OS-level engineering.
- Concurrent wake requests are queued, not dropped.
- Cold-start fallback ensures no request errors on restore failure.
- Available now on Flex compute sizes: 512 MB, 1 GB, and 2 GB.

---

*Source: [How We Built Laravel Cloud's Scale to Zero](https://laravel.com/blog/how-we-built-laravel-clouds-scale-to-zero) — Laravel Blog, June 15, 2026*

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Fhow-laravel-clouds-scale-to-zero-works-checkpointrestore-explained&text=How+Laravel+Cloud%27s+Scale+to+Zero+Works%3A+Checkpoint%2FRestore+Explained) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Fhow-laravel-clouds-scale-to-zero-works-checkpointrestore-explained) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  How fast does Laravel Cloud's new scale-to-zero wake up compared to the old implementation?        The new Flex compute using checkpoint/restore wakes in under 500 milliseconds, compared to roughly 10 seconds with the original implementation—a 20x improvement. 

      Q02  What happens if the checkpoint/restore wake fails on Laravel Cloud?        The system automatically falls back to a cold start, booting the app container from scratch. This takes longer but ensures no request returns an error to the user. 

      Q03  Do I need to change anything in my Laravel app to use the new scale-to-zero Flex compute?        No application code changes are required. If you are already on Laravel Cloud, select one of the new Flex compute sizes (512 MB, 1 GB, or 2 GB) and redeploy. New apps get scale-to-zero Flex compute automatically. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://msaied.com/articles) 

 [ ![Laravel Eloquent Global Scopes: Pitfalls, Testing, and Composing Them Safely](https://cdn.msaied.com/211/8b9b19e7ecbf690b182ffbe6bffc9530.png) laravel eloquent testing 

### Laravel Eloquent Global Scopes: Pitfalls, Testing, and Composing Them Safely

Global scopes are powerful but easy to misuse. Learn how to write, test, and safely compose Eloquent global sc...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 16 Jun 2026     1 min read  

  Read    

 ](https://msaied.com/articles/laravel-eloquent-global-scopes-pitfalls-testing-and-composing-them-safely) [ ![Eloquent Custom Relations: Polymorphic Pivots, HasManyThrough Tricks, and Raw Join Relations](https://cdn.msaied.com/210/b47272214946c6adcd02ddf74b7df816.png) laravel eloquent database 

### Eloquent Custom Relations: Polymorphic Pivots, HasManyThrough Tricks, and Raw Join Relations

Beyond belongsTo and hasMany lies a set of underused Eloquent relation techniques. This guide covers custom re...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 16 Jun 2026     3 min read  

  Read    

 ](https://msaied.com/articles/eloquent-custom-relations-polymorphic-pivots-hasmanythrough-tricks-and-raw-join-relations) [ ![New in Laravel 12: Features, Helpers, and Upgrade Notes](https://cdn.msaied.com/209/c713447686bc1eb0a921b4027e4e4df8.png) laravel php upgrade 

### New in Laravel 12: Features, Helpers, and Upgrade Notes

Laravel 12 ships with a refined starter kit system, per-request context propagation, and several quality-of-li...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 16 Jun 2026     3 min read  

  Read    

 ](https://msaied.com/articles/new-in-laravel-12-features-helpers-and-upgrade-notes) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
