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

Use a database for statistics #570

Open
ewels opened this issue Nov 25, 2020 · 1 comment · May be fixed by #2695
Open

Use a database for statistics #570

ewels opened this issue Nov 25, 2020 · 1 comment · May be fixed by #2695
Assignees
Labels
back-end Website back-end enhancement New feature or request

Comments

@ewels
Copy link
Member

ewels commented Nov 25, 2020

In order to keep the website backend lightweight and simple, I made the dubious decision to store the data for statistics as flat JSON files on the back end. Now that nf-core is getting big, that decision is coming back to bite us. The most obvious example is the Statistics page, which is now super slow to load and starting to break (eg. total Slack users).

Instead of using JSON files, I suggest that we switch to a SQL database like a sane person. We have MySQL available on the server, or if we want to stay simple even a flat file SQLite db would be a big improvement I think. Anything to avoid having to parse huge JSON documents on every page load.

@ewels ewels added the enhancement New feature or request label Nov 25, 2020
@ewels
Copy link
Member Author

ewels commented Dec 2, 2020

These files are being loaded, parsed and even looped over on every load for the stats page 😱

24M  2 Dec 03:02 nfcore_issue_stats.json
20M  2 Dec 01:01 nfcore_stats.json

It's really amazing that this page loads at all 😅 I added a timer to the code because I knew that it wouldn't scale well, you can see the results in the page footer:

Page generated in 5.21087 seconds.

Code has some nice comments like this one: https://github.com/nf-core/nf-co.re/blob/48e4f5595bf3a4e07f5492080a458d7b68b77a81/public_html/stats.php#L49

@mashehu mashehu mentioned this issue Mar 22, 2021
5 tasks
@mashehu mashehu self-assigned this Mar 22, 2021
@ewels ewels added the back-end Website back-end label Sep 12, 2022
@edmundmiller edmundmiller linked a pull request Aug 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end Website back-end enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants