Setting up Glowroot as Central Collector - Liferay

It is critical to have the correct monitoring tools in the right places while debugging Performance Bottlenecks in Production/Non-Production Environments. Glowroot is a strong open-source APM solution that is simple to set up and operate. There are different modes of setting up Glowroot i.e.

  1. Glowroot as Agent
  2. Glowroot as Central Collector

In this blog, we'll go through how to configure Glowroot as a Central Collector and use Collector agents deployed on Liferay to collect data and deliver it to Glowroot central.

Pre-Requisites:

  1. Separate VM/Server dedicated to glowroot.

  2. Regular OS User preferably glowroot.

  3. JAVA_HOME set for OS user created above (glowroot). In this blog Azul JDK11 is used.

  4. Cassandra 3.1 or later will be used as Database for Glowroot Central.

  5. Glowroot Central and Cassandra DB will be installed on Same server.

H/w Recommendations:

The following suggestions are not official, but rather based on experience.

  1. CPU: 8 Cores
  2. Memory/RAM: 8/16GB
  3. Storage: 100GB

Architecture Diagram:


 

Some Advantages:

  1. Does not use Liferay's JVM to run, hence it does not interfere with Liferay's JVM operation and places little to no impact on Liferay's JVM.
  2. Because Glowroot central is installed on a different VM/server, it does not consume and hinder the Liferay server's OS resources, which is not the case when Glowroot as Agent is installed on the Liferay server.

Download and Install JDK:

  1. Login via glowroot user in Glowroot server/VM.

  2. Download any jdk11 ( here Azul jdk11 is used)

     

  3. Go to /home/glowroot/ directory and open .bash_profile or .bashrc and add the jvm path like below 

         export JAVA_HOME=/home/glowroot/zulu11.66.15-ca-jdk11.0.20-linux_x644
         export PATH=$JAVA_HOME/bin:$PATH

         

     4. Save and Exit the above file.

     5. Now run source .bashrc command to reflect the changes.
         

     6. Once done check Java as per the below snapshot.

         

Download & Install Cassandra 

  1. Go to https://dlcdn.apache.org/cassandra/4.0.11/apache-cassandra-4.0.11-bin.tar.gz and download Cassandra binary file and paste it in the /home/glowroot/ directory.
     

  2. Unzip the binary file downloaded above in the same directory /home/glowroot/
    (use tar -xvzf apache-cassandra-4.0.11-bin.tar.gz to unzip)
     

  3. Go to /home/glowroot/apache-cassandra-4.0.11/bin and execute below command to start cassandra db

    nohup ./cassandra &

     

  4. Cassandra will start running in some time.

Download & Install Glowroot Central:

  1. Go to https://github.com/glowroot/glowroot/wiki/Central-Collector-Installation and download the available glowroot central zip file.


     

  2. Copy the downloaded zip file to the server in directory /home/glowroot/ and unzip.

  3. After unzipping go inside the glowroot-central/ directory.


     

  4. Now, start Glowroot central by running below command
    nohup java -jar glowroot-central.jar &


     

  5. Now open the browser and hit http://GlowrootIP:4000 (replace GlowrootIP with the IP address of the Glowroot server)

Configure Glowroot Collector Agent:

(Follow the below steps in all Liferay App Nodes)

  1. Go to the Liferay server and go to liferay_Home/
     

  2. Download the glowroot-agent zip from the link
    https://github.com/glowroot/glowroot/wiki/Agent-Installation-(for-Central-Collector)


     

  3. Copy the zip downloaded above to liferay_home/ folder and extract it.


     

  4. Go inside glowroot/ directory and create a file with the name glowroot.properties


     

  5. Open the glowroot.properties file and add below parameters
    agent.id=LiferayNodeHostname
    collector.address=
    http://GlowrootServerIP:8181


     

  6. Save and exit after making the above changes.
     

  7. Make sure to replace LiferayNodeHostname with the original hostname of liferay app server.
     

  8. Go to Liferay_home/tomcat/bin/ directory and open setenv.sh file.
     

  9. Add the Java agent entry in setenv.sh file.


     

  10. Start/Restart liferay servers to load the javaagent .

  11. Below logs will appear in catalina.out log file which means Liferay’s glowroot agent is successfully able to communicate with Glowroot central server.


     

  12. Once the Liferay app is UP and running, go to Glowroot Central in Browser. In the Java agent drop-down, the Liferay node hostname will start coming.

  13. Voilà, you're done! 

References

#

Software/Tool

Reference Links

1.

Azul JDK 11

https://www.azul.com/downloads/?version=java-11-lts&os=rhel&architecture=x86-64-bit&package=jdk#zulu

2.

Cassandra DB

https://dlcdn.apache.org/cassandra/4.0.11/apache-cassandra-4.0.11-bin.tar.gz

3.

Glowroot Central

https://github.com/glowroot/glowroot/wiki/Central-Collector-Installation

4.

Glowroot Collector Agent

https://github.com/glowroot/glowroot/wiki/Agent-Installation-(for-Central-Collector)

 

MUST READ:

https://liferay.dev/blogs/-/blogs/setting-up-glowroot-apm

https://glowroot.org/