Profiling Java applications in quaternets

I want to profile the application to play on my Kubernetes cluster.

I am using VisualVM, and the steps I took are as follows:

  • Image built on the latest version of ubuntu
  • Launching my game application with the following arguments:

    "-Dcom.sun.management.jmxremote",
    "-Dcom.sun.management.jmxremote.ssl=false",
    "-Dcom.sun.management.jmxremote.authenticate=false",
    "-Dcom.sun.management.jmxremote.port=1098"
    
  • My image has apt-get install -y visualvm

  • I do kubectl port-forward <Container> 1098
  • Open VisualVM and I do not see this process.

I'm not sure what I'm doing wrong here. When I run the application on localhost (not through the IDE, right from the script launch), everything works fine.

Update 1, Deployment and Maintenance

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: myApp
  labels:
    name: myApp
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      name: myApp
      labels:
        name: myApp
    spec:
      containers:
      - name: myApp
        image: ...
        args: ["-Dcom.sun.management.jmxremote", "-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.port=1098"]
        ports:
        - containerPort: 9000
        env:
        ...
apiVersion: v1
kind: Service
metadata:
  name: myApp
  labels:
    name: myApp
spec:
  selector:
    name: myApp
  ports:
    - port: 80
      targetPort: 9000

Update 2 @marcospereira

File-> Add JMX Connection-> localhost: 1098

Unable to connect to localhost: 1098 using jmx: rmi service ...

+4

Source: https://habr.com/ru/post/1667139/


All Articles