Difference between revisions of "KTCPVS HHTTP"

From LVSKB
Jump to: navigation, search
m
m
Line 21: Line 21:
 
   tcpvsadm --add-rule -i web --pattern="/users/([^/]+)/.*" -m 1 -r 192.168.0.12: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 i''th'' server, in which i is its hash value % the server number.
+
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 i''th'' server, in which '''i''' is its hash value % the server number.
  
 
The configuration file of this settting is as follows:
 
The configuration file of this settting is as follows:

Revision as of 15:08, 27 May 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 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
}