Aerospike for ad-tech

Ad-tech is a complex domain especially when it comes to developing technological solutions. Explaining certain ad-tech aspects where Aerospike can surely help to improve efficiency and performance.

Background

Currently, I am working for a digital advertising firm, where we used to take part in real-time advertising auctions, our system handles around 400k-500k bid-requests per second, our cloud servers (we call them bidder-servers) are constantly bidding & serving a large number of ads globally. We are using Redis as well for realtime data retrieval. It's really important for bidder-servers to read specific campaign data using geospatial query in real-time to identify the correct campaign's ad for the user. The speed and accuracy is also an important aspect.

Geo spatial use-case

In advertising technology, it is usually seen that most of the marketing or advertising campaign target users geographically. This is one of the usual and obvious targeting parameter too. Identifying the correct audience is important. It means, the campaigns are running geographically too; and whenever new request comes, it passes through Geo based funnel to identify the correct matching ads of the particular user.

Thanks to Google's s2 library which helps to identify nearby points. Aerospike uses the same S2 library and supports GeoJson objects to store points. It allows application to track rapidly changing Geospatial objects by querying rapidly.

Possible queries:

Basically it supports three types of queries which can be a need for any organization who works with Geo points.

  • Identify list of points within a Region (Polygon)

  • Identify list of Points within a region (defined by Radius)

  • Identify region(s) where the provided point is in.

Read more about querying Aerospike for Geospatial query here.

Campaign's geo points: It's considered that probably system will store tailing information like Campaign ID, Creative's ID and other tailing information against the prepared GeoJson with its Lat, long.

There are two ways to identify right campaigns:

1.

Identify that upcoming user location falls under which campaign's region, return list of campaigns

2.

Prepare a geo Point with radius from user's location lat, long, and and query the point with radius/polygon to identify how many campaign points are available within it. Return list of campaigns.

Speed?

Aerospike really help here. In this case it has faster reading than any other DB which supports geo spatial queries. For the overall reading benchmark, here is the last post I created which compares the performance of Aerospike with Redis.

Benchmarking query time (GeoSpatial use case)

AQL is the client side tool to execute queries in Aerospike and perform certain light weight administrative tasks.

  • 10K Points stored in DB, takes almost 1ms to fetch the list of records which are available inside the provided region. Same result appears when we store 10 million records too.

Records are indexed on GeoJson field hence takes constant time to fetch.

Following are the asynchronous GeoJson based query execution benchmark from the single AWS EC2 based c5.4xlarge instance using Java based Aerospike client:

Time taken (in total)

Number of queries executed Async

~2500ms

15k Queries

~1800ms

15k Queries

~160ms

1000 Queries

~99ms

500 Queries

Conclusion:

Aerospike did a good job in identifying nearest points/region in real-time and gives a query friendly tools for systems/platforms where the Geo points are rapidly changing and there is a need to identify nearest points/region.