You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/01/13 11:01:45 UTC

[GitHub] [ignite] Vladsz83 opened a new pull request #8660: JVM options to ducktape tests

Vladsz83 opened a new pull request #8660:
URL: https://github.com/apache/ignite/pull/8660


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559587355



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):

Review comment:
       Fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559479801



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       'Python dict is hash table
   
   >>> a = {'-Xmx': '4G', '-Xmx': '10G'}
   >>> a
   {'-Xmx': '10G'}'
   
   Yes, but in case of -Xmx and only keys works: 'Xmx4G' : None. Values are for '=' params




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r557308982



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \

Review comment:
       It is not a good idea to use "one liner" construction (`val1 if cond1 else val2`) for multi-line construction.
   simple
   ```
   gd_dump = "
   if gc_dump_path:
      gc_dump_path = '....'
   ```
   is more readable.

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.

Review comment:
       Not really good name for input param. Merge is a verb, noun is preferrable.

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):

Review comment:
       `None` is treated as `False`, so `kwargs.get("as_map")` is enough

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)

Review comment:
       Not a good idea to name this `as_map`. It clashes with input param, it have different type, than input param.
   code is not readable and easy understandable.

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       As for me, this function is useless. It's result is non-determenistic. 
   For example
   ```
   >>> a = {"-Xmx":"123", "-xmx":"234", "-xMx":"345"}
   >>>_remove_duplicates(a)
   >>>a
   {'-xMx': '345'}
   ```
   And I suppose that this problem really is not a problem at all :). I can hardly believe, that someone add param
   '-xMx'
   
   

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \

Review comment:
       Same as above

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):

Review comment:
       There is no need to set default value, `None` is treated like `False`

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):

Review comment:
       same as above

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]

Review comment:
       ```
   as_list = []
   for param, value in as_map.items():
        if value:
             as_list.append(f"{param}={value}")
        else:
             as_list.append(param)
   ```
   is a way more readable.

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:

Review comment:
       ```
   for elem in params:
        param_val = elem.split(sep="=", maxsplit=1)
        as_map[param_val[0]] = param_val[1] if len(param_val) > 1 else None
   ```
   is a way more readable.
   BTW Why you always convert strings to strings?

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):

Review comment:
       There is no need to set default value, `None` is treated like `False`

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,

Review comment:
       Not a good name for function. Function name must tell about what it actually do.

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)

