it_user68016 - PeerSpot reviewer
Team Lead at a tech services company with 51-200 employees
Consultant
New Relic for PHP: Web Application Performance Monitoring

The performance of a web application plays a critical role in how an application is perceived by its users. It is important to measure it, identify the causes if it changes and react swiftly to any unexpected changes. This article describes an industry leading tool, New Relic, and how it can be used to monitor and improve your site performance.

Setting up a good web application monitoring system can be tiresome, but it’s well worth it. Without the monitoring tools the only thing we could tell is if our site is performing as expected or not. In order to improve the performance we have to be able to identify the worse performing user actions and profile them independently to pinpoint the cause. New Relic achieves that and more in just a few screens, all without manually adding any profiling code to your application.

New Relic is a real-time application monitoring service, providing various metrics about the performance of your production site, covering everything from application database queries through to the time it takes for the end-user to view a page. This data is then collected, post-processed and converted to simple and clean charts presented in the New Relic web interface. Since the New Relic agent has to collect and report the data, it does add some overhead to the application stack. Unless you’re running a service that has to respond in a few milliseconds, however, the overhead added is minimal and is far outweighed by the value of the reports enabling you to detect and solve problems early.

This article covers both the basic functionality of New Relic (that can be used for free) as well as describing what the Enterprise version has to offer.

Getting Started

The New Relic installation is split into several distinct components:

  • the agent component – a PHP extension, which collects the data and reports to a locally running New Relic daemon.
  • the daemon component, acting as a proxy between the PHP agents and New Relic datacenters. The main responsibility of the daemon is to reduce the time of reporting the data to New Relic.
  • New Relic reporting suite – the main New Relic website, where the data is presented for the user.

Both the agent and the daemon components are installed using the provided newrelic-install script. The script will detect the available PHP installations and deploy the agent extension to all of them.

Please refer to the official documentation for more detailed information regarding the installation and configuration of the New Relic package on your specific platform.

Basic Charts

“Forever. Seriously. That’s right. Free. Just the basics.” (newrelic.com)

While the free version of New Relic does not have all the bells and whistles of the Enterprise version, it does provide some basic, yet useful, feedback regarding your site performance.

Application Performance

If you are interested in an overview of how your application performs at PHP level, this is the chart to look at. It displays the average execution time of your PHP scripts in real time, split into separate layers by their execution type:

  1. time spent to execute database queries
  2. time spent in PHP
  3. external web service calls

Depending on which of the application layers take the most time, different optimisation (or scaling) techniques can be applied.

  1. The time spent in the database can usually be reduced by doing one or more of the following:
    • analysing the queries that are executed, ensuring that they are using indexes correctly or creating new indexes for them
    • caching the most frequently-accessed and computationally-expensive result sets from the database
    • optimising the structure of your application’s data using techniques such as database partitioning
    • scaling up the database layer (e.g. adding more slave nodes)
  2. The PHP time is the time that your application is processing the data and good tactics for bringing this down could include:
    • caching intermediate results
    • optimising the code, using faster algorithms
    • adding more webnodes (if the hardware limits are reached)
  3. A few things that can help to optimise the network operations:
    • cache everything that can be cached;
    • introduce an asynchronous job queue if possible.

Browser Performance

Even if the performance of your application is good, there is no guarantee that the users of the site will get it loaded within a reasonable timescale. The New Relic chart for browser page load time provides an overview of how your website is performing.

