BT

Scaling the ipify Service on Heroku

| by Hrishikesh Barua Follow 8 Followers on Feb 10, 2018. Estimated reading time: 2 minutes |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

The developer behind the ipify service shared his experiences in scaling the service to 30+ billion requests on Heroku. ipify is an online service which exposes an API that applications can invoke to fetch their external IP address. The service, initially written in node.js, was rewritten in Go to obtain better scalability.

ipify was started by Randall Degges to solve a need in one of his projects. The first version was written in node.js and deployed on Heroku. The service was accessible via tools like curl so that it could be used programmatically. The website was a simple front end deployed on CloudFront backed by an S3 bucket. Heroku has server units called dynos, the smallest of which offers 512 MB RAM and 1x the underlying CPU share. Heroku was the service of choice here as it was low-maintenance - it could auto restart on failure of the process and had a load balancer in front. This initial setup cost around $7/month. Heroku being hosted on AWS, could also leverage AWS's underlying reliability.

The service’s popularity revealed some scaling issues, which could not be solved by adding more hardware. Some investigation revealed that the throughput was just around 10 requests/second. Some improvement was achieved by using the node cluster module, which launches multiple processes to take advantage of multi-core systems. When this was found insufficient to handle the increasing traffic, the service was rewritten in Go.

Go's httprouter package was chosen for its performance over other options. The rewritten service performed significantly better, taking lesser memory (around 5 MB) and handling 2000+ requests/second from a single dyno deployment. Some further improvements in string handling led to a performance gain of an additional 1000 requests/second. This brought down the cost as well, running on the single dyno. Similar services like ipinfo.io hosted on AWS also faced scaling issues which translated into higher costs, with monetization of the service being one solution.

ipify was being used not just by regular developers but also by malware writers, which led to a large amount of spiky traffic. This led to it being blocked by antivirus vendors based on public blocklists. The current usage of the service peaks at around 30 billion requests per month, with an average response time of between 1 to 20 milliseconds. Other services -- some of which provide geolocation also -- have rate limits unlike ipify.

ipify's client libraries are available in several languages.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT