Introducing new features to IoTDB JVM GC options #12088
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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~
-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)
-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:
for an unfamiliar reader.
for code coverage.