Archive
Posts in DTrace
DTrace out of memory errors
While profiling an application with DTrace this week, I received the following error: After a bit of googling, it looks like I was hitting the upper bounds on the number of probes that can be enabled. To fix the problem, I increased fasttrap-max-probes in /kernel/drv/fasttrap.conf from 250,000 to 1,000,000. Once I made the change, I ran update_drv to force the fastrap kernel module to re-read it's configuration: Now everything is swell!
$ read more →Using DTrace to measure Apache request processing time
While fiddling with Apache and DTrace this week, I wrote a script (requestime.d) to measure the time it takes to read and process each request sent to an httpd process: Writing DTrace scripts is fun!
$ read more →Best way to learn how applications work? Dtrace!
I have been spending a good bit of time trying to understand how Apache works, and started to wonder which methods could be used to understand how large software packages work. After pondering this for a bit, it dawned on me that DTrace's flowindent and ustack() / stack() functions are ideal for reverse engineering software. To illustrate what I am talking about, say you want to see what to watch the call flow between the Apache ap_run_create_connection() and ap_run_process_connection() hooks. You can read the source code to put together a call flow diagram, or you can run the following DTrace script: I have found this useful for watching specific call paths, and for understanding the system impacts of specific call paths…
$ read more →Displaying linker options with DTrace
While debugging a problem today I wanted to see which options where passed to the linker. I could have used the compiler drivers verbose option, but that would have dislayed a slew of information along with the link line (if anyone knows an environment varaible to limit output, I would love to hear about it). Since the DTraceToolkit comes with the execsnoop script, I decided to use that to limit what was displayed: The "-c" option limits output to a specific command. Nice!
$ read more →Profiling Apache modules with DTrace
While poking around the Apache source code this weekend, I started to wonder which Apache modules consumed the most CPU time servicing HTTP requests. Since I had Apache installed on a Solaris 10 box, I threw together a D script named apachemoduleprof to answer this question: After running this a few times, I noticed that the httpd core along with a few other modules consumed most of the CPU time. To see which functions were the busiest in each module, I threw together the apachemodulefunctime D script: This example shows each function that is called in the mod_log_config Apache module, and provides a timestamp from the function entry to the function exit. This was super useful information, but I also wanted to see which functions were called from mod_log_config…
$ read more →