The PHP agent comes in two parts:
The daemon acts as a proxy between the PHP agent and the New Relic servers to reduce network traffic and to improve response time for instrumented applications. Without the daemon running, no data is reported to New Relic.
If you do a process listing, you will see that there are always two daemon processes running:
$ ps -ef | grep newrelic-daemon newrelic 1368 1 0 00:28 ? 00:00:00 /usr/bin/newrelic-daemon ... newrelic 1370 1368 0 00:28 ? 00:00:00 /usr/bin/newrelic-daemon ...
The first column is the process owner, the second is the process ID (PID) and the third is the parent process ID (PPID).
The first process, the one owned by PID 1, is the "watchdog" process. It watches the second process, which is the "worker" process. The worker process is the one that accepts connections from the agent, gathers metrics, and communicates with the New Relic servers.
Note: Having two processes running is entirely normal behavior.
If the worker process encounters a fatal error and terminates unexpectedly, the watchdog process will immediately re-spawn a new worker process. This ensures that there is an absolute minimum down-time of the daemon.
When the daemon is being gracefully terminated, usually by running
/etc/init.d/newrelic-daemon stop, it will send a termination signal to the watchdog process. This will cleanly terminate the worker process, giving it a chance to send any pending data to New Relic.
Note: If you ever want to manually terminate the daemon, you should always terminate the watchdog, not the worker.
The following methods can be used to kill the daemon:
/etc/init.d/newrelic-daemon stop. This is the preferred method for interacting with the daemon.
Kill the process directly with its process ID:
Use the watchdog PID file:
kill `cat /var/run/newrelic-daemon.pid`
Additional documentation resources include:
If you need additional help, get support at support.newrelic.com.