haystack-core-integrations icon indicating copy to clipboard operation
haystack-core-integrations copied to clipboard

Langfuse makes haystack slow

Open mydsoElliott opened this issue 11 months ago • 3 comments

Describe the bug Langfuse make haystack slow : for a 13 second pipeline, it takes extra 6 seconds when running with langfuse tracer for a total of 19s. After profiling my pipeline, it looks like uploading to langfuse take time, as if it was waiting for it to be uploaded to run the next component.

I'm using langfuse self hosted

Describe your environment (please complete the following information):

  • OS: ubuntu (docker)
  • Haystack version: 2.9
  • Integration version: 0.7

mydsoElliott avatar Jan 22 '25 15:01 mydsoElliott

After more research, I found that setting HAYSTACK_LANGFUSE_ENFORCE_FLUSH to false solve the problem. It would be nice to either have a parameter to change it, or even documentations for it.

mydsoElliott avatar Jan 23 '25 09:01 mydsoElliott

Hello @mydsoElliott thanks for reaching out. Just to better understand how we could improve documentation: Have you found the documentation page about Haystack's langfuse integration? https://docs.haystack.deepset.ai/reference/integrations-langfuse We describe the HAYSTACK_LANGFUSE_ENFORCE_FLUSH there and in the component docstring here including the motivation for the default setting true. So this issue is mainly about making this setting more visible to users and explicitly mentioning the effect on speed?

julian-risch avatar Jan 23 '25 11:01 julian-risch

Hello, indeed I never found this by myself, so It's a bit my bad. But even if I did, I don't think I would have known that it was making the pipeline that much slower.

May be a better way would be to mention it in the langfuse connector. https://docs.haystack.deepset.ai/docs/langfuseconnector

as I feel like it's something you're more likely to see.

Mentionning speed could also be nice.

Also having it on by default without a warning nor being in debug mode can make it hard to realize it if you don't specifically look for it.

mydsoElliott avatar Jan 23 '25 12:01 mydsoElliott