What Tools Would You Use to Find a Performance Bug in Your Code?

Developers love tools, and they tend to use a lot of them. Many of them are such a normal office of our daily lives and toolchain that we don't fifty-fifty retrieve of them every bit tools anymore.

Your computer, the Internet, a unproblematic text editor, and source lawmaking repositories are a expert example of this. They are just primal things we use every day.

Developers now have access to free and inexpensive developer tools that can aid find and ready many common application issues. These new tools are now an essential part of every developer's tool set.

Notice Bugs With Free Programmer Tools While Writing Lawmaking

None of us savour firefighting production application problems. We would much rather exist working on some awesome new feature for our app. So, let'due south learn how to preclude production fires!

Permit's start out by saying nobody writes perfect lawmaking, and yous can never foreclose every unforeseen scenario. However, with a footling more visibility into what your code is doing, you can find a lot of mutual problems early.

Fact: The best time to find bugs is when you are creating them.

Finding, reproducing, and fixing bugs in product is hard, slow, and expensive. The earlier we can notice them in the development bike the better, of course.

You just joined a new team and y'all are trying to assistance gear up some bugs and add some new features to an existing project. Y'all have no idea what any of the code does. Sounds like fun, right?

Many apps accept complicated layers of authentication, information access, integrations, etc. Not to mention the dozens of AJAX calls that tin can occur in modern spider web apps. It can be very difficult to understand what your code is doing under the hood.

What Is Your Code Doing, Anyway?

How do you know what database queries, web service calls, cache hits, exceptions, and more are happening?

Thanks to detailed transaction tracing, which is powered by lightweight lawmaking profilers or other technology, you tin can easily see these types of details — and more.

Screenshot from Prefix (complimentary for ASP.NET and Java developers).

Depending on which programming language you are using, at that place are several unlike developer tools you could use for this. The features and functionality of these tools vary wildly. Some require a lot of lawmaking changes or configuration, while some don't require any.

These programmer tools are primarily designed to run on your workstation, although some may too work on a server.

  • Glimpse (.Cyberspace).
  • Miniprofiler (.NET, Ruby, Become, Node.JS).
  • XRebel (Java — paid).
  • Stackify Prefix (.Net, Coffee).
  • Scout Devtrace (Crimson).
  • Rack trace (Red).
  • Zend Z-Ray (PHP — paid).
  • New Relic programmer fashion (Scarlet).

All of these are free except for the ones denoted paid. If I missed a tool, please let us know in the comments below and nosotros will add it!

These types of tools are a lifesaver. Once you showtime using them, they will become part of your standard tool-chain. They are really skilful at answering that question of "What did my code merely do?"

Using Transaction Traces to Find Bugs

Using Prefix as an example, it can collect a ton of awesome details near what a single web request is doing. It is pretty amazing to run across all of your logging statements along with all of the other details it collects like SQL queries, etc.

Prefix can practice all of this without changing your lawmaking.

This type of view makes it very like shooting fish in a barrel to run across what SQL queries are being executed and how long they take. You can quickly copy a query and rerun it in your SQL management tool.

You can even employ it to help find common Northward+i blazon problems that come up from running SQL queries inside a loop.

How to Catch Bugs in QA Before They Get to Prod

So far, we have talked a lot about using tools that do transaction tracing to aid find bugs and improve your code as you are writing and testing it on your workstation.

What Happens Once You Deploy Your App to QA?

For well-nigh developers, understanding what their lawmaking is doing after it gets deployed is mostly a black box. If they are lucky they might be able to go access to some log files or remote access to the server.

How Practice You Go the Same Transaction Tracing Details on Your Servers?

Some of the tools mentioned above tin work on your servers to requite yous a trace, only they could cause huge a functioning overhead.

To easily view transaction traces across every user, server, and app, you lot actually need an APM solution. APM, or application functioning direction, typically runs equally a lightweight profiler to collect the same sort of details as the tools mentioned above. APM solutions are designed to exist have very low overhead and even run on high traffic production servers.

Examples of these types of tools are Stackify Retrace or New Relic. Bank check out our weblog post about APM tools to become a full list of them.

Example transaction trace recorded past Retrace showing logging, Redis admission, and SQL queries.

Things to Expect For and Validate in QA

APM solutions provide aggregate reporting across all of your apps and servers so you lot can actually clarify and understand performance. Here are some things that you should be looking for:

  1. Identify wearisome web requests
  2. Look for all applications errors that are occurring
  3. Find high volume and slow SQL queries
  4. Empathize the operation of application dependencies

Identify Deadening Web Requests

Sadly, "works on my machine" does not always translate to success when your lawmaking gets to QA. Generate some good traffic against your code changes to ensure it is performing well and working correctly.

Review how long requests are taking. Ensure that performance is in line with expectations and look for ways to amend it.

Look for All Applications Errors That Are Occurring

Application errors tin can happen for a lot of reasons. Sometimes they are just transient noise. But many times, they can be our beginning line of defense when it comes to identifying potential bug.

Later every evolution, information technology is a really good thought to ever look for new and regressed errors. In this case, nosotros tin can quickly see that after a deployment nosotros were missing a stored procedure that acquired a ton of new exceptions.

Find High-Volume and Ho-hum SQL Queries

It is difficult to really know how fast or how slow a SQL query is going to be until you test it against a large set of real data and a high plenty volume concurrently to see how it performs.

Understand the Functioning of Application Dependencies

Today'south applications are highly dependent on a lot of external services, beyond just a simple database. Apps typically practice a lot of web service calls, caching, queuing, and much more.

It is important to understand how these dependencies perform and scale before getting to production. In this example, we can meet a big spike in response times effectually nine:45 due to SQL database queries.

Programmer Tools for Abiding Feedback

Complimentary and inexpensive developer tools can requite you abiding feedback and insight into your applications. Based on the examples shown in this post, I hope yous that you see how valuable APM tools like Prefix and Retrace can be.

By using them through every step of the lifecycle, you can improve your team's velocity, increase the quality of your product lawmaking, and dramatically reduce the risk of a bad release.

Ultimately, you can spend more time building valuable software and spend less fourth dimension triaging bad code that could have been improved well before information technology was released into product.

The beauty of it all is that you can do it affordably and as a byproduct of work yous're already doing!

Topics:

performance, bugs, software development tools, qa

carrollwhishour.blogspot.com

Source: https://dzone.com/articles/developer-tools-to-find-bugs-before-they-get-to-pr-1

0 Response to "What Tools Would You Use to Find a Performance Bug in Your Code?"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel