External Applications
LiteSpeed web server can forward requests to external applications to process and generate dynamic content. Since 1.3, LiteSpeed web server supports four types of external applications: CGI, Fast CGI, Web Server and Servlet Engine.
  • CGI is Common Gateway Interface and the current standard is CGI/1.1. CGI application runs as a standalone process. A CGI process is started for each request and it will exit after finishing the request.

  • FastCGI is a fast, open, and secure web server interface that solves the performance problems inherent from CGI without introducing the overhead and complexity of proprietary APIs (Application Programming Interfaces). For more information, please visit http://www.fastcgi.com
    LiteSpeed web server defines two types of Fast CGI application: Local Fast CGI and remote Fast CGI. There is no real difference between them, just how it is started. Local Fast CGI refers to a Fast CGI application that is started automatically by the web server on demand. Remote Fast CGI refers to a Fast CGI application that is not started by the web server. Remote Fast CGI can run on a remote machine or on the same machine.

  • Servlet Engine is an application that implements Java Servlet and Java Server Pages, like Tomcat or Jetty. LiteSpeed can communicate with Servlet engine through Apache JServ Protocol version 1.3 (AJPv1.3). Servlet engine must be started manually and can run on a remote machine.
  • Web Server is an server application that support HTTP 1.0 and 1.1 protocol. LiteSpeed web server can serve as transparent reverse proxy to accelerate and protect any web server and application server. LiteSpeed always try to utilize "persistent connection" when communicate with backend web server in order to provide highest performance.
Unlike CGI application, Fast CGI application and Servlet Engine does not exit after finishing one request, the process will stay and serve as many requests as it can. And the socket connection can be reused for multiple requests as well.

There are two ways to use external applications in LiteSpeed web server:
  1. As handler of a specific context;
  2. As handler of script language.

Fast CGI application, web server and Servlet Engine have to be defined in External Applications section before being used in script handler or context configuration. However, it is not necessary to define CGI application here.
External Applications can be configured at server level or at virtual host level. When configured at server level, it can be used by all virtual hosts; when configured at virtual host level, it can only be used by that virtual host.
 
Table of Contents
External App Settings Type   Name   Address   Max Connections   Environment   Initial Request Timeout   Retry Timeout   Auto Start   Command   Back Log   Instances   
 
TypeGo to top
Description: Specifies the type of external application. Choose from FastCGI, Servlet Engine and Web Server.
Syntax: Select from drop down list
Apply: On the fly with reload.
NameGo to top
Description: A unique name for external application of the same type. When you use it in "Script Handler" or "Context", you will refer it by this name.
Apply: On the fly with reload.
AddressGo to top
Description: A unique socket address used by the external application. IPv4 socket and Unix Domain Socket(UDS) are supported. IPv4 socket can be used for communication over the network, but UDS can only be used when the external application resides in the same machine.
Syntax: IPv4Addr:port or UDS://path
Example: 127.0.0.1:5434, UDS://tmp/lshttpd/php.sock.
Apply: Restart required.
Tips: [Security] If the external application runs on the same machine, UDS is preferred. If you have to use IPv4 socket, set the IP part to localhost or 127.0.0.1, thus the external application is inaccessible from other machines.
[Performance] Usually UDS provides higher performance than IPv4 socket.
Max ConnectionsGo to top
Description: Specifies the maximum concurrent connections that can be established between the web server and an external application. This setting controls how many requests can be processed concurrently by an external application. The real limit depends on the external application, not this setting. Set this value higher will not help if the external application is not capable.
Syntax: Integer number
Apply: On the fly with reload.
Tips: [Performance] Set higher limit does not necessarily gain higher performance. Set the limit to the point that can keep both the web server and the external application busy will give best performance. If the external application needs to wait a while during processing some requests, like waiting for results from DB query, then a higher limit helps.
EnvironmentGo to top
Description: Specifies some extra environment variables for the external application.
Syntax: key=value multiple variables can be separated by "ENTER"
Apply: On the fly with reload.
Initial Request TimeoutGo to top
Description: Specifies the maximum time the web server waits for the external application respond to the first request over the newly established connection. If web server does not receive any data from external application within the timeout, web server will mark that connection bad. This helps to identify communication problem with external application as quickly as possible. If some requests take longer time to process, increase the limit to avoid "503..." error.
Syntax: Integer number
Apply: On the fly with reload.
Retry TimeoutGo to top
Description: Specifies the period of time that the web server waits before retrying the external application that has communication problem.
Syntax: Integer number
Apply: On the fly with reload.
Auto StartGo to top
Description: Specifies whether you want the web server to start the Fast CGI application automatically. Only local Fast CGI running on the same machine can be started automatically. The IP in the Address must be a local IP.
Syntax: Select from radio box
Apply: On the fly with reload.
CommandGo to top
Description: Specifies the executable of the Fast CGI application. Must provide if Auto Start is enabled.
Syntax: Command that starts the Fast CGI application
Apply: Restart required.
Back LogGo to top
Description: Specifies the backlog of the listening socket. Must provide if Auto Start is enabled.
Syntax: Integer number
Apply: Restart required.
InstancesGo to top
Description: Specifies how many Fast CGI instances the web server will try to start. Must provide if Auto Start is enabled. Most Fast CGI application can only process one request with one process instance. Some Fast CGI application can spawn multiple children process to process multiple requests concurrently, for e.g. like PHP. For those who cannot spawn by themselves, web server will spawn multiple instances of the Fast CGI instead.
Syntax: Integer number
Apply: Restart required.
Tips: [Performance] Creating Fast CGI instances more than actual needs will hurt the performance.