greenelab / word-lapse

Explore how a word changes over time
https://greenelab.github.io/word-lapse/
Other
6 stars 3 forks source link

Backend Implementation #15

Closed falquaddoomi closed 2 years ago

falquaddoomi commented 2 years ago

This PR includes an implementation of /neighbors that comes in around 25 seconds on an e2-standard-8 (8 vCPU, 32GB RAM) with an SSD.

Configuration Settings

The container uses the following environment variables to tweak how it works:

Profiling

The ./server/profiling folder contains a script run_profiling.sh that can be used to compare different configurations of the above settings. The script runs all the profiles declared at the beginning of the script against the API VM. It does the following:

  1. Polls/ to ensure the site is up (e.g., because WARM_CACHE can delay when the server first becomes available by up to 5 mintues)
  2. Runs three queries in serial for /neighbors?tok=pandemic
  3. Records the profile time, initial warmup time, and the latency and HTTP response codes for each of the profiles to profiling_results__<TIMESTAMP>.csv.

To-Dos, Notes

falquaddoomi commented 2 years ago

FYI, I added the Redis caching to this PR, since it's kind of essential to getting good performance from the server. I'll be adding the cache populating script in a separate PR.

netlify[bot] commented 2 years ago

✔️ Deploy Preview for word-lapse canceled.

🔨 Explore the source changes: e79cf307bf3f6f79d8624de7df5009a4ce2b6260

🔍 Inspect the deploy log: https://app.netlify.com/sites/word-lapse/deploys/6216b76f4b3fbf0007c1756e

falquaddoomi commented 2 years ago

Hey @danich1, I realize this is a huge PR now, my apologies. Feel free to review it now, and let me know if you have any questions.

falquaddoomi commented 2 years ago

FYI, I just ran black on the backend code as suggested. I'm going to merge shortly, then start submitting PRs for the other outstanding issues.