When user opens a web page, browser sends multiple requests to the web server to get different components of the page resulting in numerous connections between browser and server. Each connection to the webserver is usually a short lived connection and puts overhead of connection management on web servers. Also, technologies like AJAX relies on keeping multiple connections open between the browser and the server.  Each connection consumes server resources – memory, CPU, bandwidth etc. thus reducing the server capacity to serve new clients.

HTTP 1.1 lets a browser sends multiple requests over a persistent connection to a server, eliminating some overhead. But content providers turn off this feature because multiple long
lived sessions from large number of clients can consume a lot of resources on the server and can lead to DoS for other clients.

TCP multiplexing is a technique that enables the reuse of existing TCP connections. Every TCP connection setup and tear down is an overhead both on the servers and on NetScaler. By establishing connections once with the server and using them to serve multiple requests from clients, NetScaler helps faster response time from the servers and improved capacity.

In NetScaler, TCP connection multiplexing works as follows:

  1. NetScaler maintains the connection reuse pool – a pool of active connections with servers that can be used for serving new client requests
  2. When a client request is received, NetScaler checks for an available connection in the reuse pool
  3. If a connection is available in the reuse pool, it is used to send the client request and get data from the server
  4. If a connection is not available in the reuse pool, NetScaler creates a new connection to the selected server
  5. In both cases, once the client request is served, the connection is put back in the reuse pool for serving future requests from the same or other clients

It’s important to note that multiple requests are not sent simultaneously on the server side connection. In other words server side connections are used to send requests sequentially and after serving each request connections are put back to reuse pool. Another interesting aspect of connection multiplexing is that to serve multiple requests from the same client, multiple server side connections from the reuse pool can be used.

Even though multiplexing is done at TCP level still it is not applicable to all the services type supported over TCP. NetScaler supports connection multiplexing for

  1. HTTP – Multiple requests from multiple clients are sent over the same connection with the server
  2. SSL – avoids CPU intensive key exchanges for each new connection
  3. DataStream – multiple client-side requests are made over the same server side connection

NetScaler provides configuration parameters (like maxconn and maxreq) to control the use of multiplexing by limiting the number of requests that can be sent over a single server connection at each service level or by enabling disabling the feature at global level. HTTP profile also provides levers to control how multiplexing should behave for HTTP services.