Difference between revisions of "KTCPVS HHTTP"

From LVSKB
Jump to: navigation, search
m
m
 
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
  
The hhttp scheduler in KTCPVS is to assign jobs to servers according to the
+
The hhttp scheduler in [[KTCPVS]] is to assign jobs to servers according to the
 
specified content-based scheduling rules, in which regular expression
 
specified content-based scheduling rules, in which regular expression
 
matches are hashed and the virtual server is selected based on the
 
matches are hashed and the virtual server is selected based on the
Line 8: Line 8:
 
== Using the KTCPVS HHTTP scheduler ==
 
== Using the KTCPVS HHTTP scheduler ==
  
In the following example, ktcpvs is used to forward requests to different users
+
In the following example, [[KTCPVS]] [[load balancer]] is used to forward requests to different users
 
web pages /users/<username>/.* to different web servers, in which
 
web pages /users/<username>/.* to different web servers, in which
 
server is selected based on the hash value of username. The tcpvsadm
 
server is selected based on the hash value of username. The tcpvsadm

Latest revision as of 03:35, 14 October 2006

Introduction

The hhttp scheduler in KTCPVS is to assign jobs to servers according to the specified content-based scheduling rules, in which regular expression matches are hashed and the virtual server is selected based on the resulting hash value.

Using the KTCPVS HHTTP scheduler

In the following example, KTCPVS load balancer is used to forward requests to different users web pages /users/<username>/.* to different web servers, in which server is selected based on the hash value of username. The tcpvsadm commands are as follows:

 tcpvsadm -A -i web -s hhttp
 tcpvsadm -a -i web -r 192.168.0.10:80
 tcpvsadm -a -i web -r 192.168.0.11:80
 tcpvsadm -a -i web -r 192.168.0.12:80
 
 tcpvsadm --add-rule -i web --pattern="/users/([^/]+)/.*" -m 1 -r 192.168.0.10:80
 tcpvsadm --add-rule -i web --pattern="/users/([^/]+)/.*" -m 1 -r 192.168.0.11:80
 tcpvsadm --add-rule -i web --pattern="/users/([^/]+)/.*" -m 1 -r 192.168.0.12:80

Here, the option -m 1 in tcpvsadm command means the first matched parameter in the request URI for regular expression. The scheduler computes the hash value of the first matched parameter and dispatch request to the ith server, in which i is its hash value % the server number.

The configuration file of this settting is as follows:

Virtual web {
   listen = 0.0.0.0:webcache
   scheduler = hhttp
   startservers = 8
   maxclients = 256
   minspareservers = 6
   maxspareservers = 18
   server = 192.168.0.12:www 1
   server = 192.168.0.11:www 1
   server = 192.168.0.10:www 1
   rule = pattern "/users/([^/]+)/.*" match 1 use server 192.168.0.12:www
   rule = pattern "/users/([^/]+)/.*" match 1 use server 192.168.0.11:www
   rule = pattern "/users/([^/]+)/.*" match 1 use server 192.168.0.10:www
}