Four Priorities for Optimizing App Performance on Heroku

As one of our earliest and closest partners, Heroku and New Relic have had a long-standing working relationship. Over the past couple of years, we’ve both gotten rather busy as our companies have scaled and adapted to meet the needs of an increasingly cloud-savvy and polyglot user base. I was pleased then, to have recently had the opportunity to chat with Heroku co-founder and CTO Adam Wiggins about optimizing the performance of web apps deployed on the Heroku platform. We both agreed that there are a few best practices to keep in mind to ensure your apps are running at peak performance.

When the launch party is over, the dust has settled, and your app has finally been brought to life on Heroku’s simple, scalable cloud platform, it’s finally time to kick back and watch the magic happen, right? Not quite. Because deploying your app, easy as it is, is only step one. Now the focus shifts to managing and optimizing it so it can continue to thrive.

There are a lot of ways developers can attempt to improve performance after their apps go live, but a few steps deserve especially high priority if you want to deliver a flawless experience while also getting the most out of Heroku’s Platform as a Service (PaaS).

Plan for Scalability

Developers should start thinking about production performance at the design stage, long before an app goes into production. This is not about premature optimization, but rather it’s about having a plan that leaves the door open for scaling as production load increases. Plan for success by preparing to scale up quickly. Effectively managing application performance requires the flexibility to add resources any time you need them; you can only do that if your app is built on an infrastructure that’s easily scalable. Fortunately, this is one of Heroku’s greatest strengths. Adam told me that, “We’re very interested in making it easier and easier to scale up, so developers have all the juice they need to improve app performance A prime example of this is how we’ve made the platform emphasize truly stateless runtime processes.”

Seek Out Bottlenecks
“The key to performance optimization is always visibility,” Adam said. “That’s where it all begins.” Through its add-on catalog, Heroku provides several tools that help developers see where bottlenecks are slowing things down. Logging provides the most basic functionality, with a Logplex layer that aggregates logs from all web processes running across the dyno manifold. Wiggins recommends complementing Heroku’s logging with application performance management services from the extensive add-on system. “New Relic is the go-to choice there.”

Monitor Real Users
Get a better understanding of your application’s front-end performance by finding out what’s happening from the perspective of real users. You’ll gain some of the best insights about where to focus optimization efforts by seeing what they see and experiencing app performance the way they do, in real time. You’ll also learn how users are actually accessing data and find out how your app is performing across different geographical regions, based on their distance from your CDNs and servers. That will help you target your enhancements where they’re needed most.

Clean Up Code
Once you know where your bottlenecks are, you’ve got a few options for addressing them. Scaling up is often the best solution, but those additional resources aren’t free. For some developers, a more attractive route is to get in and optimize the code within web templates and database queries. Of course, this approach requires extra time and manpower — which may be more precious than capital. It can, however, make significant improvements to load times, especially at the browser level.

The architectural advantages of Heroku’s polyglot platform make it a lot easier to implement these techniques. The principles of performance optimization are generally the same across all enterprise platforms, so it’s a good idea for every application developer to stay mindful of these practices and make them a priority when looking for ways to improve performance.