In our design we go for budget authorization for every matched ad ( cache lookup) , perhaps as I suggested the best way is to include CampaignBudget * in the Ad.hpp
struct Ad {
uint64_t ad_id;
uint32_t campaign_id;
CampaignBudget *budget; //this one is maintained by insert/remove from campaign_budget cache
uint16_t width;
uint16_t height;
uint16_t position;
uint64_t max_bid_micros;
boost::optional<uint64_t> auth_bid_micros;
std::string code;
This way the look up will be near constant and we should see no difference between selecting 2 ads or 8.
FYI this one produces a lot more matching ads now
before \:
In our design we go for budget authorization for every matched ad ( cache lookup) , perhaps as I suggested the best way is to include CampaignBudget * in the Ad.hpp
This way the look up will be near constant and we should see no difference between selecting 2 ads or 8.