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

⚡ limit the cache queries to some optimal numbers #99

Merged
merged 2 commits into from
Jun 21, 2022
Merged

Conversation

vikiival
Copy link
Member

@vikiival vikiival commented Jun 13, 2022

Setting limits to the cache queries:
Spotlight 400
Series 900

How did I get those numbers?

  1. let's make some base counts
select count(*) from series; // 1572
select count(*) from spotlight; // 720
  1. let's set some base metrics?

for series I care about collection who has at least 1 KSM in the volume

select count(*) from series where volume <= 1000000000000; // 794

for spotlight want to see artists that have sell something

select count(*) from spotlight group by sold > 1 // 180, 540 // 180 sold 0 or 1 item

to be safe with the numbers:
794 -> moved to 900 - in case we have more collections
540 -> if user is not in the first half than ngmi

@vikiival vikiival linked an issue Jun 13, 2022 that may be closed by this pull request
@vikiival vikiival requested a review from roiLeo June 13, 2022 11:10
Copy link
Contributor

@roiLeo roiLeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know where this cache is used but I would prefer, if possible, to add a maximum number per page

src/mappings/utils/cache.ts Outdated Show resolved Hide resolved
Comment on lines +36 to +37
ORDER BY volume DESC
LIMIT 900`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • default ORDER BY volume DESC?
  • hardcoded 900?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikiival
Copy link
Member Author

vikiival commented Jun 13, 2022

@roiLeo description

@vikiival
Copy link
Member Author

cc @ma-shulgin 👀

@vikiival
Copy link
Member Author

I don't really know where this cache

should be used for all KodaDot stats - spotlight - series - whales

@roiLeo
Copy link
Contributor

roiLeo commented Jun 13, 2022

should be used for all KodaDot stats - spotlight - series - whales

Can you explain it to me with a simple use case?

@vikiival
Copy link
Member Author

This queries are already in use for routes /spotlight
/series

@roiLeo
Copy link
Contributor

roiLeo commented Jun 21, 2022

I still don't understand why you need to put a limit on cached query

@vikiival vikiival deleted the optimizoor branch June 21, 2022 12:13
@vikiival
Copy link
Member Author

I still don't understand why you need to put a limit on cached query

Because cache query on full data took about 30 sec to calculate and server ran out of the memory check #97

@roiLeo
Copy link
Contributor

roiLeo commented Jun 21, 2022

When is the cache updated?
Why do we need full data?
If we send all this data to the client side there is a great risk of slowing down user experience

@vikiival
Copy link
Member Author

Why do we need full data?

We dont need that :) that's why we implemented limit

@yangwao yangwao changed the title ⚡ limit the chache queries to some optimal numbers ⚡ limit the cache queries to some optimal numbers Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rubick goes Out of the memory
2 participants