Try our new research platform with insights from 80,000+ expert users
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 2025
Learn what your peers think about New Relic. Get advice and tips from experienced pros sharing their opinions. Updated: May 2025.
851,823 professionals have used our research since 2012.
it_user344877 - PeerSpot reviewer
Problem Manager at a financial services firm with 501-1,000 employees
Vendor
We can see how deployments affect the application, both good and bad. And although it constantly aggregates data so it’s not a real-time indication, they recognize and are looking to solve the issue.

Valuable Features

The overview itself provides us clear visibility of how applications are doing, and provides us our response times, data rates, and Apdex score.

Improvements to My Organization

We’re able to see how deployments are affecting the application, both good and bad. APM surely shows us the change in behavior. It lets us know how our application is doing. A lot of our information comes from trouble tickets, and we can correlate back to APM to see what’s going. It’s not so accurate, but it has to do with the data integration, but New Relic has said that it’ll give more data points and real-time data.

Room for Improvement

We always talk about, what is the data missing from New Relic? It constantly aggregates data so it’s not a true indication of how our application is doing. It’s not real-time. That was my concern, but after data presented by their CEO at Futurestack, they announced that they recognize the issue and are looking into solving it.

For New Relic in general, the mobile site doesn’t have single sign-on for iOS.

Stability Issues

I haven’t noticed any issues. There may have been a couple of instances two years ago when New Relic stopped reporting data, but nothing that I know of since then.

Scalability Issues

We are using APM to use capacity planning, and the info we get has been able to help us.

Customer Service and Technical Support

We had an issue two years ago, and they were responsive and solved the issue.

Initial Setup

I wasn't involved in the setup.

Other Advice

It loses points because our applications are running on Ruby on Rails, and our tech stack is not up to date, so there are some glitches integrating with APM. I'd like to see a fix for that.

Other than that, just go for it, you won’t regret it.

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
it_user344514 - PeerSpot reviewer
Software Engineer at a tech services company with 501-1,000 employees
Consultant
Although it isn’t as expressive as SQL, we're able to implement a solution that uses New Relic's API to provide data so the project manager can query it using NRQL.

What is most valuable?

It's schema-less and unconstrained to queries. And although NRQL isn’t as expressive as SQL, we're able to implement a solution that uses New Relic's API to provide data so the project manager can query it using NRQL.

They announced that they’re expanding a GUI to make NRQL even less technical.

How has it helped my organization?

Helped us understand that we had a professional group of our users that we didn’t even know about.

It identified mechanized behavior (e.g. bots) and then blocked them.

What needs improvement?

Raw transaction didn’t give us data that we needed. We needed user information so we needed to supply the data with an API.

What do I think about the scalability of the solution?

It’s built to stay up. We starting sending a ton of data to them. They were able to deal with it on their end given their internal architecture. We had a marketing partnership with them.

How are customer service and technical support?

It’s responsive. When I have had questions, we used the forum. As a big customer, we get a response within a few hours.

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

Our CTO came back from a conference last year and we were trying to solve a problem using DynamoDB, S3 and Redis (trying to solve the user segmentation question and analyze user behavior). Within a few hours of implementing the API, I was able to query for what we needed. You could do a lot with elastic search, but that needs a team of three people.

How was the initial setup?

No complexity. Just an API call.

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

They charge by the number of events and for the retention.

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
it_user344493 - PeerSpot reviewer
Tableau Software at a tech services company with 501-1,000 employees
Real User
Using analytics as an application database is nice, but ​error handling and reporting is a little lackluster. They are, however, announcing a whole new analytics approach.

Valuable Features

  • It integrates everything, which is awesome.
  • The level of detail and customization, and integrating Insights with an application.
  • Using analytics as an application database.
  • DevOps for marketing.

Room for Improvement

Error handling and reporting is a little lackluster, but they're announcing a whole new analytics approach.

Use of Solution

We have a big deployment and use all of their product offerings except Mobile and Plugins. We use APM, Browsers, and Insights.

Scalability Issues

No issues. It’s expected since they’re cloud based.

Customer Service and Technical Support

They’ve been friendly and responsive.

Other Solutions Considered

We compared them to others, but they seem to be pumping out more features. Insights has no competition. They pump APM and browser data automatically so that it’s all seamlessly integrated into their insights.

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
it_user298440 - PeerSpot reviewer
Chief Technology Officer at a comms service provider with 51-200 employees
Vendor
It gives us insight into the performance of the entire stack as well as a view into which components have the biggest impact on customer experience.

What is most valuable?

The alerting is by far the most valuable feature, closely followed by the way the platform correlates incidents across applications and components.

We are able to derive very valuable insights into the performance of the entire stack, and most importantly, we get a view as to which components have the biggest impact on the customer experience.

How has it helped my organization?

We have both Ops and Tech Leads subscribed to the alerts now. In general the Ops team only responds to "server down" or other infrastructure issues, whereas the Tech Leads will become interested if errors are being thrown or the Apdex scores are affected. They then have the chance to observe the system during an issue, as well as grab stack dumps and thread traces that allow us to quickly identify issues that are hard or impossible to replicate in a test environment.

What needs improvement?

I would like some additional fine tuning control around the alerting. I would also like the ability to "store" particular errors or traces for longer than the normal week.

We are yet to investigate creating dashboards and building extensions so there's a lot about the platform we still haven't found.

The biggest issue is the lack of mobile support from the website. They do have an Android and iPhone app but I have a Windows Phone and it's virtually unusable.

For how long have I used the solution?

We've used it for about a year, and there are still a number of features we've yet to fully explore.

What do I think about the stability of the solution?

We see some exceptions in the machine Event Logs from time to time, and we occasionally see high CPU usage from the monitoring components but we've not seen any activity that compromised the stability of our systems as a result.

How are customer service and technical support?

Support people are very helpful and turn-around times are short. I have raised a number of tickets and I've always been happy with the outcome.

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

We used to use Microsoft System Center Operations Manager but this is really not ideal for our cloud-based deployments

How was the initial setup?

Deployment to our Windows, Ubuntu and .Net environments was very straightforward.

What about the implementation team?

We provide managed services on Microsoft Azure and Verizon Terremark for a number of enterprise organizations including Government, Motor Vehicle Manufacturers and FMCG.

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

The hardest part was understanding the licensing and billing. The licensing and pricing was a challenge for us to understand, so speak to an Account Manager rather than simply buying online. I think they need a blog post about this.

Which other solutions did I evaluate?

We evaluated a number of solutions but this is the only platform we've fully deployed to production. We looked at MS System Center, DataDog, Paraleap and SolarWinds.

What other advice do I have?

Start with a trial to get a sense of which components perform what kind of task, then divide your environment into applications and servers that require data retention, and those that don't. Put them into two separate accounts. The ones that require retention will eventually become a Pro account.

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
it_user164280 - PeerSpot reviewer
Senior Service Manager with 51-200 employees
Vendor
The reports on SLA metrics and scalability are very useful tool.

Valuable Features

The application monitoring and Insights functionality. From an Ops perspective the application metrics NR provides opens the hood. I use it often in combination with load and stress tests on UAT environments. The application behavior allows me to discuss the results with the team and focus on possible issues real soon. NR is a very useful tool in a devops and continuous delivery strategy. The reports on SLA metrics and scalability are a very useful tool for service managers.

Improvements to My Organization

It allows the Ops teams to better cooperate with the DEV teams. Essential in a devops culture is that the different role within a devops team use the same metrics and data. NR provides some of this data and input.

Use of Solution

For about three years now.

Customer Service and Technical Support

Customer Service:

Customer support is ok. They are easy to reach and you don’t have to wait for answers too long.

Technical Support:

Technical support is ok. They are easy to reach and you don’t have to wait for answers too long.

Initial Setup

I am not an engineer but one of the pros for use of NR is the ease of implementation. Our engineers find it easy to implement this toolset.

ROI

This is a hard one. The ROI is not crystal clear but can be found in preventing performance issues in production and a better/shorter troubleshoot possibility when suffering performance- and/or scalability/Availability issues on a production system.

Other Solutions Considered

We considered AppDynamics. It's is a more mature product in my opinion, but far more expensive.

Other Advice

Certainly do so. Great product which helps in quality and performance assurance of your webapps. Also helps in troubleshooting issues and brings Ops and Dev closer.

Disclosure: I am a real user, and this review is based on my own experience and opinions.
PeerSpot user
it_user3396 - PeerSpot reviewer
it_user3396Team Lead at Tata Consultancy Services
Top 5Real User

Helpful review:>)

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
Buyer's Guide
Download our free New Relic Report and get advice and tips from experienced pros sharing their opinions.
Updated: May 2025
Buyer's Guide
Download our free New Relic Report and get advice and tips from experienced pros sharing their opinions.