4 ms·
Highly cache-friendly data that can tolerate being slightly stale should be cached or kept in application memory, where the most recent version is returned. In
by tracker1 11y ago
Highly cache-friendly data that can tolerate being slightly stale should be cached or kept in application memory, where the most recent version is returned. In this case, if the data is being used from a foreign source, then a separate thread processing a stream of incoming data that updates a shared/static state may be best.
Requests as part of a Service pipeline are best served as async. User -> http -> service endpoint <(requests to db's, and another service as async)> -> async response
In general, if you are IO bound (waiting on IO/service responses), then you will be well served with async. As part of a service pipeline that will access multiple backend resources it makes a lot of sense. If you can share/cache foreign data sources, it makes less sense. Cache first, other optimization strategies second and as needed. Unless it's a green project, then try to be async from the start.