waldronlab / BugSigDB

A microbial signatures database
https://bugsigdb.org
7 stars 6 forks source link

Improve Performance #99

Closed tosfos closed 2 years ago

tosfos commented 3 years ago

We added Varnish for anonymous (not logged in) users. Even for complex study pages, they will now load near-instantly if that page is in cache (meaning that it was visited recently by an anonymous user). This will need adjustment over time, since it means that there may be some lag after a wiki page is changed before an anonymous user sees that change. Feel free to try this out! Log out of the wiki and visit a long study page. It may take a while to load. Then visit it again (even in a different browser) and it should load really fast.

lwaldron commented 3 years ago

Wow, it is FAST! Also the dynamic main page. That's fantastic. I don't see a problem with some lag after a wiki page is changed.

lwaldron commented 3 years ago

Just wondering if something is wrong with Varnish? It's taking me 6-8 seconds to load the dynamic main page in an Chrome desktop incognito browser, and this seems to be confirmed by Google Pagespeed analysis: https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fbugsigdb.org%2FProject%3ADynamic_Main_Page&tab=desktop

tosfos commented 3 years ago

We're working on the dynamic Main Page page now and running into some trouble. The other pages should be quick.

There is some difficulty with caching that page, since it includes a Random Taxon and Random Studies. If we cache the page, then those features will stop being "Random". We could invalidate the cache every so often in order to retrieve a new Random item periodically, but users might be confused. We can try to cache everything on the page except the random blocks, but that won't be so simple. Alternatively, we can rename from "Random" to something that sounds more permanent like "Featured Taxon".

lwaldron commented 3 years ago

"featured taxon" sounds fine to me. How about just changing those daily or something?

tosfos commented 2 years ago

This is all done. We changed both Random section to say Featured. The page itself is being cached for anonymous users and the queries are being cached for logged in users, so the page should load pretty quickly for each.

And we added a script that purges the Main Page's cache once every hour.

lgeistlinger commented 2 years ago

This looks like it can be closed. Feel free to reopen.