Jupyter · Advanced · Interview notes: how I answered a question about the jupyter-pro concurrency model

498
JUr/jupyter-pro·posted by ops_wang·just nowTutorial

Interview notes: how I answered a question about the jupyter-pro concurrency model

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

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.

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.

Mmysqlserverteam.comExternal link · opens in a new tab
166 comments

166 comments

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

466
Zzhou_yiMod·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.

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

351
Aalice_devMod·28 minutes 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.

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

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

312
Oops_wang·2 days ago

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

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

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

265
Aalice_dev·2 days ago

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

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

227
Lli_ming·2 days ago

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

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

135
Oops_wang·just now

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

192
Kkite·2 days ago

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

175
Aalice_devOP·2 days ago

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

115
Rran_boMod·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.

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

17
Ttang_hao·28 minutes 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.

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

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

312
Hhuang_ke·2 days ago

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

160
Ddev_zhou·28 minutes ago

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

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

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

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

102
Rrase·2 hours ago

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

112
Ddev_zhou·2 days ago

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

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

15
Nnikic·2 days ago

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

4
NnikicOP·just now

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

103
Ttang_haoOP·2 days ago

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

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

154
Aalice_dev·2 days ago

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

345
Wwinter·2 days agoedited

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

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

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

160
Rrase·2 days agoLevel 6

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

2
Hhuang_ke·28 minutes ago

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

251
Sslow_query·2 days ago

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

2
Oops_wang·2 days agoedited

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

126
Aalice_dev·2 days agoedited

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

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

141
Llinlin·2 days ago

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

40
Oops_wang·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
Zzhou_yi·28 minutes ago

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

130
Nnikic·3 minutes ago

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

341
Llinlin·1 hour ago

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

202
Rran_bo·2 days ago

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

55
Cchen_dev·3 minutes ago

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

43
Rran_boOP·2 hours 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.

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

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

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

276
RraseOP·just now

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

8
Lli_ming·2 days ago

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

104
Zzhu_zong·2 days agoeditedLevel 6

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

343
Bbob_chen·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
Cchen_dev·2 days ago

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

71
Kkite·2 days agoedited

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

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

32
Rrase·yesterday

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

184
Zzhu_zong·2 days ago

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

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

206
Zzhu_zong·3 minutes agoedited

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

91
Hhuang_ke·2 days agoLevel 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.

517
Sswoole_lee·2 days agoLevel 6

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

496
Oops_wang·28 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.

46
Ddev_zhouMod·12 minutes 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.

117
Nnikic·2 days ago

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

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

220
Kkernel_panic·2 days ago

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

6
Bbob_chen·2 days ago

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

41
Sslow_query·5 hours 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.

487
Ttang_hao·2 days agoedited

One counter-example: below jupyter-pro 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
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.

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

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

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

130
Cchen_dev·2 days ago

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

100
Mmike_xu·2 days ago

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

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

91
Kkite·2 days ago

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

88
Kkernel_panic·yesterday

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

87
Mmike_xu·2 days ago

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

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

319
Ttang_hao·2 days ago

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

159
Ttang_hao·2 days ago

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

318
Zzhu_zong·2 days ago

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

350
Oops_wangOP·2 days ago

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

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

16
Oops_wang·2 days agoedited

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

19
Hhuang_keMod·2 days ago

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

80
Lli_mingOP·3 minutes ago

One counter-example: below jupyter-pro 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
Ddev_zhouOP·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_devOP·5 hours 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
Bbob_chen·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.

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

43
Mmike_xu·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
Oops_wang·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.

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

17
Ttang_hao·2 days ago

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

17
Mmike_xu·2 days ago

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

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

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

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

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

6
Mmike_xu·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
Zzhu_zong·2 days ago

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

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

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

2
Wwinter·2 days agoedited

One counter-example: below jupyter-pro 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
Hhuang_ke·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.

469
Kkernel_panic·28 minutes ago

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

1
Kkernel_panic·2 days agoedited

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

5
Kkite·2 days ago

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

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

1
Ttang_hao·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/jupyter-pro/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 →