Polars · Beginners · I upgraded our production polars-newbie and hit these 11 landmines

1.5K
POr/polars-newbie·posted by ran_bo·2 days agoTutorial

I upgraded our production polars-newbie and hit these 11 landmines

Short version: polars-newbie 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.

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.

Self-host — full control44%
Managed service — less work28%
Hybrid: core self-hosted17%
Not decided yet11%

2530 votes total

789 comments

789 comments

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

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

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

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

121
Oops_wang·just now

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

8
Rrase·12 minutes ago

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

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

43
WwinterOP·2 hours agoedited

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

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

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

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

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

407
Lli_ming·28 minutes agoLevel 6

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

28
Ttang_hao·2 days ago

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

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

64
Rrase·2 days agoLevel 6

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

7
Nnikic·2 days ago

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

73
Lli_ming·2 days agoLevel 6

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

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

6
Sswoole_lee·2 days ago

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

476
Hhuang_ke·3 minutes ago

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

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

264
Llinlin·2 days ago

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

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

400
Oops_wangOP·2 days ago

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

128
Aalice_dev·3 minutes ago

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

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

304
Zzhu_zong·2 hours ago

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

272
WwinterOP·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.

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

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

393
Lli_ming·2 days agoedited

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

263
Zzhou_yi·yesterday

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

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

243
Kkite·just now

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

72
Cchen_dev·2 days ago

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

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

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

216
Aalice_dev·2 days agoLevel 6

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

110
Kkernel_panic·2 days agoedited

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

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

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

139
Sslow_query·2 hours 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.

190
Cchen_devOP·2 days ago

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

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

171
Ttang_haoOP·yesterdayedited

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

110
Kkernel_panicOP·3 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.

1
Ttang_hao·1 hour ago

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

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

142
Sslow_query·just now

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

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

52
Oops_wang·2 days ago

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

133
Lli_ming·2 days ago

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

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

122
Zzhou_yi·1 hour ago

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

1
Ttang_hao·2 days ago

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

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

33
LlinlinOP·3 minutes ago

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

29
Cchen_devOP·5 hours ago

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

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

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

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

165
Oops_wang·2 days ago

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

64
Sslow_query·2 days ago

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

81
Mmike_xuOP·2 days agoedited

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

16
Cchen_dev·2 days ago

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

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

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

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

4
Sslow_query·2 days ago

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

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

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

49
Aalice_dev·2 days agoedited

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

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

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

28
Nnikic·2 days ago

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

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

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

403
Cchen_dev·2 days ago

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

209
Mmike_xu·28 minutes ago

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

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

2
Zzhou_yiOP·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
Mmike_xu·2 days agoedited

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

13
Mmike_xu·2 days ago

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

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

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

11
Rrase·5 hours ago

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

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

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

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

379
Ttang_hao·2 days ago

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

56
Bbob_chen·2 days ago

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

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

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

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

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

201
Ttang_hao·2 days ago

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

77
Llinlin·2 days ago

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

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

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

7
Kkernel_panicMod·2 days ago

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

10
Oops_wang·yesterday

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

34
Mmike_xu·1 hour ago

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

20
Nnikic·2 days ago

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

104
Ddev_zhou·2 days ago

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

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

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

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

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

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

44
Ddev_zhou·2 days ago

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

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

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

170
KkiteOP·2 days agoLevel 6

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

225
Lli_ming·2 days ago

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

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

2
Oops_wang·2 days ago

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

1

This is the post detail page /en/c/polars-newbie/post/p10. 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 →