-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add pagination to endpoints that read entire tables (alerts/messages) #1020
Comments
Related to #924 |
Adding more context — when discussing this with @danbarr he mentioned a scenario where he experienced slow responses from the LLM with exceptions related to DB locks being printed into the logs. There is a dump of the related logs attached. My understanding of the issue is that as the LLM was streaming it's response back to the IDE client, alerts were being created — these trigger server-sent-events, which in turn trigger a read from the DB via the API. I think what we have here is negative feedback loop that drags down the user experience as a whole. |
About locking, these lines fire a concurrent db insert task for each new alert. This is not a problem in and of itself, since version 3+ of SQLite implements a multi-read/single-write concurrency model, but there's a catch. The process of writing to the database requires the following logical steps
Here's SQLite docs page. Each of the statements goes through this pipe, which means we have a bunch of (green) threads who likely all acquired a I believe that, specifically for the locking issue, the very first thing we should do is implementing proper batch inserts, which are luckily trivial with sqlalchemy. |
Modify the API to add pagination to those endpoints, to be able to render faster in the browser Closes: #1020
Modify the API to add pagination to those endpoints, to be able to render faster in the browser Closes: #1020
@danbarr has made frequent reports that the dashboard is very slow to load on his machine, including here stacklok/codegate-ui#300
The root cause is that his local DB has been in use since December, and has thousands of records in the alerts & messages table.
The request here is to devise a method of pagination for
/alerts
&/messages
and implement it. I'm not sure that this ranks highly against our other priorities, but recording it for posterity.The text was updated successfully, but these errors were encountered: