[prev in list] [next in list] [prev in thread] [next in thread] 

List:       keepalived-devel
Subject:    [Keepalived-devel] PATCH: Add Support for Upper & Lower Connection
From:       "Nick Couchman" <Nick.Couchman () seakr ! com>
Date:       2006-08-28 13:46:50
Message-ID: 44F29F6A.C7B6.0099.1 () seakr ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I don't know how useful this patch will be, and I'm sure it isn't as
efficient as it could be (my programming skills leave a lot to be
desired!), but attached is a patch that adds support in keepalived for
LVS real server upper and lower thresholds.  This allows you to set a
minimum and maximum number of connections to each real server using the
"uthreshold" (maximum) and "lthreshold" (minimum) options in the
real_server section of the configuration file.  I needed this
functionality as I'm trying to use keepalived as a connection broker for
my VMware VDI setup and need to limit the number of connections per real
server (VM) to 1. 


Sorry if the formatting is a bit off from the normal way of doing
things, as well... 


Nick Couchman
Systems Integrator
SEAKR Engineering, Inc.
6221 South Racine Circle
Centennial, CO 80111
Main: (303) 790-8499
Fax: (303) 790-8720
Web: http://www.seakr.com





[Attachment #5 (text/html)]

<html>
  <head>
    <style type="text/css">
      <!--
        body { line-height: normal; margin-bottom: 1px; margin-left: 4px; \
font-variant: normal; margin-right: 4px; margin-top: 4px }  p { margin-bottom: 0; \
                margin-top: 0 }
      -->
    </style>
    
  </head>
  <body content="text/html; charset=WINDOWS-1252" http-equiv="Content-Type">
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">I don&#39;t know how useful this patch will \
be&#44; and I&#39;m sure it isn&#39;t as efficient as it could be &#40;my programming \
skills leave a lot to be desired&#33;&#41;&#44; but attached is a patch that adds \
support in keepalived for LVS real server upper and lower thresholds.&nbsp;&#160;This \
allows you to set a minimum and maximum number of connections to each real server \
using the &quot;uthreshold&quot; &#40;maximum&#41; and &quot;lthreshold&quot; \
&#40;minimum&#41; options in the real_server section of the configuration \
file.&nbsp;&#160;I needed this functionality as I&#39;m trying to use keepalived as a \
connection broker for my VMware VDI setup and need to limit the number of connections \
per real server &#40;VM&#41; to 1.</font>    </p>  <p style="margin-bottom: 0; \
margin-top: 0">  <br>
          </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">Sorry if the formatting is a bit off from the \
normal way of doing things&#44; as well...</font>    </p>  <p style="margin-bottom: \
0; margin-top: 0">  <br>
          </p>
    <p style="margin-bottom: 0; margin-top: 0">
      Nick&#160;Couchman<br>Systems&#160;Integrator<br>SEAKR&#160;Engineering&#44;&#16 \
0;Inc.<br>6221&#160;South&#160;Racine&#160;Circle<br>Centennial&#44;&#160;CO&#160;8011 \
1<br>Main:&#160;&#40;303&#41;&#160;790-8499<br>Fax:&#160;&#40;303&#41;&#160;790-8720<br>Web:&#160;<a \
href="http://www.seakr.com">http://www.seakr.com</a><br><br><br><br>  </p>
  </body>
</html>


["threshold.patch" (text/plain)]

diff -Naur keepalived-1.1.12/CONTRIBUTORS keepalived-1.1.13/CONTRIBUTORS
--- keepalived-1.1.12/CONTRIBUTORS	2005-02-14 15:28:19.000000000 -0700
+++ keepalived-1.1.13/CONTRIBUTORS	2006-08-22 10:02:02.000000000 -0600
@@ -20,3 +20,6 @@
 Kevin Lindsay, <kevinl@netnation.com> :
 	o Fixed shadowed declaration reported by -Wshadow.
 	o Redesigned signal handling.
+
+Nick Couchman, <nick.couchman at seakr.com> :
+	o Patch for u_threshold and l_threshold support.
diff -Naur keepalived-1.1.12/keepalived/check/check_parser.c \
                keepalived-1.1.13/keepalived/check/check_parser.c
--- keepalived-1.1.12/keepalived/check/check_parser.c	2006-03-09 06:39:02.000000000 \
                -0700
+++ keepalived-1.1.13/keepalived/check/check_parser.c	2006-08-22 09:55:23.000000000 \
-0600 @@ -181,6 +181,22 @@
 	real_server *rs = LIST_TAIL_DATA(vs->rs);
 	rs->weight = atoi(VECTOR_SLOT(strvec, 1));
 }
+#ifdef _KRNL_2_6_
+static void
+uthreshold_handler(vector strvec)
+{
+	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server *rs = LIST_TAIL_DATA(vs->rs);
+	rs->u_threshold = atoi(VECTOR_SLOT(strvec, 1));
+}
+static void
+lthreshold_handler(vector strvec)
+{
+	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+	real_server *rs = LIST_TAIL_DATA(vs->rs);
+	rs->l_threshold = atoi(VECTOR_SLOT(strvec, 1));
+}
+#endif
 static void
 inhibit_handler(vector strvec)
 {
@@ -236,6 +252,10 @@
 	install_keyword("real_server", &rs_handler);
 	install_sublevel();
 	install_keyword("weight", &weight_handler);
+#ifdef _KRNL_2_6_
+	install_keyword("uthreshold", &uthreshold_handler);
+	install_keyword("lthreshold", &lthreshold_handler);
+#endif
 	install_keyword("inhibit_on_failure", &inhibit_handler);
 	install_keyword("notify_up", &notify_up_handler);
 	install_keyword("notify_down", &notify_down_handler);
diff -Naur keepalived-1.1.12/keepalived/check/ipvswrapper.c \
                keepalived-1.1.13/keepalived/check/ipvswrapper.c
--- keepalived-1.1.12/keepalived/check/ipvswrapper.c	2006-03-09 06:39:23.000000000 \
                -0700
+++ keepalived-1.1.13/keepalived/check/ipvswrapper.c	2006-08-22 08:16:28.000000000 \
-0600 @@ -601,6 +601,8 @@
 	memset(drule, 0, sizeof (struct ip_vs_dest_user));
 
 	drule->weight = 1;
+	drule->u_threshold = 0;
+	drule->l_threshold = 0;
 	drule->conn_flags = vs->loadbalancing_kind;
 	strncpy(srule->sched_name, vs->sched, IP_VS_SCHEDNAME_MAXLEN);
 	srule->netmask = ((u_int32_t) 0xffffffff);
@@ -624,6 +626,8 @@
 			drule->weight = rs->weight;
 			drule->addr = SVR_IP(rs);
 			drule->port = SVR_PORT(rs);
+			drule->u_threshold = rs->u_threshold;
+			drule->l_threshold = rs->l_threshold;
 		}
 	}
 }
@@ -693,6 +697,8 @@
 				drule->weight = rs->weight;
 				drule->addr = SVR_IP(rs);
 				drule->port = SVR_PORT(rs);
+				drule->u_threshold = rs->u_threshold;
+				drule->l_threshold = rs->l_threshold;
 			}
 
 			/* Set vs rule */
diff -Naur keepalived-1.1.12/keepalived/include/check_data.h \
                keepalived-1.1.13/keepalived/include/check_data.h
--- keepalived-1.1.12/keepalived/include/check_data.h	2006-03-09 06:40:27.000000000 \
                -0700
+++ keepalived-1.1.13/keepalived/include/check_data.h	2006-08-22 09:54:03.000000000 \
-0600 @@ -83,6 +83,11 @@
 	int alive;
 	list failed_checkers;	/* List of failed checkers */
 	int set;		/* in the IPVS table */
+
+#ifdef _KRNL_2_6_
+	uint32_t u_threshold;	/* Upper connection limit. */
+	uint32_t l_threshold;	/* Lower connection limit. */
+#endif
 } real_server;
 
 /* Virtual Server group definition */



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Keepalived-devel mailing list
Keepalived-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/keepalived-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic