New Relic APM
New Relic Application Performance Monitoring (APM) provides application and performance information for end-user operations completed through your stores. This data helps you analyze and improve application interactions.
You can mix the higher level data captured by New Relic APM with the deeper method and call dive data from Blackfire Profiler. Using these two tools together in Staging and Production environments, you gain a better view into your store performance.
You receive New Relic APM with your Magento Commerce (Cloud) subscription. You do not need to purchase or install install the New Relic extension (different than the APM service).
New Relic APM provides the following key features to Magento:
- Actively mark and monitor key customer actions in your site. For example, track performance of add to cart, checkout, or payment processing.
- Locate and monitor slow database queries.
- Use the App Map to view all application dependencies within your Magento site, extensions, and external services.
- Follow Apdex scores to evaluate slow downs and bottlenecks. Create alerts to watch for these slumps to identify and notify you when an issues is occuring. For example, site slow downs due to a flash sale or web event.
New Relic APM credentials
When you sign up for a Magento Commerce (Cloud) account, you will receive an email of credentials to your account. The agent software for New Relic is already installed to capture data for review through the service.
You will need these credentials and the license associated to them. You receive this information by email and in your project details.
Configure New Relic APM
For Pro plan projects, New Relic is already set up for you in Staging and Production environments. You will receive an email and possibly phone call with New Relic to provide credentials and access to their service.
For Starter plan projects, New Relic will provide an email of credentials and access information, possibly also a call.
Add a project level variable with your license:
- Log in to the Project Web Interface.
- Locate the SSH link for accessing your
masterProduction and Staging environments
In a terminal, SSH log in to each environment (Production and Master) and enter the following command. You will need the license key from New Relic.
magento-cloud project:variable:set –no-visible-build php:newrelic.license
Add New Relic to
- In your development code branch, edit
.magento.app.yamlwith a text editor.
Add the following information:
runtime: extensions: - newrelic
- Save and push the changes to deploy across Staging and Production.
You may also need to install the New Relic APM agent into Production and Staging environments. For instructions on installing the agent, see New Relic’s Agent installation guide. Access both environments via SSH and install the agent.
Through the dashboard, you can immediately track and find:
- Applications and transactions encountering slow responses or bottlenecks
- Investigate customer comments of issues with your site
- Locate the applications with high transaction time and follow up on queries, calls, and methods through Blackfire
- Verify and compare traffic to transaction time
We recommend reviewing the tracked data for:
- Most time consuming: All all requests in parallel to determine where time is going. For example, you may have the highest transaction time spent in product and category views. If suddenly a customer account page is highest, you may have a call or query dragging performance.
- Highest throughput: Identifies the pages hit the most based on bytes transmitted/size.
All collected data details the time spent on an action transmitting data, queries, redis, and more. If queries cause issues, New Relic provides a depth of information to track and respond to it.
New Relic and Blackfire
Armed with this information, you can investigate further with Blackfire.io Profiler. Each services has strengths and weaknesses that balance incredibly well together:
- New Relic worst case requests are not averages but edge cases. Whereas, Blackfire provides more of the average worst case requests. Compare this data to refine your troubleshooting.
- Blackfire is not detailed in determining and displaying queries giving you trouble. Use New Relic to find those.
- Cron job and other background processes are not monitored by New Relic. Sometimes these could be the culprit behind the scenes. Watching processes with Blackfire could help to locate these issues.