You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by il...@apache.org on 2020/12/28 11:23:55 UTC
[ignite] branch master updated: IGNITE-13680 Improve OS suggestions
for Linux - Fixes #8503.
This is an automated email from the ASF dual-hosted git repository.
ilyak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 1e7f957 IGNITE-13680 Improve OS suggestions for Linux - Fixes #8503.
1e7f957 is described below
commit 1e7f95732ffc6da07f5e9db295d7ec8bac280410
Author: shubin <ny...@gmail.com>
AuthorDate: Mon Dec 28 13:13:30 2020 +0300
IGNITE-13680 Improve OS suggestions for Linux - Fixes #8503.
Signed-off-by: Ilya Kasnacheev <il...@gmail.com>
---
.../suggestions/OsConfigurationSuggestions.java | 38 +++++++++++-----------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/suggestions/OsConfigurationSuggestions.java b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/OsConfigurationSuggestions.java
index 695b423..e9d04ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/suggestions/OsConfigurationSuggestions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/OsConfigurationSuggestions.java
@@ -60,28 +60,28 @@ public class OsConfigurationSuggestions {
public static synchronized List<String> getSuggestions() {
List<String> suggestions = new ArrayList<>();
- if (U.isRedHat()) {
- String value;
- String expected = "500";
+ if (U.isLinux()) {
+ Integer val;
+ int exp = 500;
- boolean dwcParamFlag = (value = readVmParam(DIRTY_WRITEBACK_CENTISECS)) != null && !value.equals(expected);
- boolean decParamFlag = (value = readVmParam(DIRTY_EXPIRE_CENTISECS)) != null && !value.equals(expected);
+ boolean dwcParamFlag = (val = readVmParam(DIRTY_WRITEBACK_CENTISECS)) != null && val > exp;
+ boolean decParamFlag = (val = readVmParam(DIRTY_EXPIRE_CENTISECS)) != null && val > exp;
if (dwcParamFlag || decParamFlag)
suggestions.add(String.format("Speed up flushing of dirty pages by OS " +
- "(alter %s%s%s parameter%s by setting to %s)",
+ "(alter %s%s%s parameter%s by setting to %d)",
(dwcParamFlag ? "vm." + DIRTY_WRITEBACK_CENTISECS : ""),
(dwcParamFlag && decParamFlag ? " and " : ""),
(decParamFlag ? "vm." + DIRTY_EXPIRE_CENTISECS : ""),
(dwcParamFlag && decParamFlag ? "s" : ""),
- expected));
+ exp));
- if ((value = readVmParam(SWAPPINESS)) != null) {
+ if ((val = readVmParam(SWAPPINESS)) != null) {
try {
- double maxSwappiness = 10.0;
+ int maxSwappiness = 10;
- if (Float.parseFloat(value) > maxSwappiness)
- suggestions.add(String.format("Reduce pages swapping ratio (set vm.%s=%f or less)", SWAPPINESS,
+ if (val > maxSwappiness)
+ suggestions.add(String.format("Reduce pages swapping ratio (set vm.%s=%d or less)", SWAPPINESS,
maxSwappiness));
}
catch (NumberFormatException ignored) {
@@ -89,13 +89,13 @@ public class OsConfigurationSuggestions {
}
}
- if ((value = readVmParam(ZONE_RECLAIM_MODE)) != null && !value.equals(expected = "0"))
- suggestions.add(String.format("Disable NUMA memory reclaim (set vm.%s=%s)", ZONE_RECLAIM_MODE,
- expected));
+ if ((val = readVmParam(ZONE_RECLAIM_MODE)) != null && val > (exp = 0))
+ suggestions.add(String.format("Disable NUMA memory reclaim (set vm.%s=%d)", ZONE_RECLAIM_MODE,
+ exp));
- if ((value = readVmParam(EXTRA_FREE_KBYTES)) != null && !value.equals(expected = "1240000"))
- suggestions.add(String.format("Avoid direct reclaim and page allocation failures (set vm.%s=%s)",
- EXTRA_FREE_KBYTES, expected));
+ if ((val = readVmParam(EXTRA_FREE_KBYTES)) != null && val < (exp = 1240000))
+ suggestions.add(String.format("Avoid direct reclaim and page allocation failures (set vm.%s=%d)",
+ EXTRA_FREE_KBYTES, exp));
}
return suggestions;
@@ -105,14 +105,14 @@ public class OsConfigurationSuggestions {
* @param name Parameter name.
* @return Value (possibly null).
*/
- @Nullable private static String readVmParam(@NotNull String name) {
+ @Nullable private static Integer readVmParam(@NotNull String name) {
try {
Path path = Paths.get(VM_PARAMS_BASE_PATH + name);
if (!Files.exists(path))
return null;
- return readLine(path);
+ return Integer.parseInt(readLine(path));
}
catch (Exception ignored) {
return null;