10 questions about web performance – James Ward at Heroku
James Ward, Principal Developer Evangelist at Heroku, will take us through the current state of web performance, detailing what Heroku is working on, and give some advice, as well.
Pingdom: Why is web performance such a hot topic right now?
Ward: Web performance is a hot topic right now due to five current trends pushing the web in new directions. These trends are:
Web consumption across the globe is exploding. It’s no longer sufficient for a web application to only have low latency in one geographic area. The typical baseline TCP round trip between the east and west coast of the U.S. is around 100 ms. That may not seem like much, but it really adds up as distances and packet sizes increase. Using Content Delivery Networks (CDNs) and doing load testing from many disparate locations is now essential.
The mobile revolution:
The web is the backbone for most mobile apps. But that backbone can be slow, fragile and unpredictable due to inconsistent mobile Internet service. To provide predictable and consistent web performance on this shaky platform, you must optimize service calls for low latency, fast transfer, and reasonable timeouts & retries. Mobile apps that lock up when they are having connectivity issues are frustrating for users. Perhaps your app should cache enough data locally so that it continues to work even when the user can’t connect to your web service.
More web apps are beginning to use real-time push / instant notifications as a core part of the web experience. These connections require more resources on the server than traditional request/response connections. Scaling the server-side of a real-time web application can be a serious challenge. Servers must now utilize techniques like Java NIO to move away from the typical thread-per-connection model which is inherently not able to handle the massive numbers of concurrent connections required by real-time web applications.
The amount of data behind our web applications is expanding exponentially. Processing requests that have to dig through mounds of “big data” can cause serious slowdowns. New data stores like MongoDB, Neo4j, and Cassandra are helping us quickly sift through massive amounts of data but moving to these NoSQL systems is a whole new world for those of us who have primarily dealt with relational data stores. Relational data stores won’t be going away because they are great for “relational” data but now we have new tools in our toolbox, so we can avoid trying to make all data fit into a relational model.
Pingdom: There’s a lot of evidence that web users tend to leave a website if it loads slowly. Are users getting more demanding and impatient, or are there other reasons behind this?
Ward: The bar is being raised for website performance because some are doing it so well. If a user has to choose between a slow site and a fast one they will certainly go with the fast one. So, if you want to stay in the game then performance must be a primary feature not an afterthought. There is a variety of techniques for improving performance, but there isn’t a magic “make it faster” button. It will take a significant amount of time from engineering and ops to locate and fix bottlenecks.
Pingdom: Web performance involves a lot of testing and numbers. But at the end of the day, isn’t a user’s experience a personal and subjective experience? How do you reconcile the two?
Ward: It can be easy to get metrics for web performance. Getting the right metrics is the hard part. The emotional reaction a user has when a web site is “snappy” or “sluggish” is hard to translate into empirical tests. Especially since there are so many variations in network connection paths and client-side capabilities. Constantly verify that what is being tested aligns with actual user feedback. Having dev/prod parity also helps developers to experience something similar to what the actual users will experience. And if it’s slow for a developer then they are more likely to find the cause and fix it.
Pingdom: Could, at least part of, the answer to improved web performance for end users be tighter integration between the components involved, like hardware, software, networking, etc?
Ward: Web performance is only as good as it’s weakest link. Performance optimizations require an end-to-end perspective. It makes no sense spending weeks making a database call 50 milliseconds faster if your users are spending 10 seconds doing DNS resolution for the 15 domains your site uses.
A good test is to go to a friend’s house and have them load your site. That experience is hard to replicate on your own machine. If the experience is poor, identify the weakest link. Was it their browser, ISP, operating system, the path they took, something in your app, or something else? This is why cloud application platforms like Heroku are so important. Heroku provides a platform that has been optimized and services like Memcached that can be used to further optimize each piece of a system.
Pingdom: What’s the relationship between web performance and scalability?
Ward: In the past an easy way to improve web performance was by scaling vertically, meaning faster servers and more RAM. Unfortunately that well ran dry as CPU clock speeds topped out and viable memory limits were reached.
Now scalability happens horizontally by adding more CPUs and more servers. But scaling horizontally isn’t viable with the traditional shared state / session replication architectures. Now most developers are moving to a share-nothing / stateless model where the UI state moves to the client and shared state stays in the back-end data stores. This approach makes horizontal scalability simple and elastic enough to pair demand with resource allocation. At Heroku we make it unbelievably simple to scale apps horizontally.
Pingdom: Best practice in mobile web performance isn’t as well established as in other fields like desktop. Are we getting closer to a sort of universal agreement or understanding of performance in the mobile space as well?
Ward: The tools for simulating and testing what the web experience is like for desktop web users are very mature right now and there is a lot to choose from. But how do you test what a mobile web site will do if a user on their phone steps into an elevator half way through loading? The tools for doing these kinds of tests are immature but quickly evolving.
Pingdom: For someone who is going to start working with their web site and performance, where do you suggest they start? What should they do first?
Ward: They’ve already taken the first step by caring enough to read this! The second step is to make performance a real priority. Look at it as a feature that you have to deliver just like the other features. Then begin to identify the weakest links and the biggest problems.
Once the highest priority items have been identified use tools like Blitz, New Relic, and Pingdom Tools to automate the testing of the problem. After you’ve resolved the issue, keep the tests, so you can guard against regressions.
Pingdom: With everyone talking about cloud, it seems to be everywhere. What’s your view on cloud and web performance?
Ward: The cloud enables true horizontal scalability with usage-based pricing. This is a significant change from how we used to have to wait months to increase capacity. With the cloud, capacity is essentially unlimited and can be put into service within seconds. Heroku provides tools and APIs for scaling up and down instantly. For instance, if you want to go from one process handling requests to fifty. You can simply run:
heroku scale web=50
Pingdom: What are we going to see happen in the next few years in terms of web performance?
Pingdom: Finally, is there something exciting that you or your company is working on in terms of web performance that you can tell us about?
Ward: Heroku has a vibrant ecosystem called Add-ons where innovative service providers are instantly connected with Heroku platform users. Have a look at addons.heroku.com where you will see a giant list of proven and cutting edge service providers that enable you to do everything from performance monitoring to caching to NoSQL data storage. Heroku is constantly evolving, not just through our own work but also through the incredibly innovative work of our Add-on partners.
About James Ward
James Ward is a Principal Developer Evangelist at Heroku.
He focuses on teaching developers how to deploy Java, Play! and Scala apps to the cloud. James frequently presents at conferences around the world such as JavaOne, Devoxx, and many other Java get-togethers. Along with Bruce Eckel, James co-authored First Steps in Flex. He has also published numerous screencasts, blogs, and technical articles. Starting with Pascal and Assembly in the 80′s, James found his passion for writing code. Beginning in the 90′s he began doing web development with HTML, Perl/CGI, then Java. After building a Flex and Java based customer service portal in 2004 for Pillar Data Systems he became a Technical Evangelist for Flex at Adobe.
About the “10 questions about web performance” interview series
We have gathered some of the best and brightest minds in the web and IT industry to a discussion about web performance. Over the next few weeks and months, we’ll be rolling out a series of interviews, bringing together people from web design, mobile and computer hardware, web hosting, software, and other areas. You can find all the interviews in this series on the Royal Pingdom blog.