Skip to content

Commit

Permalink
added downstream_conn_max config parsing
Browse files Browse the repository at this point in the history
Change-Id: Icef738e732eae3b1205bcdfb50d59b8da6e4c2f6
Reviewed-on: http://review.northscale.com/2400
Reviewed-by: Jayesh Jose <jjose@zynga.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
  • Loading branch information
steveyen committed Sep 14, 2010
1 parent 481f960 commit 739a491
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions agent_stats.c
Expand Up @@ -455,6 +455,7 @@ static void proxy_stats_dump_behavior(ADD_STAT add_stats,

if (level >= 1) {
APPEND_PREFIX_STAT("downstream_max", "%u", b->downstream_max);
APPEND_PREFIX_STAT("downstream_conn_max", "%u", b->downstream_conn_max);
}

APPEND_PREFIX_STAT("downstream_weight", "%u", b->downstream_weight);
Expand Down
2 changes: 2 additions & 0 deletions cproxy.h
Expand Up @@ -96,6 +96,8 @@ struct proxy_behavior {
//
uint32_t cycle; // IL: Clock resolution in millisecs.
uint32_t downstream_max; // PL: Downstream concurrency.
uint32_t downstream_conn_max; // PL: Max # of conns per thread
// and per host_ident.
uint32_t downstream_weight; // SL: Server weight.
uint32_t downstream_retry; // SL: How many times to retry a cmd.
enum protocol downstream_protocol; // SL: Favored downstream protocol.
Expand Down
4 changes: 4 additions & 0 deletions cproxy_config.c
Expand Up @@ -43,6 +43,7 @@ int cproxy_init_mcmux_mode(int proxy_port,
proxy_behavior behavior_default_g = {
.cycle = 0,
.downstream_max = 4,
.downstream_conn_max = 4,
.downstream_weight = 0,
.downstream_retry = 1,
.downstream_protocol = proxy_downstream_ascii_prot,
Expand Down Expand Up @@ -606,6 +607,8 @@ void cproxy_parse_behavior_key_val(char *key,
behavior->cycle = strtol(val, NULL, 10);
} else if (wordeq(key, "downstream_max")) {
behavior->downstream_max = strtol(val, NULL, 10);
} else if (wordeq(key, "downstream_conn_max")) {
behavior->downstream_conn_max = strtol(val, NULL, 10);
} else if (wordeq(key, "weight") ||
wordeq(key, "downstream_weight")) {
behavior->downstream_weight = strtol(val, NULL, 10);
Expand Down Expand Up @@ -787,6 +790,7 @@ void cproxy_dump_behavior_ex(proxy_behavior *b, char *prefix, int level,
}
if (level >= 1) {
vdump("downstream_max", "%u", b->downstream_max);
vdump("downstream_conn_max", "%u", b->downstream_conn_max);
}

vdump("downstream_weight", "%u", b->downstream_weight);
Expand Down
1 change: 1 addition & 0 deletions doc/moxi/configuration.org
Expand Up @@ -240,6 +240,7 @@ Some of the valid keys are (circa 2009/06)...

uint32_t cycle; // IL: Clock resolution in millisecs.
uint32_t downstream_max; // PL: Downstream concurrency.
uint32_t downstream_conn_max; // PL: Max # of conns per thread per host_ident.
uint32_t downstream_weight; // SL: Server weight.
uint32_t downstream_retry; // SL: How many times to retry a cmd.
enum protocol downstream_protocol; // SL: Favored downstream protocol.
Expand Down

0 comments on commit 739a491

Please sign in to comment.