Similar to the application performance overview shown previously, this chart is composed of several separate layers:

  1. Web application time tells how long it takes for your application to process the requests. More information about this layer can be seen in the application performance chart shown earlier in this article.
  2. Network time is the time that is spent purely for the user request to travel to your application server and then for the response to reach the browser, disregarding the time spent in the application itself.
    To optimise this component one would need to review the network performance of your system architecture by considering the following questions:
    • do you compress the response sent to the site users (depending on Accept-Encoding)?
    • is it just that the response is huge and some of it can be loaded later?
    • is the bandwidth used reaching its limits and you simply need a faster network link?
    • would distributing your servers worldwide (see more on this later) help?
  3. DOM Processing includes the time from browsers receiving the HTML until the DOMContentLoaded is fired. The work done by browsers is essentially a preparation to execute your JavaScript logic, thus, it prepares the DOM structure, preloads CSS (if there are any script tags after them) and JavaScript files.
    To optimise the site performance at this New Relic layer, there are several actions that can be performed:
    • make fewer requests to retrieve JavaScript and CSS files
    • minify and compress JavaScript and CSS files
    • set caching headers so that static files could be cached by the client
    • reduce the number of DOM elements
    • use a CDN for the static files
  4. Page Rendering time is the time a browser takes to download everything needed after the DOMContentLoaded event; this is usually the time when all the images are downloaded. Similarly as for the JavaScript and CSS files, the list of actions available to optimise the delivery of static content includes:
    • optimising image files
    • using CSS sprites instead of multiple images
    • using correct caching headers
    • using a CDN to bring your content closer to the user (there’s also a chart for that, shown later in this post)

An extended list of rules and how they affect your website’s frontend performance can be found at Best Practices for Speeding Up Your Web Site. Also, there are several tools that can help you to analyse the frontend performance such as Yahoo’s YSlow or Google’s PageSpeed.

More information about the Real User Monitoring functionality can be found at How Does Real User Monitoring Work? (New Relic documentation) or How we provide real user monitoring: A quick technical review (New Relic blog).

Throughput Charts

Even if your application is performing very well, it is only performing this way given the request rate at that time. As the number of users on the site increases, new bottlenecks “appear” – which can slow the overall usage of the site or even bring it down. As a result, the rate your application is handling the requests is at least as important as the time it takes for your application to send the response.

There are two separate throughput lines available – one for the browser requests and one the application. The browser throughput tells how many pages were requested per minute. Some of those requests may be served from cache before even reaching the application server, other pages may include additional application requests via Ajax. Thus – the two lines may be completely different and suggest different optimisation targets.

Apdex Rate

In addition to measuring your website performance in time, New Relic provides an Apdex score, which tells how many of your site visitors were satisfied, tolerating or frustrated by the response time of the application.

Once the target times for the browser and application servers are set, it will be used to calculate the Apdex ratio:

  • satisfied requests are all requests that have completed in less than the target time (T), and “pull” the Apdex score towards 1.0
  • tolerating requests are those which have taken more than T, but less than 4*T. These requests are given the score of 0.5
  • frustrated requests are all the rest, and their Apdex score is 0.0

The main difference between using the Apdex ratio and the application response time, is that no one request (outlier) can affect the global ratio more than any other. This makes it a more scientific metric for the global overview of your site’s performance if your goal is to answer the question “what proportion of the site visitors see a page loaded quickly enough?”.

For more information about the Apdex score see the New Relic documentation about this metric.

Worldwide Site Delivery

Is your site performing well for local users? What about the users overseas? The Internet is really fast these days, however it is not instant. The further your user physically is from your servers, the longer distance the information packets will have to travel.

To get a glimpse of how your site is performing for different countries, you could look at the worldwide Apdex chart. New Relic also provides more detailed information for the enterprise customers.

Since the performance problem in this case is usually due to the global network speed, there is no fix that can be applied locally – you’ll need to bring your service closer to the user. Depending on your application needs one or more of the following measures can be employed:

  • use a CDN to serve static files from local servers
  • use local dynamic content caching servers for slower areas
  • implement your service locally for the slower areas

Enterprise Functionality

“The Total Package!”

The basic functionality that New Relic offers for free can give us a lot of valuable insights about the global site performance. We can see what areas need more attention than others and this alone can save some precious time while optimising the site. Yet, it does not provide some of the (sometimes crucial) information; where exactly is the bottleneck?

In addition to the free Lite account New Relic offers two more plans (Standard and Pro) which extend the basic reports and introduce some new ones, allowing you to drill down to the root of performance problems quickly and efficiently.

Application Profile Traces

One of the best features offered to help debug performance problems is the comparison between different web transactions and the ability to see timed application traces of slow calls. New Relic provides charts similar to those described above for each web transaction type (provided that New Relic supports the framework you’re using). Also, a list of slow transaction traces is included with the detailed information.

There are already several tools available to profile your PHP code, such as Xdebug and XHProf. Xdebug is a really powerful development tool as well as offering profiling capabilities. XHProf is simple to configure and relatively easy to use, and there are also companion tools such as XHGui which make life even easier. So what is different about New Relic?

The code profiling trace that New Relic provides is a call tree with only Incl. Wall (absolute and relative) information. This tree alone is not very well suited for a generic code analysis since it does not provide the count of how many times a method was invoked, nor its total time during the application run. The power of it is that it is integrated with all other New Relic features and is easily accessible for a quick review once a slower transaction is detected. In addition to PHP code profiling, New Relic also provides a separate report for slow SQL statements, with their execution times and call counts.

With the help of these integrated traces, finding slower pieces of the application code is a straightforward task, helping to keep the focus on the site as a whole while still being able to detect problems and pinpoint them to the method level.

Compare with Historical Data

In addition to displaying the current state, New Relic also provides a comparison mode. When this mode is turned on, all the basic charts are affected – in addition to the current data they now also provide information from one day and one week ago. This mode is especially useful to show whether the site is performing any better (or worse) than before.

Scalability

How well is your website performing under load? The easiest way to answer that is to look at the scalability chart that New Relic provides. The chart plots the application response time versus the throughput.

This chart can quickly give you an idea about how well your website is responding given that there are a certain number of requests per minute. If the response time is constant as the throughput increases then your site is performing well. However, if you notice that the response time is increasing together with the throughput then it is time to take action. Finding the bottleneck using New Relic should now be an easy task using the database and application code profiling tools described above.

More information about this chart can be found in the New Relic blog.

Final Thoughts

New Relic is an amazing service to monitor your web application. It is simple and powerful – all the numbers are presented in such a way that a quick glance to the chart enables one to tell a lot about the site’s performance. In this blog post we have reviewed the common problems that New Relic can help us to detect and provided several suggestions of how to fix them.

Also, it is probably worthwhile mentioning that while New Relic is very good at what it does, it is a service to monitor your application and it usually works best if combined with a separate system to monitor the server resources or the performance of each service you’re using – understanding how the whole application ecosystem behaves is essential in order to build a stable and well performing web service.

https://techportal.inviqa.com/2013/03/14/new-relic-for-php-web-application-performance-monitoring/

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
it_user4968 - PeerSpot reviewer
Developer at a financial services firm with 10,001+ employees
Real User
I’ve used new relic with my rails apps for over a year now and like the service a lot

I’ve used new relic with my rails apps for over a year now and like the service a lot. I recently noticed that they have integration with php so I decided to get the php agent configured on my server so I could get stats on an upcoming symfony 2 app.

I use Nginx / PHP-fpm to run my php apps on ubuntu. The install instructions on the new relic site worked pretty well except for one minor quirk.

I had to install php5-dev so that the new relic install script had php-config to execute to find out information about my install. After that, the install script kept complaining that it could not find a valid php install on the system.

With this particular setup, new relic would look for php in /usr/bin/php (from the php-config script) but that did not exist. There was /usr/bin/php5-fpm and /usr/bin/php5-cgi.

I created a symlink for /usr/bin/php and reran the install script.

Success!

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
Buyer's Guide
New Relic
May 2024
Learn what your peers think about New Relic. Get advice and tips from experienced pros sharing their opinions. Updated: May 2024.
772,422 professionals have used our research since 2012.
it_user347676 - PeerSpot reviewer
Director of IT/Operations at a computer software company with 51-200 employees
Vendor
Implementing it with our app servers gave us visibility into our Java code and JVMs during user issues. Yet, Synthetics would be more useful if it didn't have to learn another analytics language.

What is most valuable?

The APM Transaction monitoring is the most valuable feature. Being able to define key transactions and collect traces has been essential to providing actionable data for fixes and improvements.

How has it helped my organization?

Early in our app lifecycle we would receive random reports of slow response times from users. Of course, they were never reproducible in our QA environments nor did our OS-specific monitoring tools show any problems. Implementing the APM with our app servers gave us visibility into what our Java code and JVMs were doing at the time users had problems. This allowed us to zero in on infrastructure and code issues as well as implement monitoring cases specific to our app.

