KTCPVS

KTCPVS stands for Kernel TCP Virtual Server. It implements application-level load balancing inside the Linux kernel, so called Layer-7 switching. Since the overhead of layer-7 switching in user-space is very high, it is good to implement it inside the kernel in order to avoid the overhead of context switching and memory copying between user-space and kernel-space. Although the scalability of KTCPVS is lower than that of IPVS (IP Virtual Server), it is flexible, because the content of request is known before the request is redirected to one server.

The system implementation of KTCPVS is illustrated in the following figure.

The kernel threads are used to parse the content of requests, forward them to backend servers according to scheduling rules, and relay data between client and server. The user-space program tcpvsadm is to administrator KTCPVS, it can write the virtual server rules inside the kernel through setsockopt, and read the KTCPVS rules through getsockopt or /proc file system.

At the current stage, we would like to hear some of your feedbacks and suggestions, so that we can work on it in the right direction.

The draft warning below is quite old. [ I have to warn you that this is very very draft code, which I first wrote in May 2000 in order to prove the concept. However, I hadn't touched this code for near one year, but I don't want to see that it becomes garbage, so I release this very very draft code, in order to push myself get time to work on it. :) ]

There are a lot of work to do, such as interface redesign, the correct way to handle requests in the kernel, logging, comparing the server architecture (which one is good, apache-like architecture or event-driven architecture). If you are interested in the development, you are very welcome, hopefully we will make it a useful one in the near future.

Documentation

See the community-contributed KTCPVS documentation at LVS Knowledge Base or the README inside the ktcpvs source code tar ball.

Download

The ChangeLog is available here.

Source code via Subversion

What's Subversion? Subversion is a system for revision control, and is designed to be a modern replacement of CVS. Start at subversion.tigris.org to learn more and read the Subversion Book.

To browse around or download a few individual files, click http://svn.linuxvirtualserver.org/repos/ktcpvs/.

To check out the sources, you need to be running Subversion client. For example, you can enter the following commands for checking out the latest source code of ktcpvs:

svn co http://svn.linuxvirtualserver.org/repos/ktcpvs/trunk/ ktcpvs

To check out the latest stable 0.0.xx source code of ktcpvs, need to use the branch "ktcpvs-0-0-stable" in the Subversion checkout command.

svn co http://svn.linuxvirtualserver.org/repos/ktcpvs/branches/ktcpvs-0-0-stable/ ktcpvs

Once you've checked out a copy of the source tree, you can update your source tree at any time so it is in sync with the latest one by running the command:

svn update

If you make some changes of the source code, please generate the diff file and submit it to the mailing list or sent it to me for inclusion.

svn diff

Developers

The current developers of KTCPVS are as follows (in alphabetical order by last name):

  • Hai Long   < david_lung at yahoo dot com >
  • Wensong Zhang   < wensong at linux-vs dot org >