CPU & Memory Consuming Freak Java Application
1-1: Download the application
In this portion of the lab, you will be starting the Freak Java application to consume CPU and Memory of your system to be monitored through Instana.
Download this zip file [cpu-memory-freak.zip] and unzip it on the same platform where Instana Host Agent is installed. Use the “java -jar {jar file} {arg}” command to execute this application.
1-2: Start CPU consuming freak
Before starting the Freak Java application make sure your Java is setup.
To start the CPU Consuming Freak Java application, run following command. Argument 'c' is for CPU consumption.
$ java -jar cpu-memory-freak.jar c
Accept all defaults (y/N)? :
If you want to accept the default input - press key 'y'.
Accept all defaults (y/N)? :y
Here is the output with default values.
[.] Consume my CPU as a freak. [.] Number of threads (Min: 1, Max: 10) [Only Integer]:2 [.] Life span of each threads (Min: 60 seconds, Max: 1200 seconds) [Only Integer]:120
But if you want to have custom input press key 'n'.
Accept all defaults (y/N)? :n
It will ask to enter number of threads you want for this process (Min: 1, Max: 10).
[.] Number of threads (Min: 1, Max: 10) [Only Integer]:
Provide an integer value between 1 and 10.
Next, it will ask the life span of each threads (Min: 60 seconds, Max: 1200 seconds).
[.] Life span of each threads (Min: 60 seconds, Max: 1200 seconds) [Only Integer]:200
Provide an integer value between 60 and 1200.
Finally, it will display the selected values.
[.] Consume my CPU (y/N)? :y [.] Number of threads (Min: 1, Max: 10) :5 [.] Life span of each threads (Min: 60 seconds, Max: 1200 seconds) :600
And the application continues to run and consume the high CPU.
Press ctrl+c to stop the application.
1-3: Start memory consuming freak
Before starting the Freak Java application make sure your Java is setup.
To start the Memory Consuming Freak Java application, run following command. Argument 'm' is for memory consumption.
$ java -jar cpu-memory-freak.jar m
Accept all defaults (y/N)? :
If you want to accept the default input - press key 'y'.
Accept all defaults (y/N)? :y
Here is the output with default values.
[.] Consume my memory as a freak. [.] Number of threads (Min: 1, Max: 10) [Only Integer]:2 [.] Maximum memory per thread [MB] (Min: 1 MB, Max: 500 MB) [Only Integer]:100 [.] Memory per hit/ incremental value [MB] (Min: 1 MB, Max: <= Maximum memory per thread) [Only Integer]:50 [.] Interval between each hit (Min: 1 second, Max: 300 seconds) [Only Integer]:2
But if you want to have custom input press key 'n'.
Accept all defaults (y/N)? :n
It will ask to enter number of threads you want for this process (Min: 1, Max: 10).
[.] Number of threads (Min: 1, Max: 10) [Only Integer]:
Provide an integer value between 1 and 10.
Next, it will ask maximum memory to be used by each thread in MB (Min: 1 MB, Max: 500 MB) .
[.] Maximum memory per thread [MB] (Min: 1 MB, Max: 500 MB) [Only Integer]:
Provide an integer value between 1 and 500.
Next, it will ask for memory to be increased in every hit.
[.] Memory per hit/ incremental value [MB] (Min: 1 MB, Max: <= Maximum memory per thread) [Only Integer]:
Provide an integer value between 1 and maximum memory per thread.
Last, it asks for time lapse between each hits.
[.] Interval between each hit (Min: 1 second, Max: 300 seconds) [Only Integer]:
Provide an integer value between 1 and 300.
Finally, it will display the selected values.
[.] Consume my memory (y/N)? :y [.] Number of threads (Min: 1, Max: 10) :5 [.] Maximum memory per thread [MB] (Min: 1 MB, Max: 500 MB):250 [.] Memory per hit/ incremental value [MB] (Min: 1 MB, Max: <= Maximum memory per thread) :100 [.] Interval between each hit (Min: 1 second, Max: 300 seconds) :150
And the application continues to run and consume the high memory.
Press ctrl+c to stop the application.