Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A prototype of much faster langfuse ingestion #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vaibhavbetteromics
Copy link
Owner

What does this PR do?

Langfuse ingestion is quite slow, because the ingestion code path makes read/write SQL queries for each observation that's received.

This PR attempts a different version of the ingestion code path that reads and writes to the DB in batches.

The performance improvement is significant.

Before:
POST request with 260 events completes in 5s

Running on 100 gleason docs:

Processed 100 documents in 0m4s
POST http://localhost:6007/api/public/ingestion took 3.7955631249933504s with 1007.714KB 307 events
POST http://localhost:6007/api/public/ingestion took 8.681478124985006s with 1446.973KB 314 events
POST http://localhost:6007/api/public/ingestion took 9.812697500048671s with 825.628KB 335 events
Langfuse flush took 0m19s

After:

POST request with 260 events completes in 873ms

Running on 100 gleason docs:

POST http://localhost:6007/api/public/ingestion took 1.0489602909656242s with 920.933KB 264 events
POST http://localhost:6007/api/public/ingestion took 0.7444410839816555s with 1653.679KB 400 events
POST http://localhost:6007/api/public/ingestion took 0.5013136669876985s with 705.703KB 292 events
Processed 100 documents in 0m4s
Langfuse flush took 0m0s

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • This change requires a documentation update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant