KTCPVS HHTTP
From LVSKB
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 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
The configuration file 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 }