Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing new features to IoTDB JVM GC options #12088

Merged
merged 10 commits into from
Mar 22, 2024

Conversation

Pengzna
Copy link
Collaborator

@Pengzna Pengzna commented Feb 27, 2024

Description

We have recently investigated some GC options. Based on the product scenarios of IoTDB, we have selected some general JVM GC options. For options that are completely beneficial and harmless, we plan to directly add them to the default startup options of IoTDB; For options that are only beneficial in some specific scenarios, we plan to add them to default startup options through comments and explain their usage. Please review~

  1. Directly added options:

-Xss512k: This option is intended to optimize the memory occupied bythreads. The default value is 1m. Based on our research and actual usage scenarios of iotdb, we suggest that the thread stack size of 512k is sufficient. Many online business systems also set up in this way.

-XX:+UnlockDiagnosticVMOptions: Used to unlock some diagnostic JVM options, such as -XX:GuaranteedSafepointInterval. This option itself has no direct impact on performance.

-XX:+SafepointTimeout -XX:SafepointTimeoutDelay=1000: These two options will monitor the waiting time of the jvm threads in safepoint. If it exceeds 1000ms, the state of the corresponding threads will be printed to the log to help us troubleshoot the problem of too long safepoint stw time.

-XX:GuaranteedSafepointInterval=0: Disable scheduled safepoint tasks. In high concurrency scenarios of IoTDB, it is not necessary to enter the safepoint regularly, but may cause additional overhead.

-XX:-UseBiasedLocking: Disable biased lock. In high concurrency scenarios of IoTDB, biased locks are basically useless and have negative effects with safepoints. In fact, biased locking has been disabled by default since JDK15.

-XX:+UseAdaptiveSizePolicy: Turn on GC adaptive tuning(Ergonomics)

  1. Added through comments:

-XX:+UseCountedLoopSafepoints: Prevent the delay in entering the safepoint caused by large bounded loops from causing the GC STW time to be too long. Please note: it may have an impact on JIT's black-box optimization.

-XX:+ParallelRefProcEnabled: Turn on parallel processing of Reference objects in GC process. This option may help if particularly long reference processing times are observed in the GC logs. Please note: because this option consumes thread resources, it may have an impact on application's throughput.

CPU_PROCESSOR_NUM=$(nproc) -XX:ParallelGCThreads=${CPU_PROCESSOR_NUM}:Set the processing thread of parallel gc to the number of machine CPU cores. Please note: When the GC time is too long, if there are remaining CPU resources, you can try to increase this option. Although this will occupy application thread resources, but because the GC
becomes faster, it will have minor impact on the application. If CPU resources have reached a bottleneck, increasing this option may make application slower even if it makes the GC faster.

-XX:+AlwaysPreTouch: Force the operating system to allocate all memory in advance when the JVM starts, so that all heap areas are allocated physical memory. It can reduce the overhead caused by memory allocation, page fault interrupts, etc. during JVM operation. In some large memory scenarios, we have observed about 10% improvement in throughput with this option. Please note: The use of this option will cause the JVM to start slower. At the same time, the physical memory usage of iotdb will reach the maximum heap memory immediately after JVM startup, which may reduce memory utilization and trigger OOM killer when memory is tight.

Besides, we have added options that can provide richer GC log information, which is commented by default.

Note:In addition to linux, we have also adapted scripts to windows and macOS


This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious
    for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold
    for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Copy link
Contributor

@OneSizeFitsQuorum OneSizeFitsQuorum left a comment

Choose a reason for hiding this comment

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

LGTM

@OneSizeFitsQuorum OneSizeFitsQuorum merged commit 8c044fc into apache:master Mar 22, 2024
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants