How to profile the UBOS Personal Data Mesh web application
This doesn’t currently work as we still run on JDK 11 and NetBeans only bundles support for 15 and 16. Once we have fixed this, we need to revisit these instructions.
Something is taking a long time or lots of memory in the web application. You would like to run it in a profiler.
- you run your Java profiler client (e.g. in an IDE like NetBeans) on your host
- you run the UBOS Personal Data Mesh in a Linux container
in a setup similar to the Developer tutorials for UBOS Mesh.
If you only run one JSVC-based Java app on your device/container
(That’s probably true for you.)
Set up NetBeans
(The NetBeans GUI is really terrible about this flow.)
- Select Profile / Attach to External Process
- Click the “Configuration Session” in the toolbar
- Select “Attach” in the toolbar
- Select profile “Manually started remote Java process”
- Enter your container’s hostname or IP address, and select your OS and JVM
- Select “create a Remote profiling pack” from Step 2, and save it (a ZIP file) to a directory that is mounted into your Linux container.
- Inside the container, unpack the generated ZIP file.
- Inside the container, run
Modify the way the UBOS Mesh web application is run
/etc/diet4j/diet4j-jsvc-defaults.conf. This file contains
the defaults for running a JSVC daemon with
diet4j. It contains
a commented-out section for JAVA_OPTS (default content for debugging).
For activating the Java profiler for all diet4j/JSVC processes, the line should read:
Determine the right AppConfigId and restart the daemon
First, determine the AppConfigId of your UBOS Personal Data Mesh web application, such as by executing:
% ubos-admin listsites --detail * (s5f9a9cb99c115fd53e6de326d68eeddd12d1b623) : <root> (a33ac4a6a39c003d9c92aea5491f71fd172acfdf8) app: ubos-mesh-underbars-mysql customizationpoint: fullappname: UBOS Personal Data Mesh customizationpoint: shortappname: UBOS Mesh customizationpoint: usehistory: 1 customizationpoint: useindex: 1 accessory: ubos-mesh-model-amazon accessory: ubos-mesh-model-facebook ...
Look for the hexadecimal identifier that starts with
a. Here it is
a33ac4a6a39c003d9c92aea5491f71fd172acfdf8. This is the instance id for
the systemd service to restart, like this:
% sudo systemctl restart email@example.com
Replace the instance id with the AppConfigId from your deployment.