Over a million developers have joined DZone.

Troubleshooting Performance Problems [Video]

· Java Zone

Navigate the Maze of the End-User Experience and pick up this APM Essential guide, brought to you in partnership with CA Technologies

[This article was written by Erica Lauer Vose]
Want to learn how to improve your application’s performance? Practicing by troubleshooting a common performance problem is a great way to start.

The New Relic Ruby Kata on Heroku

Siege Test ResultsFor example, I used this performance problem from the New Relic Ruby Kata to make a video tutorial for New Relic University. (The New Relic Ruby Kata is a publicly available practice app with seven intentional performance problems with which to test your APM troubleshooting skills.) You can try this out by deploying your own Ruby Kata app and follow the instructions on the site:

Once I deployed the Ruby Kata app to Heroku and connected to New Relic, I usedSiege to run a load test against my app and generate some data for my app overview dashboard. Siege is an http regression testing and benchmarking utility I downloaded using Homebrew. You can find more info about Siege here.

The Siege test showed my response time was about 4 seconds, which indicated that my application was running slowly and needed some tuning.

The video tutorial below shows how I used New Relic’s application overview dashboard to investigate the performance problem and isolate the trouble-makers.

My investigation revealed that the database call was the biggest problem, taking about 4 seconds.

application-overview-dashboard-performance-results

From there, I used the transactions option under the monitoring tab to dig deeper into the performance problem and see more details about what was happening in my app.  Because I only tested one page of my app, I had one transaction in the list — the loop controller. Clicking on that opened a window with more details about the transaction.

transaction-trace-summary-view

This view revealed that there were two database calls causing me the most problems. The Icon#find call represented in red and the loop/index in purple. In this Transaction summary view, it’s pretty obvious that the Icon#find call was a problem–consuming almost 70% of the time.

Clicking on Trace details allowed me to dig even deeper into this problem area. Right away, you’ll notice a red bar showing that almost all of the app’s time was spent making 1,000 database calls.

transaction-trace-details

Once I figured out that the problem was in the LoopController#index, and that there was a template I needed to look at as well, I was able to tweak the code and speed up performance using a Rails includes method. That effectively cut my database calls from 1,001 to just 2.

loop-controller-and-template

Finally, I deployed my fix and ran the same test with Siege to see how the app performed.

The app Overview dashboard show that the changes cut my application response time down to less than half a second, making my app almost eight times faster.

improved-performance

Investigating performance problems is not only easy with New Relic APM, it’s really fun too! Try it yourself with the New Relic Ruby Kata and have some fun improving your application’s performance.

Thrive in the application economy with an APM model that is strategic. Be E.P.I.C. with CA APM.  Brought to you in partnership with CA Technologies.

Topics:

Published at DZone with permission of Fredric Paul, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}