Closed xmonader closed 6 months ago
What is the status here? it's linked to a closed PR?
if already addressed in another PR, please make sure to link it here and update the project to 3.12
the pr tried to introduce a way to improve contracts endpoint performance, but it was closed in favor of #356
this is already addressed in some issues:
i did a pr #419 that did a few things:
id
indices (farm_id, node_id, contract_id, ...)WIP: reviewed the mentioned pr and was working on separating the schema change part in another branch cause it may need updates in graphql and data migrationsm or mario was suggesting to create the aggregated tables on setup query.
Status?
there is no progress here yet, there were higher-priority issues I was working on. I started investigating the options we can do to optimize the queries and will keep the issue updated
update (wip):
Count
and Scan
queries
it seems that each request happens twice one time to get the count and the other to get the rows itself. tried to minimize this by combining the two calls in one but there were some issues:
page
and size
since the limit
/offset
will conflict with the count
clause.gorm
will handle this q.Count(&count).Limit(size).Offset((page - 1) * size).Find(&nodes).Error
as two calls and will not introduce any enhancements so things are as is.
materialized views
which will precompute and store the results of some of the complex queries like farmTableQuery
/nodeTableQuery
and then it will be faster to filter, this will require a refresher every now and then so we may add
update (wip):
notes:
uptime
and updatedAt
on node
tableplease make sure the queries that affect the clients and the dashboard get more priority
i got up to speed with @Omarabdul3ziz , tried to fix the farms query, but for some reason some queries with specific filters tend to take too much time, still investigating why...
dividing this into smaller issues:
worked with @Omarabdul3ziz on creating a small cache table to prevent repeated calculations. the results are promising without adding any additional indices. todo:
update (wip) continued working with mario today on:
update:
we still need to improve tests quality, and add benchmarks
update:
generate
script which needed some modifications to be customizable and work on both generate
script and modifiers
running with testshttps://github.com/threefoldtech/tfgrid-sdk-go/pull/533 is now merged and released with v0.13.0
and deployed on dev
proper indices and queries, make sure to include performance changes