From: Woo Xie Date: Tue, 28 Apr 2015 22:25:31 +0000 (-0700) Subject: Dynmaic load shedding X-Git-Tag: v0.37.0~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=37624c1f29756ef40e49233fceeddf3790dab6cd;p=folly.git Dynmaic load shedding Summary: add a free system memory limit to Load Shed Configuration for dynamic shedding Test Plan: tested on edge241.01.ams3, works as expected. Once the free memory is less than 23G (picked on purpose for testing), new connections are shedded. But the shedding rate is totally wrong. I will explain and address it in another diff. https://fburl.com/103620501 https://fburl.com/103620701 Reviewed By: afrind@fb.com Subscribers: trunkagent, fugalh, bmatheny, nimishshah, folly-diffs@, jsedgwick, yfeldblum, chalfant, xning, alexkr FB internal diff: D2026477 Tasks: 4604893 Signature: t1:2026477:1430176828:65eadd82efa3189a1bebcb8518efaf56cd36beed --- diff --git a/folly/wangle/acceptor/LoadShedConfiguration.h b/folly/wangle/acceptor/LoadShedConfiguration.h index a7eb85ca..57c51b97 100644 --- a/folly/wangle/acceptor/LoadShedConfiguration.h +++ b/folly/wangle/acceptor/LoadShedConfiguration.h @@ -87,6 +87,16 @@ class LoadShedConfiguration { } double getMaxCpuUsage() const { return maxCpuUsage_; } + /** + * Set/get the minium actual free memory on the system. + */ + void setMinFreeMem(uint64_t min) { + minFreeMem_ = min; + } + uint64_t getMinFreeMem() const { + return minFreeMem_; + } + void setLoadUpdatePeriod(std::chrono::milliseconds period) { period_ = period; } @@ -99,6 +109,7 @@ class LoadShedConfiguration { AddressSet whitelistAddrs_; NetworkSet whitelistNetworks_; uint64_t maxConnections_{0}; + uint64_t minFreeMem_{0}; double maxMemUsage_; double maxCpuUsage_; std::chrono::milliseconds period_;