Tanstack · Ops · Help: tanstack-ops fails to start intermittently in containers, logs inside

629
TAr/tanstack-ops·posted by slow_query·just nowTutorial

Help: tanstack-ops fails to start intermittently in containers, logs inside

Short version: tanstack-ops needs almost no tuning at small and medium scale — the point where it starts to hurt is much further out than most people assume. Full measurements below.

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.

Image placeholder · object storage in production
POST /api/uploads → CDN origin pull
259 comments

259 comments

· first 120 loaded
M
Wwinter·2 days ago

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

482
Sswoole_lee·2 days ago

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

478
Bbob_chen·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.

461
KkiteOP·2 days ago

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

45
Ddev_zhou·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.

443
Lli_ming·2 days ago

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

434
Wwinter·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.

219
Hhuang_keOP·just now

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

353
Oops_wang·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.

404
Mmike_xu·2 days agoedited

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.

480
Zzhou_yiOP·2 days agoedited

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

144
Cchen_dev·2 days 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.

33
Aalice_dev·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.

38
Aalice_dev·12 minutes 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.

368
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.

364
Bbob_chen·2 days agoedited

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

361
Bbob_chen·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.

296
Rrase·yesterday

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.

293
Kkernel_panic·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.

293
Ttang_hao·2 days ago

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

249
Bbob_chen·just nowedited

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.

248
Sswoole_lee·2 hours ago

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

274
Cchen_dev·2 days agoedited

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

280
Rran_bo·2 days ago

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

31
Oops_wang·2 days ago

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

512
Sswoole_lee·2 days ago

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

184
Oops_wang·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.

108
Sslow_queryMod·2 hours ago

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

14
Sswoole_lee·2 days ago

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

29
Ttang_hao·28 minutes ago

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

158
Aalice_dev·3 minutes 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.

137
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.

190
Rrase·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.

459
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.

62
Nnikic·2 days agoeditedLevel 6

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

1
Sslow_query·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.

2
Ddev_zhouMod·2 days ago

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

390
Sswoole_leeOP·2 days ago

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

187
Kkite·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.

62
NnikicOP·2 days ago

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

134
Aalice_dev·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.

172
Sslow_queryMod·yesterday

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.

5
Llinlin·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.

1
Rran_bo·2 days ago

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

4
Mmike_xu·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.

470
Ddev_zhou·2 days agoLevel 6

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.

58
Sslow_query·just noweditedLevel 6

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

1
Rran_bo·1 hour 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.

9
Ddev_zhou·yesterday

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

100
Oops_wang·2 days ago

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

474
Mmike_xu·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.

186
Nnikic·2 days agoLevel 6

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.

153
Lli_ming·2 days ago

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

26
Zzhou_yi·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.

1
Bbob_chen·2 days ago

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

1
Zzhu_zongOPMod·2 days ago

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

1
Llinlin·1 hour agoedited

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

1
RraseOP·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.

320
Cchen_dev·2 hours ago

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

52
Kkernel_panic·2 days ago

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

446
Zzhou_yi·2 hours agoedited

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

13
Aalice_dev·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.

4
Kkite·2 days ago

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

373
LlinlinOP·1 hour 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.

187
Sslow_query·just now

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.

222
Ddev_zhou·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.

183
Lli_ming·2 days ago

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

182
Ddev_zhou·2 days ago

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

174
Oops_wangMod·2 days ago

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

379
Mmike_xu·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.

165
Lli_ming·5 hours ago

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

136
Kkernel_panic·5 hours ago

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

2
Kkernel_panic·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.

118
Ddev_zhou·28 minutes ago

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

114
Wwinter·yesterday

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.

111
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.

106
Ttang_hao·3 minutes agoedited

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

102
Lli_ming·2 days ago

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

87
Sswoole_leeOP·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.

10
NnikicOP·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.

10
Kkernel_panic·2 days ago

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

66
Rran_bo·2 days ago

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

65
NnikicOP·12 minutes 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.

2
Zzhou_yiOP·28 minutes ago

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

2
Rran_bo·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.

61
Sswoole_lee·2 days ago

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

44
Llinlin·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.

27
Sswoole_lee·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.

140
Ddev_zhou·2 days agoedited

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

262
Kkernel_panic·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.

73
Zzhou_yi·2 days ago

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

215
Ddev_zhou·1 hour ago

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

19
Aalice_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.

115
Zzhou_yi·3 minutes ago

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

136
Bbob_chen·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.

16
Sslow_queryOP·yesterday

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

326
Lli_mingMod·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.

11
Rran_bo·12 minutes 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.

13
Cchen_devOP·2 hours agoedited

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

2
KkiteOP·5 hours agoedited

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.

3
Ddev_zhou·3 minutes ago

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

47
Zzhou_yiOP·2 days ago

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

57
Lli_ming·2 days ago

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

298
KkiteMod·2 days ago

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

4
Nnikic·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.

90
Zzhou_yi·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.

93
Rrase·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.

168
Oops_wang·2 days ago

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

15
Aalice_dev·12 minutes agoedited

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.

4
Ddev_zhou·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.

9
Zzhu_zong·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.

458
Oops_wang·2 days ago

One counter-example: below tanstack-ops 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
Mmike_xu·2 days ago

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

6
Rrase·2 days ago

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

3
Zzhu_zong·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.

59
Sslow_query·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.

3
Rrase·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.

1
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.

1
Rrase·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.

1
Llinlin·28 minutes 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.

1

This is the post detail page /en/c/tanstack-ops/post/p5. 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 →