Plan caching to minimize server load (SSR, etc.)
Currently spee.ch is not doing any caching (other than what express.js does natively out of the box. Spee.ch should cach rendered versions of pages so it doesn't have to do SSR tasks, MYSQL lookups, etc. repeatedly.
One option for caching, using redis: https://www.npmjs.com/package/express-redis-cache
@lyoshenka also mentioned https://varnish-cache.org/ which sits in front of the web server
one issue for caching, raised by @skhameneh, is that SSR of page may need user session data. This is currently solved by serving the site without a logged in guest, and having the client make an api call to update the redux state with any logged in user data.
another issue with caching is that the same url (e.g. https://spee.ch/xyx/doitlive.jpg) could be one of two types of request: (a) a request from a user that wants to view the asset in a web browser, or (b) a direct request for the asset from a page in which the asset is embeded.
@lyoshenka suggested redirecting embed requests to a slightly different url (e.g. `https://spee.ch/embed/xyz/doitlive.jpg')
@billbitt cached responses should honor limited header data. Ideally the cache, by default, should only store calls that don't contain session information.
Caches can exist at (some examples):
- Thread level
- Machine-level (VM/server, separate thread or same-machine redis/memcache)
- Cluster level (external Redis, Memcache, etc)
- Client-side