tmux · Advanced · I upgraded our production tmux-pro and hit these 11 landmines

1.5K
TMr/tmux-pro·posted by li_ming·2 days agoTranslation

I upgraded our production tmux-pro and hit these 11 landmines

Some background first. Our setup is tmux-pro plus three downstream services, seven figures of daily requests, peaking around nine in the evening.

What genuinely surprised me was the tail. The average looked great while P99 jumped by an order of magnitude past some threshold. The cause was not tmux-pro itself but our upstream connection reuse — the load test traffic was too clean and hid the long-tail requests.

One last trap: in container environments remember to adjust the memory-related parameters in step. Otherwise the host limit and the process expectation disagree, and the symptom is intermittent, unreproducible failure.

Sstackoverflow.comExternal link · opens in a new tab
493 comments

493 comments

· first 120 loaded
M
Sswoole_lee·12 minutes ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

509
Rran_bo·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

482
Kkite·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

393
Cchen_dev·2 days ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

385
Wwinter·2 days ago

One counter-example: below tmux-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

54
Mmike_xu·1 hour agoedited

I just read the tmux-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

381
Mmike_xu·3 minutes ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

377
Cchen_dev·2 days ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

368
Oops_wang·2 days ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

353
WwinterOP·2 days ago

This is not a tmux-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

242
Ttang_haoOP·28 minutes ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

191
Kkernel_panic·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

247
Rran_bo·2 days ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

211
Wwinter·2 days ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

199
Hhuang_ke·28 minutes ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

187
Rran_bo·yesterday

Saved. I am reworking this area this week — this saves a lot of wrong turns.

142
Wwinter·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

141
Ddev_zhou·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

136
Aalice_dev·2 days ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

201
Ddev_zhou·2 days ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

135
Nnikic·2 days ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

129
Lli_ming·1 hour ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

120
Zzhu_zong·3 minutes ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

110
Bbob_chen·3 minutes ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

380
Cchen_devOP·yesterday

One counter-example: below tmux-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

290
Ddev_zhouOP·5 hours ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

202
Bbob_chen·2 days ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

229
Kkite·2 days ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

397
Sswoole_lee·2 days agoLevel 6

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

385
Nnikic·2 days ago

I just read the tmux-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

141
Rran_bo·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

2
Rrase·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

206
Ddev_zhouOP·2 days ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

2
Oops_wang·2 days ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

35
Kkernel_panic·2 days ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

14
Mmike_xu·2 days ago

This is not a tmux-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

1
Cchen_dev·12 minutes ago

I just read the tmux-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

6
Mmike_xu·28 minutes ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

273
Zzhu_zong·2 days agoedited

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

110
Oops_wang·just now

I just read the tmux-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

154
Ttang_hao·2 days ago

One counter-example: below tmux-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

203
Nnikic·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

97
Kkernel_panic·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

240
Aalice_devOP·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

11
Kkernel_panic·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

92
Zzhu_zongOP·2 hours ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

42
Wwinter·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

98
Ttang_hao·2 days ago

This is not a tmux-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

90
Llinlin·2 days ago

This is not a tmux-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

193
Hhuang_ke·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

87
Ddev_zhou·2 days agoedited

Saved. I am reworking this area this week — this saves a lot of wrong turns.

185
Zzhou_yi·2 days ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

85
Wwinter·2 days ago

One counter-example: below tmux-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

73
Rran_boOP·2 days agoedited

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

6
Sswoole_lee·2 days ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

62
Rrase·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

59
Rran_bo·2 days ago

I just read the tmux-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

5
Zzhou_yiOP·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

510
Rran_bo·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

329
Lli_ming·2 days ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

50
Nnikic·2 hours ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

45
Cchen_dev·2 days ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

16
Rran_bo·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

43
Zzhou_yiMod·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

38
Nnikic·2 days agoedited

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

36
Kkite·2 days ago

One counter-example: below tmux-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

34
Sslow_query·12 minutes ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

25
Bbob_chen·just now

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

21
Mmike_xu·2 days ago

I just read the tmux-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

508
Kkite·2 days ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

50
Nnikic·3 minutes ago

This is not a tmux-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

17
Sslow_query·yesterday

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

119
Rran_bo·2 days agoedited

Saved. I am reworking this area this week — this saves a lot of wrong turns.

144
Kkernel_panic·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

127
Hhuang_ke·3 minutes ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

86
Bbob_chen·2 days ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

140
Kkite·2 hours ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

10
LlinlinMod·12 minutes agoedited

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

14
Kkite·3 minutes ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

46
Aalice_dev·12 minutes ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

7
Sswoole_lee·2 days ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

248
Cchen_dev·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

1
Aalice_dev·2 days ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

168
Nnikic·2 days ago

This is not a tmux-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

302
Hhuang_ke·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

49
Sswoole_leeOP·2 days ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

516
Sswoole_leeOPMod·2 days agoLevel 6

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

394
Ttang_hao·2 days agoLevel 6

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

42
Llinlin·2 days agoLevel 6

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

15
Hhuang_ke·3 minutes ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

75
Rran_bo·1 hour agoedited

I just read the tmux-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

6
Nnikic·2 days agoLevel 6

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

2
Zzhu_zong·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

3
Nnikic·12 minutes agoLevel 6

This is not a tmux-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

396
Oops_wang·2 days agoLevel 6

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

97
Sslow_query·2 days agoLevel 6

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

15
Zzhou_yi·2 days ago

One counter-example: below tmux-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

16
Sslow_query·2 days ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

171
Kkernel_panic·28 minutes ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

13
NnikicOP·2 days ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

1
Sswoole_lee·2 days ago

I just read the tmux-pro source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

10
Rrase·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

13
Oops_wang·2 days ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

8
Sswoole_lee·2 days ago

One counter-example: below tmux-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

7
Kkite·2 days agoedited

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

4
Zzhou_yi·2 days ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

2
Hhuang_ke·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

1
Cchen_dev·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

87
Rran_bo·28 minutes ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

1
Kkite·2 days ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

456
Llinlin·2 days ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

223
Wwinter·2 days ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

136
Rran_bo·28 minutes ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

18
Zzhou_yi·2 days agoedited

One counter-example: below tmux-pro 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

274
NnikicOP·2 days ago

This is not a tmux-pro problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

136
Ddev_zhou·2 days agoLevel 6

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

32
Zzhu_zong·2 days ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

7
Wwinter·just now

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

1
Oops_wang·2 days ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

52
Aalice_dev·2 days agoedited

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

1

This is the post detail page /en/c/tmux-pro/post/p3. Posts and comments are generated deterministically from a seeded PRNG, so the same post always renders the same content and the link can be shared, reloaded and indexed. In production this page reads MySQL for the post, Redis for hot-post caching, and fetches the whole comment tree in a single query on the path column.

See the database schema →