0

I am trying to deploy an Apache-Jmeter (version 5.1.1), a stand-alone application on Pivotal cloud Foundry but unable to

I have the Apache-Jmeter (version 5.1.1) set-up running on my windows machine so I tried to push that directory/folder to PCF as an App but it failed with the below error

C:\Program Files\apache-jmeter-5.1.1>cf push apache-jmeter-5.1.1

Pushing from manifest to org dev-testing/ space Dev as user1...
Using manifest file C:\Program Files\apache-jmeter-5.1.1\manifest.yml
Getting app info...

readat C:\Program Files\apache-jmeter-5.1.1\bin\jmeter.bat: negative offset
FAILED

Here is my manifest.yml file looks like :

---
applications:
- name: jmeter-5-1-pcf
  path: bin/jmeter.bat
  memory: 512m
  instances: 1

I should be able to run my Jmeter scripts (I mean test.jmx) from Pivotal Cloud Foundry, also It could be good if I can see the UI of Apache-Jmeter which was deployed on Pivotal Cloud Foundry

phani
  • 65
  • 1
  • 6

1 Answers1

2

OK, easy answer first.

readat C:\Program Files\apache-jmeter-5.1.1\bin\jmeter.bat: negative offset FAILED

It's failing because that's a Windows bat file, and you're trying to run it on Linux. You would want to run the .sh start script, and make sure you're pushing the .tgz download from the JMeter Binaries page.


Beyond that, it gets murky and depends on what exactly you want to run?

You could simply run jmeter from the command line, like here. In that case, you don't have a persistent running server though, which poses a problem because Cloud Foundry expects your app to run forever.

You could work around this by using a task instead. You would need to push JMeter as an app, let it stage then stop the app. After that you could cf run-task to execute jmeter -n -t plan.jmx ....

The other option would be to try and run JMeter remote, but that's not going to work well because JMeter uses Java RMI, which is not HTTP based so it would require use of Cloud Foundry TCP routes, or copious use of cf ssh to make tunnels. Neither are great options.

I would suggest using the cf cli. A quick test, the following worked for me.

  1. Download the .tgz binary release from JMeter's web site.
  2. Add the following .cfignore file. It just skips stuff you don't need.

    NOTICE
    LICENSE
    README.md
    docs
    printable_docs
    licenses
    extras
    
  3. Add a file .profile. This will set a couple env variables to make JMeter work.

    export JAVA_HOME=.java-buildpack/open_jdk_jre/
    export PATH=$PATH:$JAVA_HOME/bin
    
  4. Put your .jmx files into the JMeter directory.

  5. Then run cf push -b java_buildpack -m 1G -c 'sleep 9999' -u process --no-route jmeter-cli.
  6. The app should start and do nothing, immediately run cf stop jmeter-cli. You just need to do this so that the app stages.
  7. Then run cf run-task jmeter-cli './bin/jmeter -n -t your-test.jmx'.
  8. Run cf logs --recent jmeter-cli and see the results. Or run cf logs jmeter-cli in a second terminal and stream them as the task runs.

Example output:

   2019-09-08T22:06:35.72-0400 [CELL/0] OUT Cell e5f61515-c164-4c36-9686-faa2a0a363ed creating container for instance 29a1deb6-04c1-4105-91f8-0a8a5dadf367
   2019-09-08T22:06:36.56-0400 [CELL/0] OUT Cell e5f61515-c164-4c36-9686-faa2a0a363ed successfully created container for instance 29a1deb6-04c1-4105-91f8-0a8a5dadf367
   2019-09-08T22:06:41.18-0400 [APP/TASK/4e6e54e6/0] ERR Sep 09, 2019 2:06:41 AM java.util.prefs.FileSystemPreferences$1 run
   2019-09-08T22:06:41.18-0400 [APP/TASK/4e6e54e6/0] ERR INFO: Created user preferences directory.
   2019-09-08T22:06:41.61-0400 [APP/TASK/4e6e54e6/0] OUT Creating summariser <summary>
   2019-09-08T22:06:41.61-0400 [APP/TASK/4e6e54e6/0] OUT Created the tree successfully using Test Google.jmx
   2019-09-08T22:06:41.61-0400 [APP/TASK/4e6e54e6/0] OUT Starting the test @ Mon Sep 09 02:06:41 UTC 2019 (1567994801615)
   2019-09-08T22:06:41.63-0400 [APP/TASK/4e6e54e6/0] OUT Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
   2019-09-08T22:06:43.66-0400 [APP/TASK/4e6e54e6/0] OUT summary =     30 in 00:00:02 =   19.9/s Avg:    99 Min:    60 Max:   450 Err:     0 (0.00%)
   2019-09-08T22:06:43.66-0400 [APP/TASK/4e6e54e6/0] OUT Tidying up ...    @ Mon Sep 09 02:06:43 UTC 2019 (1567994803664)
   2019-09-08T22:06:43.66-0400 [APP/TASK/4e6e54e6/0] OUT ... end of run
   2019-09-08T22:06:44.39-0400 [APP/TASK/4e6e54e6/0] OUT Exit status 0

The only other thing to mention is that you can use the -l option and write the output to a JTL file. If you do that, it will write to the local file system and when your task ends that file will disappear, you won't be able to get it.

If you need to write the results to a JTL file, then you will also need to modify the task command that you run to, upon completion of JMeter, upload the results file to persistent storage like S3.

Hope that helps!

Daniel Mikusa
  • 13,716
  • 1
  • 22
  • 28