You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zy...@apache.org on 2013/02/03 11:38:37 UTC

[4/5] git commit: TS-1006: Make InkFreeList memory pool configurable

TS-1006: Make InkFreeList memory pool configurable

Introduce four configurable parameters in records.config file, which will
be used to control debug information and adjust the behavior of reclaimable
InkFreeList memory pool:

* proxy.config.allocator.debug_filter
  Dump debug information according bit mask of debug_filter, if a bit is set
  in the mask, then debug information of the corresponding action are dumped:
   bit 0: reclaim memory in ink_freelist_new
   bit 1: allocate memory from partial-free Chunks(if exist) or OS

* proxy.config.allocator.enable_reclaim
  The value of enable_reclaim should be 0 or 1. Default 0, reclaim disabled.

* proxy.config.allocator.reclaim_factor
  The value of reclaim_factor should be in 0.0 ~ 1.0, allocator use it to
  calculate average value of idle memory in InkFreeList, which will determine
  when to reclaim memory. The larger the value, the faster the reclaiming.
  This flag is effective only when enable_reclaim is set.

* proxy.config.allocator.max_overage
  Allocator will reclaim memory only when it continuously satisfy the reclaim
  condition for max_overage times. This flag is effective only when
  enable_reclaim is set.

Signed-off-by: Yunkai Zhang <qi...@taobao.com>
Signed-off-by: Zhao Yongming <mi...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bdd796c1
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bdd796c1
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bdd796c1

Branch: refs/heads/master
Commit: bdd796c18f17efae03c0a8aa3fd48a8727803b77
Parents: 795e50d
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Sat Jan 19 23:53:43 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sun Feb 3 11:22:05 2013 +0800

----------------------------------------------------------------------
 mgmt/RecordsConfig.cc                  |   14 ++++++++++++++
 proxy/config/records.config.default.in |   26 ++++++++++++++++++++++++++
 proxy/http/HttpConfig.cc               |    7 +++++++
 3 files changed, 47 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdd796c1/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index c940852..f731944 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1889,6 +1889,20 @@ RecordElement RecordsConfig[] = {
 
   //############
   //#
+  //# Using for Reclaimable InkFreeList memory pool
+  //#
+  //############
+  {RECT_CONFIG, "proxy.config.allocator.debug_filter", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, "[0-1]", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.allocator.max_overage", RECD_INT, "10", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.allocator.enable_reclaim", RECD_INT, "1", RECU_NULL, RR_NULL, RECC_NULL, "[0-1]", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.allocator.reclaim_factor", RECD_FLOAT, "0.3", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
+
+  //############
+  //#
   //# Eric's super cool remap processor
   //#
   //############

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdd796c1/proxy/config/records.config.default.in
----------------------------------------------------------------------
diff --git a/proxy/config/records.config.default.in b/proxy/config/records.config.default.in
index 30aebab..ea74ade 100644
--- a/proxy/config/records.config.default.in
+++ b/proxy/config/records.config.default.in
@@ -597,6 +597,32 @@ CONFIG proxy.config.dump_mem_info_frequency INT 0
 
 ##############################################################################
 #
+# Configuration for Reclaimable InkFreeList memory pool
+#
+# NOTE: The following options are not meaningful unless compiles TrafficServer
+#	with '--enable-reclaimable-freelist' option. Looks like:
+#	$ ./configure --enable-reclaimable-freelist
+#
+##############################################################################
+  # Dump debug information according bit mask of debug_filter, if a bit is set
+  # in the mask, then debug information of the corresponding action are dumped:
+  #  bit 0: reclaim memory in ink_freelist_new
+  #  bit 1: allocate memory from partial-free Chunks(if exist) or OS
+CONFIG proxy.config.allocator.debug_filter INT 0
+  # The value of enable_reclaim should be 0 or 1. Default 0, reclaim disabled.
+CONFIG proxy.config.allocator.enable_reclaim INT 0
+  # The value of reclaim_factor should be in 0.0 ~ 1.0, allocator use it to
+  # calculate average value of idle memory in InkFreeList, which will determine
+  # when to reclaim memory. The larger the value, the faster the reclaiming.
+  # This value is effective only when enable_reclaim is 1.
+CONFIG proxy.config.allocator.reclaim_factor FLOAT 0.300000
+  # Allocator will reclaim memory only when it continuously satisfy the reclaim
+  # condition for max_overage times. This value is effective only when
+  # enable_reclaim is 1.
+CONFIG proxy.config.allocator.max_overage INT 3
+
+##############################################################################
+#
 # Slow Log
 #
 ##############################################################################

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdd796c1/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 3273d89..d955964 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1139,6 +1139,13 @@ HttpConfig::startup()
   RecHttpLoadIp("proxy.local.incoming_ip_to_bind", c.inbound_ip4, c.inbound_ip6);
   RecHttpLoadIp("proxy.local.outgoing_ip_to_bind", c.outbound_ip4, c.outbound_ip6);
 
+#if TS_USE_RECLAIMABLE_FREELIST
+  HttpEstablishStaticConfigLongLong(cfg_debug_filter, "proxy.config.allocator.debug_filter");
+  HttpEstablishStaticConfigLongLong(cfg_enable_reclaim, "proxy.config.allocator.enable_reclaim");
+  HttpEstablishStaticConfigLongLong(cfg_max_overage, "proxy.config.allocator.max_overage");
+  HttpEstablishStaticConfigFloat(cfg_reclaim_factor, "proxy.config.allocator.reclaim_factor");
+#endif
+
   HttpEstablishStaticConfigLongLong(c.server_max_connections, "proxy.config.http.server_max_connections");
   HttpEstablishStaticConfigLongLong(c.oride.server_tcp_init_cwnd, "proxy.config.http.server_tcp_init_cwnd");
   HttpEstablishStaticConfigLongLong(c.oride.origin_max_connections, "proxy.config.http.origin_max_connections");