title: Profiling a multi-tiered, distributed, web application (server side)
body: <p>I would like to <a href="http://en.wikipedia.org/wiki/Profiling_%28computer_programming%29" rel="nofollow noreferrer">profile</a> a complex web application from the server PoV.</p>
  <p>According to the wikipedia link above, and the Stack Overflow <code>profiling</code> tag description, profiling (in one of its forms) means getting a list (or a graphical representation) of APIs/components of the application, each with the number of calls and time spent in it during run-time.</p>
  <p>Note that unlike a traditional one-program/one-language a web server application may be:</p>
  <ul>
  <li>Distributed over multiple machines</li>
  <li>Different components may be written in different languages</li>
  <li>Different components may be running on top of different OSes, etc.</li>
  </ul>
  <p>So the traditional &quot;Just use a profiler&quot; answer is not easily applicable to this problem.</p>
  <p>I'm <em><strong>not</strong></em> looking for:</p>
  <ul>
  <li>Coarse performance stats like the ones provided by various <em>log-analysis tools</em> (e.g. analog) nor for</li>
  <li><em>client-side, per-page</em> performance stats like the ones presented by tools like Google's Pagespeed, or Yahoo! Y!Slow, waterfall diagrams, and browser component load times)</li>
  </ul>
  <p>Instead, I'm looking for a classic profiler-style report:</p>
  <ul>
  <li>number of calls</li>
  <li>call durations</li>
  </ul>
  <p>by function/API/component-name, on the <em>server-side</em> of the web application.</p>
  <p>Bottom line, the question is:</p>
  <blockquote>
  <p><em><strong>How can one profile a multi-tiered, multi-platform, distributed web application?</strong></em></p>
  </blockquote>
  <p>A free-software based solution is much preferred.</p>
  <p>I have been searching the web for a solution for a while and couldn't find anything satisfactory to fit my needs except some pretty expensive commercial offerings. In the end, I bit the bullet, thought about the problem, and wrote my own solution which I wanted to freely share.</p>
  <p>I'm posting my own solution <a href="https://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/">since this practice is encouraged on SO</a></p>
  <p>This solution is far from perfect, for example, it is at very high level (individual URLs) which may not good for all use-cases. Nevertheless, it has helped me immensely in trying to understand where my web-app spends its time.</p>
  <p>In the spirit on open source and knowledge sharing, I welcome any other, especially superior, approaches and solutions from others.</p>