venediktov / vanilla-rtb

Real Time Bidding (RTB) - Demand Side Platform framework
http://forkbid.com
GNU General Public License v3.0
318 stars 85 forks source link

Required data generation, fixes #62 #63

Closed abushev closed 7 years ago

venediktov commented 7 years ago

FYI this one produces a lot more matching ads now

22:17:08.968222: <debug> Selected campaigns 7
22:17:08.968535: <debug> selected ads 8

before \:

22:20:19.449704: <debug> Selected campaigns 7
22:20:19.450059: <debug> selected ads 2

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.