How does New Relic work?

donald picture donald · Jul 15, 2011 · Viewed 8.6k times · Source

How can New Relic tap into my app with a simple install? How does it know all the methods, requests, etc?

It works for RoR, PHP, etc.

Can anyone explain the technology behind it? I'm interested in tapping into my Rails app, but I want to do so smoothly like New Relic.

Thanks

Answer

Douglas F Shearer picture Douglas F Shearer · Jul 15, 2011

First up, you will not manage to duplicate the functionality of NewRelic on your own. Ignoring the server-side, the rpm Gem is a pretty complex piece of software, doing a lot of stuff. Have a look at the source if you want to see how it hooks into the Rails system. The source is a worth a read, as it does some cool stuff in terms of threading and marshaling of the data before sending it back to their servers.

If you want a replacement because Newrelic is expensive (and rightly so, it's awesome at what it does), then have a look at the FreeRelic project on Github.