One good solution might be something like Datomic (the classic version, now called Datomic On-Prem), where each application process has the query engine embedded in it, and it pulls data from a relatively dumb storage service such as DynamoDB as needed, then aggressively caches it.