What needs improvement?

Last year, there were several New Relic outages where alerts were either fired in error or not fired at all. These have been remedied over the last year, but it negatively impacted our trust in using New Relic as our sole source of analysis and alerting.

As far as suggested improvements, the Synthetics module could be much more useful if one did not have to learn yet another analytics query language.

For how long have I used the solution?

I have used New Relic in production since mid-2013.

What was my experience with deployment of the solution?

Since we use a 1.x version of Play Framework, there were some initial challenges in implementing the Java APM agent. The later versions of the agent have drastically improved since then and deployments are considerably less cumbersome.

What do I think about the stability of the solution?

The aforementioned outages and issues were vexing but, fortunately, are well in the past.

What do I think about the scalability of the solution?

No issues encountered.

How are customer service and technical support?

Customer Service:

Generally excellent.

Technical Support:

Generally excellent.

Which solution did I use previously and why did I switch?

New Relic was an add-on to our existing operations analytics systems. We selected New Relic solely on the basis of the application monitoring feature which our existing systems did not provide.

How was the initial setup?

Once we overcame the challenges of implementing the early Java agent, the remainder of the implementation was effortless. We had 90% functionality within the first 12 hours of implementation.

What about the implementation team?

I performed the implementation personally.

What's my experience with pricing, setup cost, and licensing?

At our usage level, the cost has been trivial compared to our overall operations monthly costs. What the product has done for us was expedite our ability to discover actionable data that led directly to improvements in our app which would have taken considerable longer if we'd had to build similar functionality ourselves.

Whilst it may be tempting to instrument all of your production and non-production environments, this is a tool that is best used where appropriate, rather than as a blanket deployment.

Which other solutions did I evaluate?

We evaluated building similar functionality ourselves using open source JVM monitoring and log analysis tools. We also evaluated a few semi-competitors. The home-brewed solution would have required additional engineering staff and a much longer build time. The also-ran services were astronomically more expensive.

What other advice do I have?

It's a great tool for monitoring infrastructure and application performance. The only drawbacks have been cost and a few issues with outages and monitoring/alerting failures.

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
it_user345000 - PeerSpot reviewer
Senior Software Engineer at a real estate/law firm with 1,001-5,000 employees
Vendor
It's helped us to find problems early and to make sure that what we're doing is working, although it doesn't give us rich process tracing.

What is most valuable?

The most valuable features for us are--

  • Real-time monitoring
  • The interface
  • The look and feel
  • We can check the environment periodically throughout the day
  • Good forensics tool if there's an issue

How has it helped my organization?

We can monitor response times, volume, and Apdex. Our alerting is based on Apdex. It's a great sanity check. It's helped us to find problems early and to make sure that what we're doing is working.

I'm on a small team and have an interaction with the Ops teams only when a negative happens, but I've used it a couple of times to pass problems from my plate to someone else's as I've proved it's not my problem.

What needs improvement?

It doesn't give us rich process tracing, which is the only complaint I have. It divides our system into four parts, and I would like it to go deeper into the code. However, this can be a challenge because of the way it is configured with us, but they are working on it.

What do I think about the stability of the solution?

It's fantastic, with no bugs or lag.

What do I think about the scalability of the solution?

It scales, and I can't speak about this, but we are moving everything to AWS and it should be fine.

How are customer service and technical support?

I've never needed them, and the one issue I had, our Ops guys told me what to do.

Which solution did I use previously and why did I switch?

I would just advise you to use the tool.

How was the initial setup?

It was already in place when I joined.

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
it_user344544 - PeerSpot reviewer
Sr. Software Engineer, DevOps at a manufacturing company with 501-1,000 employees
Vendor
We get to know when a specific service or specific URL is failing and not performing. We can set certain delivery thresholds, which, if broken, we hear about it immediately.

What is most valuable?

There are many things, but in particular I like the real-time monitoring. We get to know when a specific service or specific URL is failing and not performing. We can set certain delivery thresholds, which, if broken, we hear about it immediately.

How has it helped my organization?

It allows us to monitor in our little part of the company, but it plays a role in the larger functioning of the company because we have our hand in so many areas.

