WASdev / websphere-liberty-operator

Deploy and manage containerized Liberty applications on Kubernetes. Documentation: https://ibm.biz/wlo-docs
Apache License 2.0
9 stars 4 forks source link

Integration with Semeru Cloud Compiler (JITServer) #205

Closed leochr closed 1 year ago

leochr commented 2 years ago

Utilize the JITServer to run Liberty applications

Related Epic: JITServer integration for Liberty operator #27586

Per discussion with Graham on 2022/09/14, WebSphere Liberty operator is the priority over OL.

Blog about how JIT Server works: https://developer.ibm.com/articles/jitserver-optimize-your-java-cloud-native-applications/

malincoln commented 2 years ago

Requires design approval

jgawor commented 2 years ago

This may already be documented somewhere else but I'm adding my notes on deploying JITServer and an application connecting to the JITServer in OCP using the existing operator. This is based on https://developer.ibm.com/tutorials/using-openj9-jitserver-in-kubernetes/.

JITServer deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: jitserver
  labels:
    app: jitserver
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: jitserver
  replicas: 1
  template:
    metadata:
      labels:
        app: jitserver
    spec:
      containers:
      - name: jitserver
        image: docker.io/ibm-semeru-runtimes:open-17-jre-focal
        imagePullPolicy: IfNotPresent
        # Instruct the OpenJ9 JVM to start in server mode
        args: ["jitserver"]
        ports:
        - containerPort: 38400
        resources:
          requests:
            memory: "500Mi"
            cpu: "500m"
          limits:
            memory: "1000Mi"
            cpu: "8000m"
        env:
        - name: OPENJ9_JAVA_OPTIONS
          value: "-XX:+JITServerLogConnections"
---
apiVersion: v1
kind: Service
metadata:
  # A client connects to this endpoint
  name: jitserver
spec:
  selector:
    app: jitserver
  ports:
    - protocol: TCP
      port: 38400
      targetPort: 38400
  sessionAffinity: ClientIP
  sessionAffinityConfig:
    clientIP:
      timeoutSeconds: 86400

WebSphereLibertyApplication:

apiVersion: liberty.websphere.ibm.com/v1
kind: WebSphereLibertyApplication
metadata:
  name: ferret-restore
spec:
  license:
    accept: true
    edition: IBM WebSphere Application Server
    productEntitlementSource: Standalone
    metric: Processor Value Unit (PVU)
  applicationImage: image-registry.openshift-image-registry.svc:5000/jconf/sample-ferret:fast
  manageTLS: false
  expose: true
  pullPolicy: IfNotPresent
  replicas: 1
  resources: {}
  env:
  - name: OPENJ9_JAVA_OPTIONS
    value: "-XX:+UseJITServer -XX:JITServerAddress=jitserver -XX:+JITServerLogConnections"
leochr commented 2 years ago

Standing up an instance of JITServer and connecting the application to it is quite simple. But here are some considerations (and questions) that I have from the initial investigation to understand how JITServer works and how to best integrate it with Liberty operator.

1) version compatibility: JIT server and client must match. We need to identify the client version (from the application) and spin up a JIT server that is compatible.

2) JIT Server side cache

2) Security: specify the private key and the certificate at the server and use the certificate at the client

3) Resource allocation: how to determine the default resources (cpu/memory) to allocate to JITServer instance?

4) Auto scaling of JIT Server.

5) Configuration: