Open Flarp opened 2 months ago
With the inclusion of a Redis cache, it makes little sense to use a Varnish cache as this information will already be available in memory. The Redis cache will be used instead for both registered and unregistered users, to avoid needing to maintain multiple infrastructures with the same purpose.
Moreover, the Redis cache should also cache the current trending graphs of the day, week, month, and all time, as these computations are expensive (requires querying the entire likes database for day-week-month, but the like_count
column in the knowledge graph table can be used for all time, which can save some computation time). It should be cleared about every 15 minutes (using some kind of Redis TTL) in order to be relatively up to date.
As of right now, all requests go directly from an NGINX reverse proxy to the main Rocket application, which then interfaces with a Postgres backend. This service is likely to be read-heavy rather than write-heavy, so some additional infrastructure could possibly greatly decrease response time.
PURGE
requests to the cache when a graph is edited, to ensure up to date information.FromRequest
in Rocket) that attempts to secure connections to both the Postgres and Redis databases (optionally, allowing for non-functional caches), and abstracting over operations on these two databases to encapsulate functionality. This managed cache will be passed to routes, rather thanConnection<Db>
as it currently is.PURGE
requests to the Varnish server when an update operation is performed.