Llamaindex · Toolchain · This llamaindex-tools bug hid for three years before anyone reported it

1.6K
LLr/llamaindex-tools·posted by nikic·just nowAnnouncement

This llamaindex-tools bug hid for three years before anyone reported it

It took me two weeks of on-and-off digging and plenty of wrong turns. Writing the process down as it happened so the next person spends less time.

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

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.

Bblog.vuejs.orgExternal link · opens in a new tab
280 comments

280 comments

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

485
Sswoole_lee·1 hour ago

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

467
Ttang_hao·28 minutes agoedited

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

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

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

315
Wwinter·5 hours ago

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

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

296
Sswoole_lee·2 days ago

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

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

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

230
Kkite·2 days ago

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

254
Llinlin·2 days ago

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

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

246
Bbob_chen·2 days ago

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

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

206
Cchen_dev·just nowedited

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

195
Mmike_xuOP·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.

130
Oops_wang·28 minutes ago

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

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

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

425
Zzhou_yi·2 days agoedited

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

175
Kkite·2 days ago

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

148
Lli_ming·2 days ago

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

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

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

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

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

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

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

7
Sslow_query·2 hours ago

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

61
Zzhou_yi·2 days ago

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

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

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

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

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

47
Llinlin·2 days ago

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

36
Kkite·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
Aalice_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.

97
Nnikic·28 minutes ago

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

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

115
Zzhou_yiOP·28 minutes ago

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

53
Rrase·2 days ago

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

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

110
Rrase·2 days ago

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

22
Kkite·2 days agoedited

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

101
Oops_wang·2 days ago

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

295
Zzhu_zong·2 days ago

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

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

91
Rrase·2 days agoedited

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

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

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

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

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

313
Sswoole_lee·just now

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

80
Kkernel_panic·2 days ago

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

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

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

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

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

158
Llinlin·28 minutes ago

One counter-example: below llamaindex-tools 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
Kkernel_panic·yesterdayedited

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

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

462
Hhuang_ke·2 days agoedited

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

1
Rrase·2 days ago

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

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

70
Ddev_zhou·2 days ago

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

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

59
Aalice_dev·2 days ago

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

56
Rrase·3 minutes ago

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

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

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

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

32
Zzhu_zong·3 minutes ago

One counter-example: below llamaindex-tools 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

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.

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

188
Bbob_chen·28 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.

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

70
Llinlin·2 days ago

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

287
Oops_wang·5 hours agoedited

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

243
Bbob_chen·2 days ago

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

16
Kkernel_panic·28 minutes agoLevel 6

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

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

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

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

4
Wwinter·2 days ago

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

377
Ttang_hao·2 days ago

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

13
Zzhou_yi·12 minutes ago

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

517
Kkernel_panic·3 minutes agoedited

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

110
Kkernel_panicMod·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.

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

28
Aalice_dev·2 days agoedited

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

12
Llinlin·2 days ago

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

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

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

262
Ttang_hao·2 days ago

One counter-example: below llamaindex-tools 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
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.

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

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

17
Wwinter·2 days ago

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

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

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

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

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

31
Oops_wang·2 days ago

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

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

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

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

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

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

28
Mmike_xuOP·2 days ago

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

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

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

61
Hhuang_ke·2 days ago

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

456
Cchen_dev·2 days ago

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

259
Cchen_dev·2 days ago

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

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

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

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

1
Kkernel_panicMod·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

This is the post detail page /en/c/llamaindex-tools/post/p1. 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 →