oprofile
This is a sampling profiler, so it has minimal impact on Traffic Servers performance.
Running the profiler and checking the status. Make sure the call depth is set to where you want it.
Panel |
---|
// start the deamon // check the status |
After making sure the daemon is running aand your settings are set to what you want. Start traffic server and start running the benchmark. I normally wait a few seconds for things to warm up before I start to profile the code.
Panel |
---|
// profile the code for 60 seconds |
Running a basic report will tell you what functions are showing up in the sampled profile the most.
Panel |
---|
bcall@snowball trafficserver$ sudo opreport --symbols /usr/local/bin/traffic_server | head |
Running a callgraph report.
Panel |
---|
bcall@snowball trafficserver$ sudo opreport -cg --symbols /usr/local/bin/traffic_server | head -50 |
Google profiler
- Main Page: http://code.google.com/p/google-perftools/
- CPU Profiler: http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html
This too is a sampling profiler, so it has minimal impact on Traffic Server's performance. Support for the profiler needs to be compiled into Traffic Server for it to work. There is an option to add profiling support when running configure and is described in the steps below.
Install the Google's perftools development package, the command may vary on the OS, below is on Fedora 12:
Panel |
---|
bcall@snowball trafficserver$ sudo yum install google-perftools-devel Dependency Installed: Complete! |
Run configure with the option to add profiling support. It will check to see if the header and library is installed. You will have to recompile traffic server to add calling the profiler's start and stop functions.
Panel |
---|
bcall@snowball trafficserver$ ./configure --with-profiler |
You can either install the package with "sudo gmake install" or run the program for the current directory if you already have an installation with all the logs and configuration directories setup.
Panel |
---|
bcall@snowball trafficserver$ sudo proxy/traffic_server |
Next you will need to run your benchmark. After the benchmark is complete, kill the traffic_server process or stop traffic server with the startup script. The traffic server process will need to be shutdown before a proper profile file is written.
Panel |
---|
bcall@snowball trafficserver$ sudo killall traffic_server |
Now we can look at the profiling information.
Panel |
---|
bcall@snowball trafficserver$ pprof --text proxy/traffic_server /tmp/ts.prof | head |
To make a callgraph of the program in PDF form.
Panel |
---|
bcall@snowball trafficserver$ pprof --pdf proxy/traffic_server /tmp/ts.prof > ts.pdf |
If you want to investigate a certain function you can the focus option.
Panel |
---|
bcall@snowball trafficserver$ pprof --pdf --focus=HttpSM::main_handler proxy/traffic_server /tmp/ts.prof > ts-main_handler.pdf |
Callgrind
Callgrind is will slow down the performance of traffic server significantly.