Here are the instructions to enable YourKit Java Profiler configuration to Java applications on Cloud Foundry.
1. Enable the JBP_CONFIG_YOUR_KIT_PROFILER
environment variable. This can be done by editing application manifest.yml
or invoking the "cf set-env
" command. In this article, we use the application manifest as an example.
--- applications: - name: <APP_NAME> memory: 512M instances: 1 path: path/java-app.war env: JBP_CONFIG_YOUR_KIT_PROFILER: '{enabled: true}'
2. Set up SSH tunnel for YourKit Java Profiler:
cf ssh -N -T -L 10001:localhost:10001 <APP_NAME>
Once the SSH tunnel has been created, YourKit Java Profiler should connect to localhost:10001
for debugging. Please refer to the detailed instructions at Java Buildpack YourKit Profiler Framework .
Enabling the YourKit Java Profiler will very likely make the application startup time increase. In case the application fails to start due to timeout, we suggest setting "-t 180
" to push the application start timeout to the max.
The instructions are only useful in Diego-based containers with SSH access enabled. Diego was introduced in PCF v1.6.x and turns to be mandatory in v1.7.x. Additionally, the remote monitoring/debugging feature is only available in Java Buildpack v3.4+.
PCF is not a development platform; you can use it, but it is going to be slow. Users should develop software locally and treat PCF as a deployment target. PCF Dev is provided to set up a compact PCF on the local machine for development/debugging use.