Review comment:
       list is already iterable




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r558371545



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Python `dict` is hash table
   ```
   >>> a = {'-Xmx': '4G', '-Xmx': '10G'}
   >>> a
   {'-Xmx': '10G'}
   >>> 
   ```
   So you should also check for correctness of -Xmx and leave only correct values
   UPD:
   ```
   a = {'-Xmx1G': None, '-xMx10G': None}
   _remove_duplicates(a)
   a
   {'-xMx10G': None}
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r561858404



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Why only Xmx and Xms are on the agenda?
   How about -da and -ea? _remove_duplicates will do nothing in this case.
   
   Also, AFAIU we have generic params set, and we may merge it with something. The strategy seems odd to me. 
   
   As for me, we should append params from generic's set to user's set in they are missed in user's, but this also does not solve the -da/-ea problem.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r562484083



##########
File path: modules/ducktests/tests/checks/utils/check_tools.py
##########
@@ -0,0 +1,112 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+Checks JVM settings.
+"""
+
+from ignitetest.services.utils.jvm_utils import create_jvm_settings, merge_jvm_settings, DEFAULT_HEAP
+
+
+class CheckJVMSettings:

Review comment:
       Could we rename the file (check-tools.py) to make clear it's about JVM settings?

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,124 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+DEFAULT_HEAP = "768M"
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def create_jvm_settings(heap_size=DEFAULT_HEAP, gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC,
+                        gc_dump_path=None, oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param opts: JVM options to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = ""
+    if gc_dump_path:
+        gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M -XX:+PrintGCDateStamps " \
+                  "-verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path
+
+    out_of_mem_dump = ""
+    if oom_path:
+        out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("opts")
+
+    if to_merge or kwargs.get("as_map"):
+        return merge_jvm_settings(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list"):
+        return as_string.split()
+
+    return as_string

Review comment:
       Seems, everywhere (for create_jvm_settings and merge_jvm_settings) we have the result returned as a list.
   Do we really need to have this returned as a map and string?
   My vote is, as always, for minimalism and simplification instead of premature complexion.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559528297



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559483866



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)

Review comment:
       ```
   if isinstance(params, list):
           params = iter(params)
   ```
   Please remove it




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559478243



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)

Review comment:
       Yes, but strin needs splitting instead of iterating by single char




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r558330390



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):

Review comment:
       Fixed

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):

Review comment:
       Fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r558371545



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Python `dict` is hash table
   ```
   >>> a = {'-Xmx': '4G', '-Xmx': '10G'}
   >>> a
   {'-Xmx': '10G'}
   >>> 
   ```
   So you should not convert to lowercase I suppose, current implementation is wrong, examples provided 
   
   UPD:
   ```
   a = {'-Xmx1G': None, '-xMx10G': None}
   _remove_duplicates(a)
   a
   {'-xMx10G': None}
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r558371545



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Python `dict` is hash table
   ```
   >>> a = {'-Xmx': '4G', '-Xmx': '10G'}
   >>> a
   {'-Xmx': '10G'}
   >>> 
   ```
   So you should not convert to lowercase I suppose, current implementation is wrong, examples provided 
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r558371545



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Python `dict` is hash table
   ```
   >>> a = {'-Xmx': '4G', '-Xmx': '10G'}
   >>> a
   {'-Xmx': '10G'}
   >>> 
   ```
   So you should not convert to lowercase I suppose, current implementation is wrong, examples provided 
   
   UPD:
   ```
   >>> a = {'-Xmx': '4G', '-Xmx': '10G'}
   >>> a
   {'-Xmx': '10G'}
   >>> 
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559504269



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       I suppose not =lowering is enough. Fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559479801



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       'Python dict is hash table
   
   >>> a = {'-Xmx': '4G', '-Xmx': '10G'}
   >>> a
   {'-Xmx': '10G'}'
   
   Yes, but in case of '-Xmx' and only keys works: {'-Xmx4G' : None}. The values are for '=' params




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559504016



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:

Review comment:
       Already fixed.

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)

Review comment:
       Fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559511586



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Ok, but you can do it in one iteration.
   
   ```
    duplicates = {"-Xmx": False,  "-Xms": False}
   
   for param_key in list(params.keys()):
        for dup_key in duplicates.keys():
              if param_key.startswith(dup_key):
                  if duplicates[dup_key]:
                       del params[param_key]
                  else:
                      duplicates[dup_key] = True
                 
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r558353575



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       We have two params -Xmx in the test. Default and set for IgniteApplication for example. They both appear. This func. keeps last added.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r558330028



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \

Review comment:
       Fixed

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.

Review comment:
       Fixed

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,

Review comment:
       Fixed

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):

Review comment:
       Fixed

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \

Review comment:
       Fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559478808



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:

Review comment:
       "Why you always convert strings to strings?" Where?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r561858404



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Why only Xmx and Xms are on the agenda?
   How about -da and -ea? _remove_duplicates will do nothing in this case.
   
   Also, AFAIU we have generic params set, and we may merge it with something. The strategy seems odd to me. 
   
   As for me, we should append params from generic's set to user's set in they are missed in user's, but this also does not solve the -da/-ea problem.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r561864323



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       We have default params and we wont to rewrite them sometimes.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r561863956



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Because memory setting is critical and conflicts. We use default values and reset then. But this method is to resolve all options conflicts. Not intended to resolve them all in this ticket.

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       We have default params and we wont to rewrite them sometimes.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559484478



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:

Review comment:
       ```
   as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559483866



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)

Review comment:
       ```
   if isinstance(params, list):
           params = iter(params)
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] anton-vinogradov merged pull request #8660: IGNITE-14038 : Separate JVM settings in the ducktests.

Posted by GitBox <gi...@apache.org>.
anton-vinogradov merged pull request #8660:
URL: https://github.com/apache/ignite/pull/8660


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r562514645



##########
File path: modules/ducktests/tests/checks/utils/check_tools.py
##########
@@ -0,0 +1,112 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+Checks JVM settings.
+"""
+
+from ignitetest.services.utils.jvm_utils import create_jvm_settings, merge_jvm_settings, DEFAULT_HEAP
+
+
+class CheckJVMSettings:

Review comment:
       Fixed

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,124 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+DEFAULT_HEAP = "768M"
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def create_jvm_settings(heap_size=DEFAULT_HEAP, gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC,
+                        gc_dump_path=None, oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param opts: JVM options to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = ""
+    if gc_dump_path:
+        gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M -XX:+PrintGCDateStamps " \
+                  "-verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path
+
+    out_of_mem_dump = ""
+    if oom_path:
+        out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("opts")
+
+    if to_merge or kwargs.get("as_map"):
+        return merge_jvm_settings(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list"):
+        return as_string.split()
+
+    return as_string

Review comment:
       Fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559590239



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]

Review comment:
       Fixed

##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)

Review comment:
       Fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559483507



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Yes, I got it, but see an example -- _remove_duplicates can leave incorrect results and remove correct.
   So you need add additional conditions.
   
   That's why I asked you to add unit tests. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559485891



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)

Review comment:
       ```
   if isinstance(params, dict):
           return params
   
   if isinstance(params, str):
           params = params.split()
   ```
   Thats it
   
      




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r559478243



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)

Review comment:
       Yes, but string needs splitting instead of iterating by single char




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Vladsz83 commented on a change in pull request #8660: JVM options to ducktape tests

Posted by GitBox <gi...@apache.org>.
Vladsz83 commented on a change in pull request #8660:
URL: https://github.com/apache/ignite/pull/8660#discussion_r561863956



##########
File path: modules/ducktests/tests/ignitetest/services/utils/jvm_utils.py
##########
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains JVM utilities.
+"""
+
+JVM_PARAMS_GC_CMS = "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalMode " \
+                    "-XX:ConcGCThreads=$(((`nproc`/4)>1?(`nproc`/4):1)) " \
+                    "-XX:ParallelGCThreads=$(((`nproc`/2)>1?(`nproc`/2):1)) " \
+                    "-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly " \
+                    "-XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled"
+
+JVM_PARAMS_GC_G1 = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 " \
+                   "-XX:ConcGCThreads=$(((`nproc`/3)>1?(`nproc`/3):1)) " \
+                   "-XX:ParallelGCThreads=$(((`nproc`*3/4)>1?(`nproc`*3/4):1)) "
+
+JVM_PARAMS_GENERIC = "-server -da -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+AlwaysPreTouch " \
+                     "-XX:+ParallelRefProcEnabled -XX:+DoEscapeAnalysis " \
+                     "-XX:+OptimizeStringConcat -XX:+UseStringDeduplication"
+
+
+def jvm_settings(heap_size="768M", gc_settings=JVM_PARAMS_GC_CMS, generic_params=JVM_PARAMS_GENERIC, gc_dump_path=None,
+                 oom_path=None, **kwargs):
+    """
+    Provides settings string for JVM process.
+    param as_list: Represent JVM params as list.
+    param as_map: Represent JVM params as dict.
+    param merge: JVM Params to merge. Adds new or rewrites default values. Can be dict, list or string.
+    """
+    gc_dump = "-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M " \
+              "-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:" + gc_dump_path \
+        if gc_dump_path else ""
+
+    out_of_mem_dump = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=" + oom_path \
+        if oom_path else ""
+
+    as_string = f"-Xmx{heap_size} -Xms{heap_size} {gc_settings} {gc_dump} {out_of_mem_dump} {generic_params}".strip()
+
+    to_merge = kwargs.get("merge")
+
+    if to_merge or kwargs.get("as_map", False):
+        return jvm_settings_merge(as_string, to_merge if to_merge else {}, **kwargs)
+
+    if kwargs.get("as_list", False):
+        return as_string.split()
+
+    return as_string
+
+
+def jvm_settings_merge(src_settings, additionals, **kwargs):
+    """
+    Merges two JVM settings.
+    :param src_settings: base settings. Can be dict, list or string.
+    :param additionals: params to add to or overwrite in src_settings. Can be dict, list or string.
+    param as_list: If True, represents result as list.
+    param as_map: If True, represents result as dict.
+    :return merged JVM settings. By default as string.
+    """
+    as_map = _to_map(src_settings)
+
+    as_map.update(_to_map(additionals))
+
+    _remove_duplicates(as_map)
+
+    if kwargs.get("as_map", False):
+        return as_map
+
+    as_list = [e[0] + '=' + e[1] if len(e) > 0 and e[1] else e[0] for e in as_map.items()]
+
+    if kwargs.get("as_list", False):
+        return as_list
+
+    return ' '.join(as_list)
+
+
+def _to_map(params):
+    """"""
+    if isinstance(params, dict):
+        return params
+
+    if isinstance(params, list):
+        params = iter(params)
+    else:
+        params = str(params).split()
+
+    as_map = {}
+
+    for key_val in [entry.split(sep='=', maxsplit=1) for entry in params]:
+        as_map[str(key_val[0])] = str(key_val[1]) if len(key_val) > 1 else None
+
+    return as_map
+
+
+def _remove_duplicates(params: dict):

Review comment:
       Because memory setting is critical and conflicts. We use default values and reset then. But this method is to resolve all options conflicts. Not intended to resolve them all in this ticket.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org