我要评分
获取效率
正确性
完整性
易理解

Enabling the JBooster Feature

Introduction

  • A single cloud application instance is often allocated with few resources, and elastic scaling is frequently performed. The startup speed of a typical JVM application is especially slow in such scenarios.
  • CPU resources required by a cloud application are determined by the load at application startup and the load when the application is running stably (or the load during peak hours).
  • Through data sharing and remote compilation, JBooster can accelerate application startup, reduce CPU usage, speed up elastic scaling, and cuts cloud application deployment costs.

Application Scenario

Application startup takes a long time due to limited CPU resources, long class loading time, or long compile time.

Restrictions

  • JBooster is available only in BiSheng JDK 17.
  • The client and server are deployed in the same trusted zone. Users need to ensure communication security.
  • Ahead of Time (AOT) compilation on the server requires the ld instruction.

    If openEuler is used, run the following command to install ld:

    yum install binutils

How to Use

  1. Start the JBooster server.

    After the server is started, the message "The JBooster server is ready!" is displayed. When using the JBooster server, ensure that the server is started and cannot be stopped manually. If you need to run other commands, start another window.

    $JAVA_HOME/bin/jbooster --server-port=24567

    Run the jbooster --help command to view available parameters.

    $JAVA_HOME/bin/jbooster --help
  2. Build an application package.

    This section uses spring-petclinic-*.*.*-SNAPSHOT.jar as an example. The build process depends on the Maven tool. Ensure that Maven has been installed in the build environment.

    Build spring-petclinic-*.*.*-SNAPSHOT.jar based on https://github.com/spring-projects/spring-petclinic?tab=readme-ov-file#run-petclinic-locally.
    git clone https://github.com/spring-projects/spring-petclinic.git
    cd spring-petclinic
    mvn package -DskipTests=true

    After the build is successful, a JAR package named spring-petclinic-*.*.*-SNAPSHOT.jar is generated in the ./target folder. The version number of the JAR package varies with the code repository.

  3. Start the client.

    If the client is started for the first time, generate an acceleration package. Specify the server address in JBoosterAddress and the port number in JBoosterPort. Ensure that the port number is the same as that specified in --server-port. After spring-petclinic-3.2.0.jar is started, the "(process running for X.XXX)" log is printed, where X.XXX indicates the startup time.

    $JAVA_HOME/bin/java -XX:+UnlockExperimentalVMOptions -XX:+UseJBooster -XX:JBoosterAddress=127.0.0.1 -XX:JBoosterPort=24567 -jar ./target/spring-petclinic-*.*.*-SNAPSHOT.jar

    If you start this client again using the same startup commands, the log output shows that the startup time is reduced.