
Content Delivery Network (CDN) for Mobile Apps Development
You know, mobile users are always impatient that’s why you should deliver your content to their smartphone in a blink of an eye. With 12,000+ mobile screen sizes, different network conditions, mobile delivery is really could seem complex. However, using a CDN you can make it easier to deliver your content and engage your users in a best possible way.
CDN for Mobile Apps
When you’re building an app, which for example uses any kind of live data feed pulling from your websites like JSON or XML. Each time the app loads on someone’s device, that makes a call to your server to grab the data.
Let’s imagine, your app gets popular and one day it gets featured on AppStore. Then, maybe you’ll get 1.5 million downloads within a few hours that day! Which is great, but that’s one heck of a lot of extra requests for your server to deal with and it starts grinding to a halt. As a result, people lose interest in your app or even worse, and start giving it negative reviews? This way, all of your hard work could go to waste as you didn’t think about scaling.
Considering this issue, a Content Delivery Network (CDN) is an EASY way for app developers to build really hugely scalable apps. Your CDN mitigates the load away from your server by mirroring content (such as JSON feeds) to a global network of servers. This not only does it allow you to scale up, but it also speeds up the experience for the end user as the data is pulled from a location close to them.
There are many free CDN providers available that you may try first before spending from your gut.
Case Study: How Does CDN Work with Mobile Apps
Take a look, here’s a little case study about a weather app. The app makes a request to your server to get the weather for NYC, which is updated once every hour. For understanding, we’ll say the data endpoint for your app is ‘api.yourweatherapp.com/usa/newyork.json’. So, JSON returned describes the various data points for your app to display New York’s current weather.
You should’ve known that JSON is dynamically generated by PHP/Ruby/Node based on information in your database and gets 10,000 requests per hour. But when your app is featured in the app store, this increases to 100,000 requests per hour. Which causes slow response times.
For the solution, you can either go out and buy a new server (spending significantly more) or you can implement a CDN. When you do that, you should update your app. So, now let’s call the data endpoint is ‘cdn.yourweatherapp.com/usa/newyork.json’. Now, users never actually hit your server, the requests will go to the CDN’s edge locations, mirroring what’s on your origin server. Then, you can set the cache expiry to 30 minutes, which means the uses will always get the most recent data.
As you can see, all thats happening here is the ‘cdn.yourweatherapp.com‘ is pointed to your CDN, which is just mirroring or ‘pulling’ content from your origin which is ‘api.yourweatherapp.com‘. That’s why the URL structure stays the same.
Wrap Up
So, by implementing a CDN you can immediately make your app future proof. Which can easily cope with any levels of traffic you can throw at it, your users get a lighting fast experience all round!
Leave a Reply