How does an application performance monitoring tool like New Relic RPM work? [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
开发者_如何学编程 Improve this questionHow does an application performance monitoring tool like New Relic RPM work? How can it figure out all that information about your application? If someone was to build something similar for a PHP application where would be a good place to start? (I know New Relic for PHP is available, I'm interested in how to build one myself).
You can look at Pinba which is a bit similar to New Relic.
New Relic uses a custom PHP extension. You need to install this and then it will report to their main application. All of the better known APM tools do it that way: New Relic, Dynatrace/Ruxit, AppDynamics, Tideways, Instana, …
Their extensions will usually hook into the function executors of the PHP engine. This allows them to run arbitrary code, e.g. to measure execution time, memory usage, etc when individual functions are run. These metrics are collected and then sent via the network (or some other means) to some processing application.
You can have a look at Facebook's xhprof, xdebug or Tideways for open source examples on hooking into function executors and profiling PHP code. These profilers also expose functions into userland to allow users to do custom instrumentations of their own code, e.g. only profile specific parts of code, etc.
A good start is to look at PHP's reflection system;
http://php.net/manual/en/book.reflection.php
Use can gather most vital information using traces and profiler dumps, look at the xdebug website for more information.
http://www.xdebug.org/
I'm not sure how helpful this is since its written in another language, but I have been trying to work on an open source app performance monitoring tool called AppPerf. Its written in Ruby on Rails, and only has a ruby based RPM available at the moment. At the very least maybe it can give you some interesting insight into what might be involved in building something like this.
https://www.randygirard.com/open-source-application-performance-app/
精彩评论