Monitor WordPress Performance with New Relic
This guide walks you through setting up New Relic to monitor your WordPress site’s performance, including server response times, database queries, and external calls. You’ll learn how to install the agent, configure it for WordPress, and use the key dashboards to spot slowdowns before your visitors notice them.
What You’ll Need
- A WordPress site running on a server where you have SSH or file manager access (shared hosting may not allow the required PHP agent).
- Admin access to your WordPress dashboard (to install a helper plugin).
- A New Relic account – the free tier is sufficient for basic monitoring.
- Your New Relic license key (found in the New Relic UI under Account Settings).
- PHP 7.2 or newer (New Relic supports PHP 8.x as well).
Step-by-Step
- Create a New Relic account and get your license key – Sign up at newrelic.com, then go to Account Settings > API Keys. Copy the “Ingest – License” key (starts with NRAK).
- Install the New Relic PHP agent – SSH into your server and run the installation script for your OS. For Ubuntu/Debian:
sudo apt-get install newrelic-php5(the package name is the same even for PHP 7/8). For CentOS/RHEL:sudo yum install newrelic-php5. If you’re using a control panel like cPanel, use the “New Relic” section in WHM instead. - Run the agent setup – After installation, run
sudo newrelic-installand follow the prompts. Enter your license key when asked. The script will automatically detect your PHP version and add the extension to php.ini. - Restart PHP and your web server – For Apache with mod_php:
sudo systemctl restart apache2. For PHP-FPM:sudo systemctl restart php7.4-fpm(adjust the version). This ensures the agent loads. - Verify the agent is active – Create a temporary PHP file with
<?php phpinfo(); ?>and open it in a browser. Search for “newrelic” – you should see the extension loaded. Delete the file afterwards. - Install the New Relic WordPress plugin – In your WordPress admin, go to Plugins > Add New and search for “New Relic”. Install and activate “New Relic Reporting for WordPress” (by New Relic). This plugin automatically adds custom instrumentation for WordPress hooks.
- Configure the plugin – Go to Settings > New Relic. Enter your application name (e.g., “My WordPress Site”) and check the box to enable “Capture WordPress errors”. Save the settings.
- Set up browser monitoring (optional but recommended) – In the New Relic UI, go to “Add data” > “Browser monitoring”. Copy the JavaScript snippet and paste it into your theme’s
header.phpjust before</head>, or use a plugin like “Insert Headers and Footers” to avoid editing theme files. - Generate some traffic – Visit your site a few times, run a quick load test (e.g., with a free tool like Loader.io), or use the WP-CLI command
wp post listto simulate activity. This gives New Relic data to display. - Check your data – In New Relic, go to “APM” > “Applications”. You should see your app listed. Click on it to view response times, throughput, error rate, and a breakdown of time spent in PHP, database, and external calls.
- Set up alerts (optional) – In New Relic, go to “Alerts” > “Alert policies”. Create a policy that triggers when response time exceeds 2 seconds for 5 minutes, or when the error rate goes above 1%. You’ll get email or Slack notifications.
Common Mistakes
- Installing the agent on shared hosting – Most shared hosts don’t allow PHP extensions. You’ll need a VPS or dedicated server. If you’re on shared hosting, consider New Relic’s browser-only monitoring instead.
- Forgetting to restart PHP – The agent won’t load until PHP is restarted. Always restart after installation.
- Using the wrong license key – Make sure you copy the “Ingest – License” key, not the “API” key. The former starts with NRAK.
- Not enabling browser monitoring – Without it, you miss client-side performance issues like slow JavaScript or large images.
- Ignoring the “external calls” breakdown – If your site loads slowly due to a third-party API, you’ll see it under “External services”. Many people only look at the overall response time and miss the real culprit.
Tips
- Use the “Transaction traces” feature to see the exact SQL queries and function calls that slow down a specific page. Click on a slow transaction in the APM UI.
- Set up a “deployment marker” every time you push code – in New Relic, go to “Settings” > “Deployments” and enter a version. This helps you see if a release caused a performance drop.
- Combine New Relic with a caching plugin (like WP Rocket or W3 Total Cache). New Relic will show you how much time caching saves, and it helps you tune your cache settings.
- Monitor your database separately – if you see high “Database” time in New Relic, enable the MySQL slow query log to find specific queries.
- For WooCommerce sites, enable “Custom events” in the plugin to track checkout performance – the plugin can record time spent on cart and checkout pages.
Troubleshooting
- Agent not showing in phpinfo() – Check that the extension path in php.ini is correct. Run
php -i | grep newrelicto see if the extension loads from the CLI. If not, re-runsudo newrelic-installand ensure you select the correct PHP version. - No data in New Relic after installation – Wait 2-3 minutes for the agent to report. If still nothing, check that your license key is correct and that the server can reach
collector.newrelic.comon port 443. You can test withcurl -v https://collector.newrelic.com. - Plugin shows “No data” but agent works – The WordPress plugin only reports if the agent is loaded. Verify the agent is active first. Also, make sure the plugin is configured with the same application name as the agent (the plugin overrides the name).
- High overhead / site slows down – The agent has a small overhead, but if it’s significant, check your PHP version – older PHP versions (5.x) have higher overhead. Also, disable the “Capture errors” option if you don’t need it.
- Browser monitoring script not working – Ensure you pasted the script in the
<head>section, not in the body. Use a plugin to avoid theme conflicts. Also, clear your browser cache and test in an incognito window.
Frequently Asked Questions
Is New Relic free for WordPress?
Yes, New Relic has a free tier that includes 100GB of data per month, which is plenty for a small to medium WordPress site. You can monitor one host with APM for free.
Can I use New Relic on shared hosting?
Usually not, because you need to install a PHP extension. Some managed WordPress hosts (like WP Engine) have New Relic integrated – check your host’s documentation. If not, use browser monitoring only.
What’s the difference between APM and browser monitoring?
APM monitors server-side performance (PHP execution, database queries, external calls). Browser monitoring tracks client-side (how long the page takes to load in the visitor’s browser, including JavaScript and images). Both are useful – APM helps find server issues, browser monitoring helps find front-end issues.
How do I see which plugin is slow?
In the APM “Transaction traces” view, click on a slow transaction and expand the “PHP” breakdown. You’ll see a list of functions and files – look for plugin files (e.g., wp-content/plugins/…). That tells you which plugin is taking the most time.
Will New Relic slow down my site?
The agent adds a small overhead (typically 1-2% of CPU time). On a well-configured server, this is negligible. If you notice a slowdown, check your PHP version and consider disabling the “Capture errors” option.
Do I need to keep the WordPress plugin installed?
It’s recommended, as it adds WordPress-specific instrumentation (hooks, database queries) that the raw agent doesn’t capture. However, the agent works without it – you’ll just see less detail. If the plugin conflicts with your setup, you can uninstall it and rely on the agent alone.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.