KTCPVS CHTTP

From LVSKB
Revision as of 05:18, 30 July 2006 by Wensong (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

CHTTP is a KTCPVS content-based scheduling module for cookie-based HTTP service. It supports both persistent HTTP and HTTP State Management Mechanism.

CHTTP scheduler will parse header of every http request received and extract session information in it, then select the right backend server with session information, and redirect the http message to the server. If there is no such a session, CHTTP will direct request to a backend server according to content-based scheduling rules. When the backend server starts a session, CHTTP will inject a session cookie in the response to the client, so that any further requests from the client will be sent to the backend server for this session.

Architecture

The following diagram depicts the function modules for CHTTP.

KTCPVS-CHTTP-Module.jpg

HTTP transfer engine is responsible to read http lines from client socket and relay http data between HTTP client and backend server.

HTTP parser engine implements a simple HTTP parser. It parses http request lines, http status lines, http mime headers, and store parsed information in http requests or http responses.

Session manager is used to support HTTP state management mechanism. It stores the cookies received from backend servers and maintains session table and cookie table for HTTP clients and backend servers.

Scheduler is the core component of CHTTP. It coordinates other components. Scheduler reads http request header through HTTP transfer engine, parses it by HTTP parser engine, and gets session information from session manager. Finally, it directs the http request to a backend server. After processing http request, Scheduler reads http response from the backend server, and returns http response to the original client.

Scenarios

The section describes how CHTTP works in the different scenarios.

HTTP request without session information

KTCPVS-CHTTP-Workflow-Without-Session.jpg

When a client accesses KTCPVS without a session cookie in http request line, CHTTP will select a server with the least load, and redirect the http request to this selected server.

Server starting a session

KTCPVS-CHTTP-Workflow-Server-Session.jpg

When the server initializes a session by sending cookie back to KTCPVS, CHTTP will inject a session cookie to client, record this session in session table and save all the cookies related to this session in cookie table. Therefore, the following http requests from the same client will contain a session cookie, then CHTTP will direct this request to the original server that starts the session.

HTTP request with session information

KTCPVS-CHTTP-Workflow-With-Session.jpg

After the HTTP client receives response with a session, it will send http request with the session cookie. CHTTP will search the session table to find the destination server. Only if search is failed or no session cookie is found, CHTTP will lookup server with the least load. When CHTTP processes http response header, if there is cookie in http response header, it will update the session table and cookie table.