Skip to content

Commit 17f946e

Browse files
authored
Allow JMX debug (#536)
1 parent 165dbb3 commit 17f946e

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ Configurable properties :
115115
| `logging.structured.format.console` | `` | Format for structured logging. Valid values : `ecs`, `gelf`, `logstash`. Leave empty for no structured logging (default). See https://docs.spring.io/spring-boot/reference/features/logging.html#features.logging.structured |
116116
| `springdoc.swagger-ui.path` | `/` | Open API (swagger) UI path |
117117
| `springdoc.swagger-ui.oauth.clientId` | `` | clientid used by swagger to authenticate the user, in general the same which is used by onyxia-ui is ok. |
118+
| `DEBUG_JMX` | `` | Enable JMX monitoring. This is useful for profiling the app to improve performance but is not intended for production / daily use. Once enabled (`true`), use `kubectl port-forward` + a profiler (e.g VisualVM) to profile the app. |
119+
| `JMX_PORT` | `10000` | Port used by JMX if enabled. |
118120

119121
## Onyxia API dependency to Helm
120122

onyxia-api/entrypoint.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ if [[ -n "$CACERTS_DIR" ]]; then
1313
fi
1414

1515
# Run application
16-
java org.springframework.boot.loader.launch.JarLauncher
16+
if [ -n "$DEBUG_JMX" ]; then
17+
JMX_PORT="${JMX_PORT:-10000}"
18+
java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=127.0.0.1 org.springframework.boot.loader.launch.JarLauncher
19+
else
20+
java org.springframework.boot.loader.launch.JarLauncher
21+
fi

0 commit comments

Comments
 (0)