Sure, I don't know your exact business, those numbers were just guesses. Still, if you are doing half of your stated capacity (50 requests per second), then a single database write every 5 seconds reduces that traffic 249/250. Much of it depends how often the data needs to be read.
This is a common pattern, however. The easiest thing to set up is to do a customer database query for every request, while the far more efficient option, in many, many cases, is to cache the 1000 most-likely queries and serve up static or pre-rendered data. Not cache like one update per day, but perhaps one update per minute. Only you and your team can decide whether it would cost more to serve up a few free ads (over a customer's budget) because the cache was a minute or two old, vs doubling/tripling your infrastructure costs in order to make the system more precise. Sounds like you've got a good roadmap for making that decision.
Comments
Sure, I don't know your exact business, those numbers were just guesses. Still, if you are doing half of your stated capacity (50 requests per second), then a single database write every 5 seconds reduces that traffic 249/250. Much of it depends how often the data needs to be read.
This is a common pattern, however. The easiest thing to set up is to do a customer database query for every request, while the far more efficient option, in many, many cases, is to cache the 1000 most-likely queries and serve up static or pre-rendered data. Not cache like one update per day, but perhaps one update per minute. Only you and your team can decide whether it would cost more to serve up a few free ads (over a customer's budget) because the cache was a minute or two old, vs doubling/tripling your infrastructure costs in order to make the system more precise. Sounds like you've got a good roadmap for making that decision.