8000 Implement memory detection override. by neunhoef · Pull Request #11268 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Implement memory detection override. #11268

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CHANGELOG and fix.
  • Loading branch information
neunhoef committed Mar 13, 2020
commit 3ae3375f0a7bf1eedcdee80f955f02ed66dff4ce
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
devel
-----

* Allow to override the detected total amount of memory via an environment
variable ARANGODB_OVERRIDE_DETECTED_TOTAL_MEMORY.

* Supervision to clean up zombie servers after 24h, if no
responsibility for shards.

Expand Down
15 changes: 9 additions & 6 deletions lib/ApplicationFeatures/EnvironmentFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,6 @@ void EnvironmentFeature::prepare() {
if (res == 0) {
double swapSpace = static_cast<double>(info.totalswap);
double ram = static_cast<double>(PhysicalMemory::getValue());
std::string overriddenmsg;
if (PhysicalMemory::overridden()) {
overriddenmsg = " (overridden by environment variable)";
}
LOG_TOPIC("25362", INFO, Logger::MEMORY)
<< "Available physical memory: " << ram << overriddenmsg;
double rr = (ram >= swapSpace) ? 100.0 * ((ram - swapSpace) / ram) : 0.0;
if (static_cast<double>(r) < 0.99 * rr) {
LOG_TOPIC("b0a75", WARN, Logger::MEMORY)
Expand All @@ -252,6 +246,15 @@ void EnvironmentFeature::prepare() {
// file not found or value not convertible into integer
}

// Report memory found:
uint64_t ram = PhysicalMemory::getValue();
std::string overriddenmsg;
if (PhysicalMemory::overridden()) {
overriddenmsg = " (overridden by environment variable)";
}
LOG_TOPIC("25362", INFO, Logger::MEMORY)
<< "Available physical memory: " << ram << overriddenmsg;

// test local ipv6 support
try {
if (!basics::FileUtils::exists("/proc/net/if_inet6")) {
Expand Down
0