fbpx

CyberPanel

Abstract blue background 1

New Relic APM can help you find WordPress Performance Bottlenecks by digging deep into internals of WordPress. You can easily find poorly performing plugins, themes, database queries or even external calls. Without New Relic APM all you are doing is a guess work by activating/deactivate plugins and or changing themes.

Before moving forward, if you site is new with no traffic and you still want to test its performance you can use CyberLoader to put stress on your site and use New Relic to find performance issues.

However, setting up New Relic can be hard at times specially for people with no command line knowledge. There are many online tutorials that helps you configure New Relic with Apache or NGINX but there are close to none on how you can set it up with optimized LSPHP that CyberPanel usually ships with.

Note: If you are still not using CyberPanel, then you are missing out. Start using CyberPanel and see how easy it is to give performance boost to your WordPress site for free.

Table of Contents

  1. Get your self a account on New Relic Site
  2. Configure your server in New Relic APM
  3. Add you PHP Application Data
  4. Find WordPress Performance Bottlenecks

1) Get your self a account on New Relic Site

The first step in setting up New Relic on your server is to get an account on New Relic site you if don’t have one. If you already have an account, you can move forward.


2) Configure your server in New Relic APM

We need to configure our server so that it can send data to New Relic APM dashboard. Once logged into dashboard click APM from the menu and then click Add More Data.

wordpress performance bottlenecks

You will then see a window where you have multiple options to configure and install New Relic daemon on your server, we will be using the Guided Install method.

Screenshot 2 2

After selecting Guided Install Option you need to choose what kind of monitoring you are going to do. Since WordPress is an app, we will select App Monitoring.

Screenshot 3 2

Since WordPress is a PHP application, we will choose PHP.

Screenshot 4 3


3) Add you PHP Application Data

You first need to give a unique name to the application, this is important so make sure this is a unique name. And then you have to choose your installation environment, we are going to perform this on Ubuntu, however, it will be similar for Centos as well.

So for Ubuntu select apt from the agent list.

Screenshot 5 3

Once you select apt from the list, you will be shown some commands. Don’t run all the commands, because with LSPHP the process is different.

So open your server terminal and run these commands

1. echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list
2. wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -
3. sudo apt-get update
4. sudo apt-get -y install newrelic-php5

 

Screenshot 7 4

 

Note : Before running the fifth command, you need to set an environment variable, so that New Relic knows where to install the module.

Setup environmental variable

We need to tell path of PHP Binary to New Relic before actually installing it, run:

export NR_INSTALL_PATH=/usr/local/lsws/lsphp74/bin

I am installing New Relic for PHP 7.4 so my NR_INSTALL_PATH value is /usr/local/lsws/lsphp74/bin, if you want to install for PHP 7.3 it will be /usr/local/lsws/lsphp73/bin and similarly for other PHP versions

Once environment variable is set run the modified version of 5th command:

newrelic-install

Screenshot 9 2

After running this command New Relic is Installed on your system for PHP 7.4

Screenshot 8 2

Then Run last command

sed -i -e "s/REPLACE_WITH_REAL_KEY/a07ab8db0feaf2e017df859c1a20df08cc74NRAL/" \
-e "s/newrelic.appname[[:space:]]=[[:space:]].*/newrelic.appname=\"${NEWRELIC_APP_NAME}\"/" \
-e '$anewrelic.distributed_tracing_enabled=true' \
$(php -r "echo(PHP_CONFIG_FILE_SCAN_DIR);")/newrelic.ini

Now make sure that your newrelic.appname is properly set in newrelic.ini, open /usr/local/lsws/lsphp74/etc/php/7.4/mods-available/newrelic.ini

Find and set the value of newrelic.appname according to what you have set in Step 3.

Restart your Application

Restart LiteSpeed and LSPHP to make sure that New Relic Extension is loaded.

systemctl restart lsws
killall lsphp

Screenshot 10 2

You can create a php info page to make sure that New Relic Extension is loaded.

See your data

Once all of the above is done, you need to visit your site and generate some data and then click “See your data” and you will able to see data coming from your server.

Screenshot 11 1


4. Find WordPress Performance Bottlenecks

Now that everything is setup you can use New Relic APM dashboard to find various pain points in your WordPress.

Leave a Comment