# 5 breaking points in data-intensive systems and the Laravel production stack

> Five breaking points from the working set to a separate data tier, the wrong diagnoses, and a Laravel production stack with a reason for every component.

- Kind: Presentation
- Published: 2026-10-03
- Slides: 25
- Based on these articles: https://muhammetsafak.com/engineering/systems/data-intensive-systems-breaking-points/ · https://muhammetsafak.com/engineering/systems/laravel-production-stack/
- Source: https://muhammetsafak.com/visuals/d/data-intensive-breaking-points-laravel-stack/
- Language: en-US
- Author: Muhammet Şafak

---
## Slide 1 — 5 breaking points in data-intensive systems

Muhammet Şafak — Visuals

From the cheapest fix to the costliest, and a Laravel stack with a reason for every part.

Muhammet Şafak October 3, 2026

## Slide 2 — Five breaking points

Section 01

From the working set to a separate data tier: from the cheapest intervention to the most expensive.

## Slide 3

What sets the scale

Not requests: the data profile.

A system can take 50 requests per minute and still be drowned by its data; another handles 5,000 requests per second comfortably while its data tier sits untouched.

## Slide 4 — Five axes

Data profile

-   Working set / RAM ratio Does the frequently read data fit in memory?
-   Read / write ratio Which way does the load tilt?
-   Single table size How big has a single table grown?
-   Write throughput How much does the primary write per second?
-   Consistency requirement Which reads must see the freshest data?

## Slide 5 — Starting with a single primary

Starting architecture

PHP-FPM reaches PostgreSQL through pgBouncer and Redis directly. Enough for a few tens of GB of data and thousands of requests per minute, as long as the working set fits in RAM.

1.  PHP-FPM application
2.  pgBouncer connection pool
3.  PostgreSQL 16 single primary
4.  Redis 7 cache · session · lock

## Slide 6 — Signal: cache hit ratio

Breaking point 01 · Working set

The frequently read data doesn’t fit in RAM. Above 99% is healthy. A drop toward 95%, read together with disk IOPS, shows the working set has spilled out of RAM.

pg\_stat\_database.sql

```
1SELECT2sum(blks_hit) * 1003  / nullif(sum(blks_hit) + sum(blks_read), 0)4  AS cache_hit_ratio5FROM pg_stat_database;
```

## Slide 7 — Exhaust the cheap one first

Order of intervention

1.   Step 1: Index discipline `cut unnecessary scans`
2.   Step 2: Separate dead data `shrink the hot data`
3.   Step 3: Vertical scale `last, more RAM`

## Slide 8 — Reads to the replica, writes to the primary

Breaking point 02 · Read load

Signal: CPU is high, SELECT dominates, `cl_waiting` piles up in pgBouncer. `sticky` sends reads that follow a write within the same request to the primary.

config/database.php

```
1'pgsql' => [2  'driver'  => 'pgsql',3  'read'  => ['host' => ['10.0.0.2']],   // replica4  'write' => ['host' => ['10.0.0.1']],   // primary5  'sticky' => true,6  // ...shared settings7],
```

## Slide 9 — The new problem the replica brings

The cost

-   **Lag** Replication lag: the replica falls behind; the read-after-write guarantee is lost.
-   **Monitor it** In pg\_stat\_replication, read the replay\_lsn difference as lag\_bytes.
-   **Primary** Reads that need consistency, such as balance, stock and permissions, stay on the primary.
-   **Limit** A read replica adds nothing to write capacity.

## Slide 10 — A table split by time

Breaking point 03 · Single table

Signal: `n_dead_tup` keeps piling up, `last_autovacuum` falls behind. Instead of creating partitions by hand, you can use `pg_partman`.

events.sql

```
1CREATE TABLE events (2  id          bigserial,3  occurred_at timestamptz NOT NULL,4  payload     jsonb       NOT NULL5) PARTITION BY RANGE (occurred_at);67CREATE TABLE events_2026_05 PARTITION OF events8  FOR VALUES FROM ('2026-05-01') TO ('2026-06-01');
```

## Slide 11 — What does partitioning buy you?

Gain and condition

-   Partition pruning The query looks only at the relevant partition.
-   Cheap deletion Old data goes away with DROP TABLE events\_2026\_01.
-   Bounded vacuum Vacuum scans the partition, not the whole table.
-   Primary key It must include the partition key: (id, occurred\_at).
-   BRIN A small, cheap index for time-ordered data.

## Slide 12 — Signal: I/O wait, checkpoint and WAL pressure

Breaking point 04 · Write load

1.   Step 1: Reduce amplification `drop idx_scan = 0 indexes, fillfactor/HOT, batch insert`
2.   Step 2: Take out append data `append-heavy data is separated from the primary`
3.   Step 3: Split the data domain `last: functional sharding`

