Clojure · Job board · The edge cases the clojure-jobs docs never spell out

589
CLr/clojure-jobs·posted by winter·just nowHelp

The edge cases the clojure-jobs docs never spell out

Short version: clojure-jobs 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.

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

281 comments

281 comments

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

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

450
Ddev_zhou·2 days ago

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

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

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

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

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

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

274
Oops_wang·2 days ago

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

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

12
Mmike_xu·2 days ago

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

296
Rrase·yesterday

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

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

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

288
Aalice_devOP·1 hour ago

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

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

515
Sslow_query·just now

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

234
Ttang_hao·2 days ago

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

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

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

257
Wwinter·2 days ago

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

239
Nnikic·just nowedited

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.

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

230
Rrase·2 days ago

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

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

227
Cchen_devOP·2 days ago

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

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

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

107
Ttang_hao·1 hour ago

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

152
Bbob_chen·2 days ago

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

119
Ttang_haoOP·28 minutes ago

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

46
Lli_ming·yesterday

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

99
Rran_boOP·12 minutes ago

One counter-example: below clojure-jobs 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·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.

101
Sslow_query·28 minutes ago

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

130
Lli_ming·2 hours agoedited

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

129
Aalice_dev·2 days ago

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

434
Sswoole_lee·2 hours agoeditedLevel 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.

209
Hhuang_ke·2 days ago

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

76
NnikicMod·2 days ago

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

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

427
Ttang_hao·2 days agoLevel 6

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

31
Zzhu_zong·2 days ago

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

21
Wwinter·2 days agoLevel 6

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

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

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

331
Oops_wangOP·2 days agoLevel 6

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

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

282
Zzhou_yi·2 hours agoLevel 6

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

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

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

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

33
Rrase·2 days ago

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

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

1
Aalice_dev·2 days agoLevel 6

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

471
Sswoole_lee·just noweditedLevel 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.

409
Sslow_queryOP·2 days agoLevel 6

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.

315
Lli_mingMod·2 days agoeditedLevel 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.

28
Hhuang_ke·yesterdayLevel 6

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

5
Lli_ming·2 hours ago

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

70
Hhuang_keOP·28 minutes ago

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

448
Aalice_dev·2 days ago

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

288
Rrase·2 days agoLevel 6

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

175
Wwinter·2 days agoLevel 6

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

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

89
Mmike_xuOP·2 days ago

One counter-example: below clojure-jobs 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
Ttang_hao·2 days ago

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

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

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

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

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

326
Zzhu_zong·2 days agoLevel 6

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

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

254
Oops_wang·2 days agoeditedLevel 6

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

7
Rran_bo·2 days ago

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

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

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

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

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

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

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

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

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

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

377
Mmike_xu·2 days ago

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

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

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

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

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

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

59
Rrase·2 days ago

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

58
Zzhu_zong·12 minutes ago

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

48
Lli_ming·yesterdayedited

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.

179
Sslow_query·3 minutes agoedited

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

47
Hhuang_ke·2 days ago

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

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

46
Hhuang_ke·2 days agoedited

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.

283
Cchen_dev·2 days ago

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

33
Rrase·2 days ago

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

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

262
Hhuang_ke·2 days ago

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

6
Lli_ming·2 days ago

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

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

15
Llinlin·3 minutes ago

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

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

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

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

16
Bbob_chen·2 days agoLevel 6

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

37
Cchen_dev·2 days agoLevel 6

This is not a clojure-jobs 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 ago

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

109
Kkite·28 minutes ago

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

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

31
Oops_wang·2 days ago

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

20
Cchen_dev·28 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.

14
Rran_bo·2 days ago

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

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

8
Zzhu_zong·2 days ago

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

3
Kkite·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

This is the post detail page /en/c/clojure-jobs/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 →