What needs improvement?

Nothing. There’s not really anything I don’t like about it.

What do I think about the stability of the solution?

It’s generally stable, but last year it was a little flaky. It wasn’t as responsible as it should have been, as sometimes you would lose some things that you’d worked on, but very few incidences. But currently the newer version is very stable.

What do I think about the scalability of the solution?

It's scalable, but it comes with a price.

How are customer service and technical support?

I used tech support a while back, but I can’t remember if it was a positive or negative experience. We only had a small issue. But they’ve improved a lot in terms of a larger knowledge base and the usability of the solution itself has improved.

Which solution did I use previously and why did I switch?

No previous solution was used.

How was the initial setup?

I was not involved as it was already set up when I came. At my previous company two years ago, I helped set up, and it was a little bit of a hassle, but it was a different platform (Java). Now it's nodes.

What's my experience with pricing, setup cost, and licensing?

Licensing is based on scale.

What other advice do I have?

It depends on your business, but it's a very useful tool. If you're in the web, you probably need it.

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
PeerSpot user
Lead Strategy Architect at a recruiting/HR firm with 1,001-5,000 employees
Vendor
With the reporting/alerting and SLA feature we can generate reports to see the average response on days/weeks/months, but labelling and tagging should be more user-friendly.

Valuable Features

We can, in seconds, discover and point to the component/code that is giving us performance issues without debugging all the code.

After some days of using the product, we could optimize the code of multiple critical application used by our customers and, therefore, provide better, more stable services.

The ROI was there already after several days. Debugging and finding issues was taking, at a minimum, several days, now we can do it several hours.

Improvements to My Organization

We can get a complete and detailed view of each component of our product and focus immediately on performance issues, or give priority to the code/component we want to optimize.

Also, with the reporting/alerting and SLA feature we can generate reports to see the average response on days/weeks/months.

Lastly, it can help us compare between days, so we can see the impact of a deployment of new code on performance.

Room for Improvement

Labelling and tagging should be more user-friendly. It needs some more features.

Use of Solution

We've used it for more than one year, almost two. For some months we had temporary licenses, then we bought the required licensed when we saw the add-on value of the product.

Stability Issues

There were some small bugs with the ability to update the dashboard the driver, RAM, and CPU after we upgraded to a server application. We had to ask New Relic to manage this issue on their side.

Scalability Issues

No issues encountered.

Customer Service and Technical Support

Customer Service:

9/10 - very good and fast response. They always try to provide real support to understand your target, your issue, and try to find a solution to reach their customers target and satisfaction.

Technical Support:

9/10. They know their product and most of technical replies are very clear, working, exactly as they say, and are easy to implement.

Initial Setup

The deployment is easy, and it only takes one minute to install the package at the OS level for a server via RPM, and via agent for different applications where you integrate them in your application. It would be difficult to do make it simpler.

It was peanuts, and you install the agent/plugin on your OS or application, then you start your application or the agent on the OS, and it is automatically integrated in the dashboard on the cloud. It's impressive how it is so simple.

Implementation Team

You install it yourself.

ROI

In several days, we got a great ROI due to an issue in an customer application. In the past, it was taking days for our developers to find the root cause of performance, and the slowest component. Now, in seconds, we can point direclty to the code/component that is slow, that has issues, and allow the developers to directly focus on working on the code to provide an optimized and stable code to deliver better service to the customer.

Pricing, Setup Cost and Licensing

Price and licensing is very efficient and correct.

Other Solutions Considered

We looked at other products, but we had first priority on an ROR/Ruby application for a new application. The payroll exchange used by our customers all over the world and some good competitors didn't support ROR/Ruby applications.

Other Advice

It's very good but still needs to be enhanced. Test it by implementing it, and in minutes, you will analyze the results and the dashboard and adopt it.







Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
it_user11631 - PeerSpot reviewer
Developer at a tech services company with 51-200 employees
Consultant
The awesomeness that is New Relic

Explained by example

The best way to explain how New Relic can help, is by example.