## Slide 13

Realistic expectation

Most systems never reach point 4.

Don't rush: most systems never reach point 4, and most of those that do arrive early because they skipped point 1 (a missing index, a bloated working set).

## Slide 14 — A separate data tier

Breaking point 05

-   **The move** The data-heavy domain is moved to a separate PostgreSQL instance.
-   **Migration** pgBackRest restore, logical replication and a short cutover.
-   **Cost** A second backup, monitoring and upgrade; no JOIN across the two data sets.
-   **Rule** The decision to separate is made by the data profile, not by the org chart.

## Slide 15 — Wrong breaking points

Wrong diagnosis

A read replica scales reads; a cache reduces reads; partitioning tames a single table. None of them increases write throughput.

| What you see | What it really is | The right move |
| --- | --- | --- |
| "The database is slow" | N+1: the app fires 200 queries | Eager loading; count queries |
| "We need a replica" | One query lacks an index | EXPLAIN ANALYZE, add the index |
| "We need sharding" | Replicas, partitioning untried | Exhaust points 2 and 3 first |
| "Move to NoSQL" | jsonb, BRIN, partitioning unused | Use PostgreSQL to the fullest |
| "Cache the writes" | A cache cuts reads, not writes | Look at point 4 |

## Slide 16

The common error pattern

None of them adds write capacity.

A read replica scales reads. A cache reduces reads. Partitioning tames a single table. None of them increases write throughput.

## Slide 17

jsonb · LISTEN/NOTIFY · partitioning · BRIN · logical replication

You used 20%. That's not a limit.

Most teams use 20% of PostgreSQL and conclude that "PostgreSQL isn't enough".

## Slide 18 — From cheapest to most expensive

Summary

1.   Step 1: Working set `index + RAM`
2.   Step 2: Read load `read replica`
3.   Step 3: Single table `partitioning`
4.   Step 4: Write load `amplification + separation`
5.   Step 5: Data-heavy domain `separate data tier`

## Slide 19 — Laravel stack

Section 02

I'm not saying "everything is necessary" — I'm someone who argues for keeping it minimal until you understand it's needed — but what each component buys you is concrete.

## Slide 20 — Why is each component there?

Anatomy

Requests reach PHP-FPM through Cloudflare. PHP-FPM connects to three backing services separately: PostgreSQL through pgBouncer, Redis and RabbitMQ. Workers run with Horizon under Supervisor.

1.  Cloudflare DDoS, WAF, rate limiting, TLS, CDN
2.  Nginx TLS, static assets, fastcgi in one config
3.  PHP-FPM opcache + preload
4.  pgBouncer transaction mode connection pool
5.  PostgreSQL pgBackRest: full + incremental + WAL PITR
6.  Redis · RabbitMQ cache/session/lock · queue

## Slide 21 — One instance, three hats

Redis

Cache (`Cache::remember`), session (`SESSION_DRIVER=redis`) and lock (`Cache::lock`) all run safely on a single Redis, as long as these three settings are in place.

redis.conf

```
1maxmemory-policy volatile-lru2appendonly no3save 900 1 300 10 60 10000
```

## Slide 22 — RabbitMQ versus the Redis queue

Queue (optional)

|  | Redis | RabbitMQ |
| --- | --- | --- |
| Persistence | Serves from memory; goes to disk via RDB or AOF | Writes persistent messages to disk |
| Redelivery | Depends on the retry\_after timeout | Depends on the consumer's connection |
| Routing | The routing decision stays in the application | Exchanges decide |
| Monitoring | Horizon; limited to what the application dispatches | A broker-level management panel |

## Slide 23 — What do you lose if you remove each piece?

What happens when removed

What do you lose if you remove each piece?

| Component | What happens when removed |
| --- | --- |
| pgBouncer | In connection storms PostgreSQL connections run out and requests throw 500 |
| Supervisor | Workers don't come back after a crash, you have to set up alarms |
| Horizon | Visibility collapses, you answer "why is the queue slow" blind |
| opcache | Every request reads and parses the PHP file from disk, ~5x slowdown |
| pgBackRest | Only pg\_dump remains: no PITR, a day's backup as your error margin |
| Redis lock | You're open to race conditions, you're left without a distributed-safe mutex |

## Slide 24

Boring stack

Measurably useful, easy to change.

The strength of a boring stack is exactly this: every piece is quantitatively valuable and easy to change.

## Slide 25 — Thank you

[muhammetsafak.com/engineering/](https://muhammetsafak.com/engineering/)

Measure the data profile first, then pick the cheapest intervention.
