Tanstack · Ops · tanstack-ops logging: what separates "readable" from "usable"

1.0K
TAr/tanstack-ops·posted by slow_query·3 days agoJobs

tanstack-ops logging: what separates "readable" from "usable"

Most tanstack-ops articles stop at "how to use it" and never cover "when not to use it". This is an attempt at the second half.

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 query that broke: a full scan over 20M rows.
-- A composite index took P99 from 1.8s down to 42ms.
SELECT id, title, created_at
  FROM posts
 WHERE community_id = ?
   AND status = 1
 ORDER BY score DESC
 LIMIT 20;

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.

On trade-offs, my view is this: if nobody on the team owns this area long-term, do not introduce a second mechanism. With two coexistence you first have to work out which one is even in play when things break, and that costs far more than the performance you saved.

533 comments

533 comments

· first 120 loaded
M
Hhuang_ke·2 days ago

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

508
Hhuang_ke·12 minutes ago

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

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

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

33
Zzhou_yi·28 minutes ago

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

249
Ddev_zhouMod·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.

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

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

161
Aalice_dev·2 days ago

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

238
Oops_wang·yesterday

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

233
Sslow_query·2 days ago

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

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

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

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

441
LlinlinMod·3 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.

424
Ddev_zhou·just now

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.

418
Sswoole_leeMod·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.

3
Sswoole_leeOP·2 days ago

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

357
Nnikic·3 minutes ago

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

390
Rrase·just now

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

385
Mmike_xu·2 days ago

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

369
Lli_ming·3 minutes ago

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

366
Cchen_dev·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.

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

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

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

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

234
Lli_mingMod·2 hours ago

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

119
Kkite·2 days ago

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

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

230
Cchen_dev·2 days agoLevel 6

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

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

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

44
Oops_wang·28 minutes agoLevel 6

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

99
Sslow_query·just now

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
Oops_wang·2 days ago

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

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

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

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

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

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

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

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

343
Rran_bo·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".

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

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

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

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

10
Wwinter·2 days ago

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

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

253
Hhuang_ke·2 days ago

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

289
Zzhou_yi·2 days ago

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

16
Sswoole_lee·2 days agoedited

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

67
Rrase·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".

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

210
Hhuang_keMod·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.

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

98
Hhuang_ke·yesterday

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

157
Rran_boMod·just now

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

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

143
Hhuang_ke·3 minutes 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.

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

75
Nnikic·2 days agoedited

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.

126
Ttang_haoMod·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.

113
Rran_bo·5 hours 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.

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

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

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

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

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

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

73
Lli_mingOP·2 days ago

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

12
Cchen_devOP·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".

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

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

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

425
Nnikic·2 days ago

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

66
Kkernel_panic·5 hours 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.

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

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

59
Rrase·yesterday

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.

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

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

39
Ttang_hao·just now

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.

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

514
Sslow_query·28 minutes ago

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

181
Zzhou_yi·28 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.

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

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

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

36
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
WwinterOP·2 days ago

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

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

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

8
Bbob_chenOP·just now

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.

28
Wwinter·yesterday

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

340
Wwinter·yesterday

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.

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

22
Bbob_chen·12 minutes ago

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

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

34
Bbob_chenMod·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.

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

161
Rrase·2 days agoedited

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

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

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

20
Rran_bo·2 days ago

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

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

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

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

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

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

131
Sswoole_lee·12 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.

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

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

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

30
Bbob_chenMod·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.

1
Kkite·2 days ago

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

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

1
Nnikic·2 days agoedited

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

1

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