Skip to content

Conversation

lhotari
Copy link
Member

@lhotari lhotari commented Sep 29, 2024

Motivation

-client and -server JVM args have been deprecated in Java for a very long time. Pulsar CLI tools currently add -client argument. This causes some OpenJDK distributions to fail:

❯ docker run --rm -it bellsoft/liberica-runtime-container:jdk-17-cds-stream-glibc java -client
Unrecognized option: -client
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Modifications

  • remove the unnecessary -client argument.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Some OpenJDK distributions fail:
Unrecognized option: -client
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
@lhotari lhotari added this to the 4.0.0 milestone Sep 29, 2024
@lhotari lhotari requested review from merlimat and nodece September 29, 2024 07:54
@lhotari lhotari changed the title [fix][client] Remove deprecated "-client" JVM arg [fix][cli] Remove deprecated "-client" JVM arg Sep 29, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Sep 29, 2024
@lhotari
Copy link
Member Author

lhotari commented Sep 29, 2024

Claude AI response to question "what is the difference in starting java with "java -client" or "java -server" in Java 17 ?":

Difference between "java -client" and "java -server" in Java 17

In Java 17, there is no functional difference between starting Java with java -client or java -server. These flags are essentially deprecated and ignored. Here's a breakdown of the historical context and current situation:

Historical Context

  • In earlier Java versions (pre-Java 8):
    • -client: Used a JIT compiler optimized for faster startup and lower memory usage
    • -server: Used a JIT compiler optimized for better long-term performance

Changes in Java 8 and Later

  • JVM automatically chooses the most appropriate compiler mode
  • Introduction of Tiered Compilation, combining benefits of both client and server compilers

Java 17 Behavior

  • -client and -server flags are ignored
  • Tiered Compilation is used by default, balancing startup time and long-term performance

Current Best Practices

  • Avoid using -client or -server flags in Java 17
  • Let the JVM optimize performance automatically
  • For performance tuning, explore other JVM flags and options specific to Java 17

In conclusion, for Java 17, starting with java -client or java -server produces identical results, as both flags are treated the same way by the JVM and are effectively deprecated.

Copy link
Member

@nodece nodece left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Oracle Java Runtime Environment (JRE) 8 and earlier, different implementations of the JVM, (the client VM, server VM, and minimal VM) were supported for configurations commonly used as clients, as servers, and for embedded systems. Because most systems can now take advantage of the server VM, only that VM implementation is provided in later versions.

https://docs.oracle.com/en/java/javase/21/vm/java-virtual-machine-technology-overview.html

@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.52%. Comparing base (bbc6224) to head (c5f12af).
⚠️ Report is 1245 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23370      +/-   ##
============================================
+ Coverage     73.57%   74.52%   +0.94%     
- Complexity    32624    33967    +1343     
============================================
  Files          1877     1934      +57     
  Lines        139502   145132    +5630     
  Branches      15299    15870     +571     
============================================
+ Hits         102638   108154    +5516     
+ Misses        28908    28686     -222     
- Partials       7956     8292     +336     
Flag Coverage Δ
inttests 27.75% <ø> (+3.16%) ⬆️
systests 24.51% <ø> (+0.18%) ⬆️
unittests 73.88% <ø> (+1.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 601 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Technoboy- Technoboy- merged commit f071a89 into apache:master Sep 29, 2024
54 of 58 checks passed
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants