Llamaindex · Toolchain · llamaindex-tools logging: what separates "readable" from "usable"

950
LLr/llamaindex-tools·posted by nikic·yesterdayExperience

llamaindex-tools logging: what separates "readable" from "usable"

Short version: llamaindex-tools 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.

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.

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

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.

Worth noting: the official docs do cover this, just in a very inconspicuous spot. I only found it reading the source comments, where the author explains the reasoning — roughly "so that it degrades into predictable behaviour in extreme cases".

407 comments

407 comments

· first 120 loaded
M
Ddev_zhou·2 days ago

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

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

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

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

479
Aalice_dev·yesterday

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

459
Wwinter·12 minutes ago

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

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

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

274
Sswoole_lee·3 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.

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

133
Zzhou_yi·just now

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

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

1
Ddev_zhou·just now

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

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

191
Hhuang_ke·yesterday

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

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

11
Zzhou_yi·2 days agoedited

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

246
Sswoole_lee·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".

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

7
Kkernel_panic·2 days ago

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

454
Ttang_haoMod·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.

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

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

93
Cchen_dev·yesterday

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

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

443
Oops_wang·2 days agoLevel 6

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.

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

37
Kkernel_panic·2 days agoLevel 6

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

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

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

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

175
Ttang_haoOP·2 days ago

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

37
Cchen_dev·just nowedited

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

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

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

138
Mmike_xu·2 days agoLevel 6

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.

76
Ddev_zhou·2 days agoLevel 6

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.

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

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

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

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

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

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

4
Sswoole_lee·just now

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.

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

1
Kkite·2 days ago

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

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

410
Zzhou_yi·yesterday

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

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

148
Rran_bo·2 days agoLevel 6

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

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

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

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

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

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

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

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

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

22
Mmike_xu·2 days agoedited

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

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

62
Rrase·2 days ago

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

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

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

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

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

249
Ddev_zhou·12 minutes 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.

166
Lli_ming·12 minutes ago

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

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

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

270
Mmike_xu·2 days ago

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

189
Kkite·yesterday

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

188
Zzhu_zong·2 days agoedited

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.

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

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

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

188
Oops_wang·5 hours ago

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

182
Rran_bo·2 days ago

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

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

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

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

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

143
Aalice_dev·2 days ago

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

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

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

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

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

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.

60
Rran_bo·1 hour ago

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

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

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

243
Wwinter·2 days ago

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

87
Rrase·yesterday

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

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

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

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

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

66
Kkernel_panic·2 days ago

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

58
Kkite·2 days ago

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

170
Oops_wang·2 days ago

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

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

57
Rrase·12 minutes 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".

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

164
Oops_wang·2 days ago

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

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

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

34
Zzhu_zong·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".

1
Hhuang_ke·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".

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

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

21
Aalice_dev·2 days agoedited

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

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

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

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

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

4
Ddev_zhou·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
Hhuang_ke·yesterday

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

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

3
Rran_bo·2 days ago

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

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

1

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