A Not So Technical Introduction to DTrace
A Not So Technical Introduction to DTrace
Join the DZone community and get the full member experience.Join For Free
Microservices. Streaming data. Event Sourcing and CQRS. Concurrency, routing, self-healing, persistence, clustering...learn how Akka enables Java developers to do all this out of the box! Brought to you in partnership with Lightbend.
Back in Sun, this was one my favorite blog posts. Just reposting it here for what will happen to the Sun blogs, I don;t know.
The DTrace community doesn’t really need another blog post to introduce the technology to folks who are into this kind of a stuff. Why this blog post then ? Please read on. (Note that, this is strictly for newbies of various things)
Scenario #1: I had to explain DTrace to my friend who was going to talk about some JVM + DTrace stuff in a presentation in her college. I suggested her the topic. Now the hard part was to even explain the basic idea behind DTrace and convince her enough so that she in turn could convince her evaluators- both parties being almost completely ignorant about DTrace.
Scenario #2: I have been exploring a bit about MySQL + DTrace and was going to talk on it at the Bangalore MySQL UG meet yesterday. As expected, the audience was completely ignorant about DTrace and perhaps, of more importance- all of they ran MySQL on Linux for their business. Ah now things gets interesting. I wanted to ‘wow’ them with DTrace
One common thing between these, is that the audience in both cases are DTrace newbie. Before delving right into what DTrace can give us with all the technical details of probes, providers, consumers, production systems, et cetra , its very useful to set the stage with some real life analogies is set for the audience to move on to the excellent technical manuals available out there.
The remaining part of this post has the text from which my words were derived in both cases:
To introduce DTrace, you will have to speak about the importance of run time observability of production systems. Perhaps, that sentence was not very informative, however, please stay with me. I shall explain it.
Production systems: We call a production system as such, when it is used to provide any kind of consumable service to consumers. Consider a scenario: the billing system in a departmental store serves all the billing terminals- the ones at which you get your stuffs billed. The billing system is perhaps run off a single powerful computer or a network of many powerful computers housed somewhere in the store or more likely in a central location, not in the store. The billing system is an example of a production system. Its in use and you cannot
take it down. If you do or it decides to do so on its own, you will face the wrath of customers and bear losses in your business.
Observability: In simple words, observing a system means to learn to see the various ways your program- a 10 line program or a billing system- is behaving at run time. Now, what do we mean by ‘behaving’ ?
Let’s say, our program is now using 10% of the total CPU and other point of time it is using 90% of the CPU. That’s one behavior of the program. More simply, let’s say, for input X, the program is in function, F and for input Y the program goes to function, G.
Observing a system during its run time is hence also called dynamic observation of the system, ’cause it happens in real time. Since we basically ‘trace’ the behavior of the system at various instants of time, we can also refer to it as ‘Dynamic Tracing’.
Off Radioactive elements and DTrace
Tracing of a system is a lot similar to the way Radioactive elements are used as tracers in human body to identify various abnormal body processes. Our topic of interest here, DTrace works a lot like this.
Using the DTrace framework, we can implant probes (or tracing points, like ‘radioactive tracers’) in our programs and can subsequently monitor those points for activities of interest. What we are interested in here, is Live Analysis and not post mortem analysis
I would also like to suggest you to go through the slides that I used for the talk. The later slides are MySQL specific, but the first few give some general information. It also incorporates some information that I was suggested by Richard on the dtrace-discuss list. Thanks to Michael andJames for their suggestions. James also suggested some basic DTrace scripts that I could use to wow the audience. However, I will save them for the getting started session. I have just aquainted them.
Now its time to read http://www.solarisinternals.com/wiki/index.php/DTrace_Topics_Intro
I hope you find this post useful, and appreciate your comments.
Opinions expressed by DZone contributors are their own.