Chart Datapoint creation slows down instance significantly #237
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I noticed that the creation of the datapoints for the charts slows down the instance significantly. It tents to slow down the worker queues to a near halt and posting takes sometimes up to minutes to go through. it was especially noticable during my database maintanace schenanigans the last 2 weeks.
so i think, chart creation may need optimization in some way
ok, i commented a couple of stuff out in https://akkoma.dev/FoundKeyGang/FoundKey/src/branch/main/packages/backend/src/services/chart/index.ts just for testing around a bit.
it indeed has a huge performance difference on my instance it seems
I think there could well be many improvements to be had in the chart engine. But seeing that the core part of it alone (
packages/backend/src/services/chart/core.ts
) stands at 673 lines I'm considering if it would be easier to redo/redesign the whole system.Already discovered that there is a
setInterval
whichsave
s chart data that runs every 20min as well as thetick-charts
background job that runs every hour. Thetick-charts
background job performance hit would be reduced by #252 but that seems to be the smaller part of the problem, if it is a part of the problem at all.This explains so much - namely why the performance hit is so obvious even I noticed it on a testing instance.
That does at least one postgres request for every chart individually.
These should be queued, it should check for changes, and it should batched.
Opened an issue to track (#253).