We use much smaller Amazon EC2 instances but handle more traffic and have reduced our EC2 costs by more than 70 percent.
Amir Friedman Director of Engineering

Founded in 2014, PubNative enables mobile publishers to easily add native advertising to their apps and websites. Native advertising is promotional content designed to match a given website’s display environment, so it appears the advertisement came from the website or app publisher rather than an external advertiser. PubNative was founded to provide a better experience to users by offering an alternative to banner ads, which tend not to work well on mobile devices.

PubNative is a supply-side platform, meaning its clients are publishers that supply advertising space. Once a user loads a page or app with an advertising space on it, PubNative’s platform connects to demand-side platforms to find the best prices advertisers are willing to pay to place an advertisement in that space. This is known as real-time bidding, and because bids are happening as pages load, response times have to be as fast as possible in order to provide the best user experience.

Another challenge for PubNative is its rapid growth, with its revenue increasing by more than 10 times year-over-year, and monthly account growth at nearly 10 percent.

“We have to be able to ship fast,” explains Amir Friedman, director of engineering at PubNative. “If we take on a new client—which will generate huge amounts of traffic—we want to on board them quickly. They expect systems to be working, so we can’t afford the delay of ordering and setting up hardware.” 

For scalability and speed of response and deployment, PubNative chose to base its platform on Amazon Web Services (AWS) from the beginning. “Buying our own servers just doesn’t work for our business model,” says Friedman. “By using AWS, we can automatically scale based on usage metrics.”

A previous version of the company’s architecture used Ruby on Rails, deployed with AWS OpsWorks to large Amazon Elastic Compute Cloud (Amazon EC2) instances. “But we wanted to improve performance and decrease the size of instances we were using,” explains Friedman. So he and his team started rewriting their platform using Google’s Go programing language, deployed with Docker and AWS Elastic Beanstalk. The company also uses Amazon DynamoDB to store click logs, as well as Amazon Simple Storage Service (Amazon S3) for data warehousing and Amazon Simple Queue Service (Amazon SQS) as a method of storing data temporarily in the event of a cluster not being available. The company uses Amazon Relational Database Service (Amazon RDS) for MySQL with Amazon ElastiCache

PubNative has cut costs, reduced response times, and made its services more scalable by redesigning its AWS environment. “Using AWS Elastic Beanstalk was a natural choice for us,” says Friedman. “We use much smaller Amazon EC2 instances but handle more traffic and have reduced our EC2 costs by more than 70 percent.”

Latency—which is crucial in real-time bidding platforms—has decreased to five milliseconds compared to 60 milliseconds. “Performance and fast response times are central to what we do,” says Friedman. “We have to be able to complete a transaction in less than 100 milliseconds—and that includes us communicating with the demand-side platforms. App owners don’t want ads to affect their user experience. And users don’t want to wait for an ad to appear. In addition to running the ad server in a Docker container, we also deploy a cache layer on the instance itself. This way if the server isn’t working for any reason, the ad space is never blank.”

Using AWS gives PubNative the confidence that its platform can be deployed to serve an increasingly global customer base as the company expands. It currently runs its AWS infrastructure in the US East (N. Virginia) and Asia Pacific (Singapore) regions, “but we can spin up our infrastructure in a new zone in less than a day,” says Friedman, “which we might need to do if we had a new client in Brazil or Australia, for example.”

Friedman is confident his team can continue to handle growth and improve the service of the PubNative platform in the cloud. “AWS has a vast ecosystem of services that not a lot of other cloud providers have,” says Friedman. “We know we’ve made the right choice.”

Learn more about how AWS can help run your website.