lunedì 4 gennaio 2016

How to Create a CPU Resource Consumption Manager in WLS 12.2.1 and How to Test it on a Domain Partition

You have learned :
Now we will create a RCM (Resource Consumption Manager) on a Domain Partition and we will test it using JMeter.

In this post we will:

- download & install JMeter
- create a RCM
- assign a RCM to a Domain Partition (Resource Sharing)
- use Java Mission Control to monitor Cpu & Heap
- test the RCM with JMeter

To use RCM we have already setted, in this POST, the required parameters:
“-XX:+UnlockCommercialFeatures -XX:+ResourceManagement -XX:+UseG1GC”

Download JMeter from HERE:

You can download it directly from your browser inside the Oracle Linux VM (if you are connected on Internet), or if you have already it you can use the Shared Dir as discribed in my previuos post:

In the next image you can see how to connect your Oracle Linux VM to the LAN and from where download JMeter:

If you have downloaded JMeter from the VM, you can find the file into the Downloads directory.

Create a directory named TestMaterial under /home/weblogic/Oracle
Move the JMeter file from /home/weblogic/Downloads dir into /home/weblogic/Oracle/TestMaterial dir:

Extrat JMeter into TestMaterial Dir:

Download the following two files that I have prepared for the RCM Test:
- TestApp.war
- TestWlsRCMCpu.jmx

Put these files into TestMaterial directory:

Deploy and Activate TestApp.war on Domain Parition dp1.
In THIS post I have explained how to deploy an App on a Domain Partition.

Now we can proceed with the creation of a Resource Consumption Manager (RCM)
Select WebLogic Domain->Environment->Resource Consumption Managers:

Lock & Edit:

Click on Add resource Manager:

We will test in this post the consumption of the CPU (later we will test, also, the Heap Memory):

I would like to obtain a Notify trigger if the average, in a time interval,  of the consumprtion of the CPU in a domain partition is around the 10%:

Now we must assign this RCM to a specific Domain Partition:

Select Domain Partition dp1:

Now you can select Domain Partition->Administration->Resource Sharing:

Select "Use a resource manager configured for the domain" and select your RCM, then click on Save:

Activate Changes:

We are ready to test our CPU RCM on Domain Partition dp1, but to do this we need to:

- monitor cpu utilization in Domain Partition 1 on a Managed Server
- verify in the Log file if appear the Notify string
- use JMeter to generate traffic calling TestApp.

Inside TestApp there is a cpu.jsp that each time is invoked, it calculate the first 42 number of Fibonacci and consume a lot of cpu.

To monitor the CPU utilization on a specific Managed Server we can use Java Mission Control.
You can found JMC under the bin directory of your JDK:

Start jmc:

Close the Welcome Page:

We want to test the CPU  RCM on dp1 on MTCluster-1, so we must found the correct JVM, to do this select a jvm and click on Start JMX Console:

Click on System tab:

Insert weblogic.Name in the Filter Column, if you find MTCluste-1, you have choose the correct JVM :) (if not ... try with other jvm)

Now is time to start JMeter:

We want to load TestWlsRCMCpu.jmx file inside JMeter, so click on File->Open:

Select your TestWlsRCMCpu.jmx then click on Open:

This file is already configured for our Demo, will start 10 Threads in 30 seconds (1 thread each 3 seconds) so for around 30 seconds we will have cpu consumption.

We need to consume, in a single domain partition, an averageof  the 10% of cpu to enable the Notify Trigger.

Remember: as described in RCM Oracle Documentation:
Measurements of Retained Heap and CPU Utilization are performed asynchronously and hence do not represent "current" (a "point-in-time") value.

We will point JMeter to only a Managed Server on dp1, MTCluster-1 (localhost:7101) so we will receive the Notify trigger only in his MTCluster-1.log file:

We will call the cpu.jsp file inside TestApp.war on dp1 on MTCluster-1:

Now we need to monitor the log file to verify that we receive the Notify trigger, so open MTCluster-1.log with the command tail -f MTCluster-1.log:

In the next image you can see:

- JMeter with TestWlsRCMCpu.jmx file loaded
- JMC with JMX console opened on MTCuster-1 JVM
- a Terminal with the "tail -f" of the MTCluster-1.log

If you click on the start icon of JMeter, you will start the Test:

As you can see during the test the CPU is around the 80%:

The test will finish in around 30 seconds and,remember that RCM is asynchronous, if you wait (around other 30 seconds) you will receive the Notify Trigger in the MTCluster-1.log.

Nessun commento:

Posta un commento