Tanstack · Ops · I upgraded our production tanstack-ops and hit these 11 landmines

419
TAr/tanstack-ops·posted by dev_zhou·3 days agoAnnouncement

I upgraded our production tanstack-ops and hit these 11 landmines

It took me two weeks of on-and-off digging and plenty of wrong turns. Writing the process down as it happened so the next person spends less time.

We also fixed monitoring along the way: replaced average-based alerts with percentiles and split them per endpoint. False alerts dropped by about seventy percent and the on-call rotation visibly cheered up.

The first thing was to collapse the variables. We were changing config and upgrading the version at the same time, and afterwards nobody could say which change caused what. We rolled back to moving one variable at a time, re-ran three times, and only then did the curve settle. Tedious, but not skippable.

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 tanstack-ops itself but our upstream connection reuse — the load test traffic was too clean and hid the long-tail requests.

Worth noting: the official docs do cover this, just in a very inconspicuous spot. I only found it reading the source comments, where the author explains the reasoning — roughly "so that it degrades into predictable behaviour in extreme cases".

234 comments

234 comments

· first 120 loaded
M
Wwinter·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.

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

502
Hhuang_ke·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".

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

106
Mmike_xu·2 hours ago

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

24
Ttang_haoMod·2 days ago

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

40
Bbob_chen·28 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".

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

5
Zzhu_zong·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".

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

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

517
Lli_ming·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.

304
Rran_bo·3 minutes 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.

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

75
Wwinter·2 days ago

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

92
Kkernel_panic·just now

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

487
Ddev_zhou·28 minutes agoedited

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

293
Zzhu_zong·2 days ago

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

129
Kkernel_panic·1 hour ago

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

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

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

60
Cchen_devOP·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.

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

17
Hhuang_ke·2 hours ago

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

7
Zzhu_zong·2 days agoedited

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

9
Hhuang_ke·just now

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

1
Cchen_dev·2 hours 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.

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

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

6
Nnikic·12 minutes ago

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

45
Wwinter·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".

304
Sswoole_lee·28 minutes 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.

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

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

467
Kkernel_panicOP·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.

397
Kkernel_panic·2 days agoedited

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

419
Sslow_queryOP·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.

210
Oops_wangOP·2 days ago

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

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

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

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

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

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

405
Oops_wangOP·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.

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

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

367
Rran_bo·28 minutes ago

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

342
Cchen_dev·2 days ago

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

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

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

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

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

300
Kkite·2 days ago

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

325
Hhuang_ke·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.

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

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

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

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

2
Llinlin·just now

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

345
Zzhou_yi·2 days ago

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

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

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

204
Ttang_hao·2 days agoedited

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

176
Cchen_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.

77
Zzhou_yi·2 days ago

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

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

152
Oops_wang·3 minutes 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.

150
LlinlinMod·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.

140
Rrase·2 days agoedited

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

140
LlinlinOP·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.

77
Sslow_query·2 days agoedited

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

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

125
Ttang_hao·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.

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

112
Ddev_zhou·12 minutes ago

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

364
Sslow_queryOP·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.

32
Sswoole_lee·2 days agoedited

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

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

102
Hhuang_ke·just now

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

78
Kkernel_panic·2 days ago

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

2
Aalice_devOP·just now

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

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

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

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

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

61
Llinlin·2 days 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
Oops_wang·3 minutes 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.

54
Hhuang_ke·just now

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.

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

218
Rran_bo·3 minutes ago

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

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

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

3
Nnikic·2 hours 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.

154
Zzhou_yiOPMod·2 days ago

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

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

146
Ddev_zhou·2 days ago

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

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

1
Sswoole_lee·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".

324
Aalice_devOP·2 days ago

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

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

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

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

23
Nnikic·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".

209
Nnikic·2 days ago

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

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

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

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

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

47
Oops_wangOP·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.

42
Aalice_dev·5 hours 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
Ddev_zhou·2 days ago

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

6
Ddev_zhou·2 days 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.

64
Ttang_haoOP·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
Kkite·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".

4
Cchen_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.

3
Sswoole_lee·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
Lli_ming·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.

1
Zzhou_yi·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
Aalice_devMod·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.

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

1

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