HLSL · Performance · Help: hlsl-perf fails to start intermittently in containers, logs inside

678
HLr/hlsl-perf·posted by zhu_zong·yesterdayOpen source

Help: hlsl-perf fails to start intermittently in containers, logs inside

Short version: hlsl-perf 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.

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

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.

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.

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.

351 comments

351 comments

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

508
Rrase·2 days ago

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

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

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

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

489
Aalice_devMod·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.

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

454
Lli_ming·yesterday

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

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

412
Rrase·2 days ago

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

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

407
Rran_bo·2 days ago

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

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

397
Hhuang_ke·12 minutes ago

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

48
Rrase·5 hours ago

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

204
Oops_wangOP·2 days ago

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

1
Lli_ming·2 days ago

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

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

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

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

82
Lli_ming·2 days agoLevel 6

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

53
Ddev_zhou·2 days agoLevel 6

One counter-example: below hlsl-perf 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
Rran_boOP·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.

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

159
Rrase·2 days ago

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

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

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

161
Zzhou_yi·2 days agoLevel 6

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

421
Bbob_chen·2 days agoLevel 6

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

31
Ttang_hao·2 days ago

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

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

57
Kkernel_panic·2 days ago

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

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

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

7
Rran_bo·2 hours ago

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

149
Cchen_devOP·2 days agoedited

One counter-example: below hlsl-perf 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
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.

2
Rrase·2 days ago

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

428
Bbob_chen·2 days agoLevel 6

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

307
Zzhu_zongMod·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.

22
Wwinter·2 days ago

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

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

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

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

294
Llinlin·2 days ago

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

280
Lli_ming·3 minutes ago

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

275
Rran_bo·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
Ddev_zhouOP·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.

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

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

10
Mmike_xu·1 hour ago

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

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

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

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

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

212
Zzhou_yi·2 days ago

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

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

205
Zzhu_zong·2 days ago

One counter-example: below hlsl-perf 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
Bbob_chen·2 days ago

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

66
Hhuang_keMod·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
Lli_ming·2 days ago

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

191
Sslow_query·2 days ago

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

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

181
Kkernel_panic·yesterdayedited

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.

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

163
Ddev_zhou·2 days ago

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

159
Hhuang_ke·just now

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

155
Zzhu_zong·2 days ago

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

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

148
Kkite·2 days ago

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

146
Lli_ming·2 hours ago

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

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

168
Rran_boOP·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.

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

109
Lli_mingOP·3 minutes agoedited

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

41
Aalice_dev·1 hour ago

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

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

3
Kkernel_panic·just nowedited

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.

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

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

116
WwinterOP·2 days ago

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

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

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

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

57
Mmike_xu·2 days agoedited

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

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

40
Rrase·2 days ago

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

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

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

78
Sslow_query·5 hours agoedited

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

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

67
Hhuang_ke·2 days ago

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

52
Nnikic·28 minutes ago

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

49
Zzhou_yi·12 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.

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

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

443
Sswoole_lee·2 hours ago

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

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

2
Lli_ming·2 days ago

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

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

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

27
Zzhu_zong·2 days agoedited

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

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

5
Hhuang_ke·2 hours ago

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

16
Wwinter·5 hours ago

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

264
Ttang_hao·2 days ago

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

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

21
Mmike_xu·5 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.

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

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

6
Wwinter·2 days ago

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

6
Zzhu_zong·2 days ago

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

6
Kkernel_panic·2 days ago

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

5
Wwinter·1 hour ago

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

1
Hhuang_keOP·2 days ago

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

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

95
Sslow_query·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
Rran_bo·2 days ago

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

383
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

This is the post detail page /en/c/hlsl-perf/post/p8. 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 →