A few weeks back, one of the magento based webstes I manage had some serious delays at checkout. After 'submit payment' was clicked, some users reported that the site could take up to 40 seconds (and in some instances just timed out) to respond back with the resulting page. Yikes! This was just unaccepatble.

After spending nearly 5 hours tracking this down (without New Relic), and not getting a clear view of the reasons, and not being able to replicate the issue, I signed up to New Relic, and hooked the site up.

And within an hour I had the reasons, and a fixed was placed on the site.

New Relic 'Key Transactions'

New Relic has this great new feature called ' Key Transactions'. This feature gives you the ability to mark any transaction as important, and it will appear in a new menu called 'Transactions'. This feature makes it a lot easier to monitor the transactions you are specifically interested in. In my case, I marked the checkout process (/onestepcheckout/index/index) as a Key Transaction.

Ok, so now I can monitor the actual checkout process specifically, and I am ready to collect information on what the hell is going on.

I placed a test order. And yep, I could not replicate the issue, all looked good, and I got the result page within a few seconds.

But all was not lost. All I had to do was wait for New Relic to collect details about every checkout, and I coud analyze the results.

It did not take long to finally find the reason behind the intermitted delay.

The trace from New Relic for a transaction that took more than 20 seconds to complete:

as easy as that, I now had the reason for the delay: Email mailing list subscriptions at checkout!

The reason I could not replicate this issue was because my user was already subscribed to the mailing list, thus, at checkout I would never got the 'subcribe to mailing list' checkbox.

Now that I knew what was going on, I could easily relicate the issue, implement a fix, and eliminate the delay at checkout.

Easy as.

The conclusion

Without the help of New Relic, it would have been near impossible task to track this issue down. New Relic not only saved me hours of frustration, but saved me hours of time, and allowed me to quickly, effectively target, and fix the problem at hand.

Simply put: New Relic is a developers best friend.

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
Owner at RP reaaliprosessi
Real User
Easy to use, gets the job done, and provides good breakdown and in-depth details
Pros and Cons
  • "The breakdown of the response time of different components and getting in-depth details of the slow component are the most valuable features. It is easy to use, and it gets the job done."
  • "There has been some problem with the agent, and it is just not working well. It is not able to record information with the application server. They have been able to fix the issue, but it took quite a long time. This is the main issue in the APM products and also in New Relic. The mobile application monitoring has been pretty difficult to set up and also quite expensive. It should be a little bit easier and cheaper. Because it is pretty difficult and expensive, many customers don't take it."

What is our primary use case?

We are basically testing three products before going live with the new release of the software. We are also using it to monitor our production.

How has it helped my organization?

You can immediately see if there is some slowness. It can also alert you, and you can fix the problem pretty soon. In pre-production, you can ensure that everything is okay, and you don't put the worst performance to production. The performance should at least be at the same level as before.

What is most valuable?

The breakdown of the response time of different components and getting in-depth details of the slow component are the most valuable features.

It is easy to use, and it gets the job done.

What needs improvement?

There has been some problem with the agent, and it is just not working well. It is not able to record information with the application server. They have been able to fix the issue, but it took quite a long time. This is the main issue in the APM products and also in New Relic.

The mobile application monitoring has been pretty difficult to set up and also quite expensive. It should be a little bit easier and cheaper. Because it is pretty difficult and expensive, many customers don't take it.

For how long have I used the solution?

I have been using this solution for four years.

How are customer service and technical support?

Their technical support is pretty good. Sometimes, they took longer than I hoped. There were times when they took a couple of days, but I got help, and it is working.

What other advice do I have?

They seem to have a new pricing model, and I would advise others to look out and ask them before buying.

The biggest lesson that I have learned from using this solution is that you don't always guess right. Without APM, you can guess where the problem is, but with APM, you can actually see where it is, which is nice to know.

I would rate New Relic APM a nine out of ten. It is a good product. There might be another product that is better than this, but this is the product that I use and recommend first.

Disclosure: My company has a business relationship with this vendor other than being a customer: Partner
PeerSpot user
Buyer's Guide
Download our free New Relic Report and get advice and tips from experienced pros sharing their opinions.
Updated: May 2024
Buyer's Guide
Download our free New Relic Report and get advice and tips from experienced pros sharing their opinions.