At Salesforce we live and breathe mobile performance. We talk to mobile developers who are passionate it about it, we measure it diligently and (of course) we cut our customer apps’ latencies. Given our experience in mobile performance, we wanted to share with you some tips to delight your users with a high performing mobile app.
Chances are that your audience is distributed in multiple locations and your app loads static assets, like images. Using a CDN in this case is a no-brainer for getting a significant boost to your app’s performance. A CDN will distribute your content geographically bringing it close to your end user. A CDN will not address latency in the last mile (which is why our customers talk to us) but it is a lot better than not using one at all.
Let’s say your app loads a newsfeed, a product or an offers list. There is no need for you to pull all the news items or products at once. You can just pull the first 5-10 results and show them instantly to the user. While the user is engaged with them, you can prefetch the rest in the background. This is an effective technique that reduce app launch and user waiting times.
Always compress your API responses. The benefit you will get by having smaller payloads travel over the network far outweighs the penalty of having to decompress the response on the client.
If you are using CDNs, aim for a cache hit ratio of 80% or higher. A cache miss is very expensive and we have often seen it increases end-to-end latencies by more than 30%. Measure your caching rigorously – the best way to optimize network performance on mobile is not to make a request.
Most apps today have a high level of personalized content. If you have one of these apps, a good tip to cut response times is to pre-warm your API servers. There are a variety of techniques (see this post from Facebook’s blog) used to hint the server ahead of time so it can be warmed just in time.
and one last tip…
Whatever you do, always measure your app’s performance. Use any of the off-the-shelf tools or build your own Application Performance Monitoring tool. Begin by listing the key functions of your app (e.g. login, search, add to cart etc) and defining a performance budget for each. The budget should list the amount of time it should take for a resource, e.g. an image or an API response, to show up on your app’s screen. You could even set budgets for latency on the server side.
Test your app in real world conditions. This is when you truly understand what your users experience. No lab test can give you that accuracy. Once you obtain your real world measurements, use percentiles instead of averages to check if you are meeting your performance budgets. Why?
The reason is that Download or Response Times follow a long tail distribution. An average calculation is skewed towards the outliers ignoring the bulk of the measurements. Percentiles instead will provide you with a better view of performance.