|
Ruby LSAPI Module is a Ruby extension for Ruby and LiteSpeed intergration,
which not only delivers the best performance among all Ruby APIs, together
the dedicate configuration in LiteSpeed web server, it is
the easiest and most efficient solution for Ruby on Rails application deployment.
Features
- Best Performance
By utilizing persistent connection between web server ruby process as well as
highly optimized protocol, Ruby LSAPI delivers better performance than any
other web server, ruby API combinations.
- Dynamic Spawn = Fast startup and less memory usage
With the built-in Process Manager in LSAPI, number of ruby processes is
adjusted based on current load, the CPU intensive Rails framework
initialization only takes place once.
- Easy Rails Configuration
With the dedicate configuration for Rails in LiteSpeed web server,
deploying a Rails application is juat a few clicks away.
a 4 minutes demo video
created by Bob Silva.
User's opinions
Install
Ruby LSAPI can be installed through ruby gem. Just do
gem install ruby-lsapi
Or, it can be installed manually with our tgz package, download the package
here, then expand the package,
do
$ ruby setup.rb config
$ ruby setup.rb setup
# ruby setup.rb install
Usage
Ruby LSAPI can be used to create best performing persistent CGI scripts
in Ruby, an LSAPI application, existing CGI script can be converted easily.
A Ruby Script Runner,lsruby_runner.rb is available in our package as a
container for execution of unmodified CGI scripts.
More information is available in the README file in ruby LSAPI package.
The most common way of using ruby LSAPI is for Ruby On Rail application
deployment. And it is super easy.
Want to deploy a RoR application in a minute, you can do it with
LiteSpeed. Tutorials:
Configuration
There are a few environment variables that can be tweaked to tune ruby
LSAPI process.
- LSAPI_CHILDREN (default: 0)
LSAPI_CHILDREN controls the maximum number of children processes can be
started by the first ruby process started by web server. When set to <=1,
the first ruby process will handle request by itself, without starting any
child process. When LSAPI_CHILDREN is >1, the LSAPI application is stared in
"Self Managed Mode", which will start children processes based on demand.
With Rails easy configuration, LSAPI_CHILDREN is set to the value of
"Max Connections" by web server, no need to set it explicitly.
Usually, there is no need to set value of LSAPI_CHILDREN over 100 in most
server environment.
- LSAPI_AVOID_FORK (default: 0)
LSAPI_AVOID_FORK specifies the policy of the internal process manager in
"Self Managed Mode". When set to 0, the internal process manager will stop
and start children process on demand to save system resource. This is
preferred in a shared hosting environment. When set to 1, the internal
process manager will try to avoid freqently stopping and starting children
process. This might be preferred in a dedicate hosting environment.
- LSAPI_EXTRA_CHILDREN (default: 1/3 of LSAPI_CHILDREN or 0)
LSAPI_EXTRA_CHILDREN controls the maximum number of extra children processes
can be started when some or all existing children processes are in
malfunctioning state. Total number of children processes will be reduced to
LSAPI_CHILDREN level as soon as service is back to normal.
When LSAPI_AVOID_FORK is set to 0, the default value is 1/3 of
LSAPI_CHIDLREN, When LSAPI_AVOID_FORK is set to 1, the default value is 0.
- LSAPI_MAX_REQS (default value: 10000)
LSAPI_MAX_REQS specifies the maximum number of requests each child
process will handle before it exits automatically. This parameter can
help reducing memory usage when there are memory leaks in the application.
- LSAPI_MAX_IDLE (default value: 300 seconds)
In Self Managed Mode, LSAPI_MAX_IDLE controls how long a idle child
process will wait for a new request before exit. This option help
releasing system resources taken by idle processes.
- LSAPI_MAX_IDLE_CHILDREN (default value: 1/3 of LSAPI_CHILDREN or LSAPI_CHILDREN)
In Self Managed Mode, LSAI_MAX_IDLE_CHILDREN controls how many idle
children processes are allowed. Excessive idle children processes
will be killed by the parent process.
When LSAPI_AVOID_FORK is set to 0, the default value is 1/3 of
LSAPI_CHIDLREN, When LSAPI_AVOID_FORK is set to 1, the default value
is LSAPI_CHILDREN.
- LSAPI_MAX_PROCESS_TIME (default value: 300 seconds)
In Self Managed Mode, LSAPI_MAX_PROCESS_TIME controls the maximum
processing time allowed when processing a request. If a child process
can not finish processing of a request in the given time period, it
will be killed by the parent process. This option can help getting rid
of dead or runaway child process.
- LSAPI_PGRP_MAX_IDLE (default value: FOREVER )
In Self Managed Mode, LSAPI_PGRP_MAX_IDLE controls how long the parent
process will wait before exiting when there is no child process.
This option help releasing system resources taken by an idle parent
process.
- LSAPI_PPID_NO_CHECK
By default a LSAPI application check the existence of its parent process
and exits automatically if the parent process died. This is to reduce
orphan process when web server is restarted. However, it is desireable
to disable this feature, such as when a LSAPI process was started
manually from command line. LSAPI_PPID_NO_CHECK should be set when
you want to disable the checking of existence of parent process.
- LSAPI_ALLOW_CORE_DUMP
By default a LSAPI application will not leave a core dump file when
crashed. If you want to have ruby dump a core file, you should set
this environment variable. If set, regardless the value has been set
to, core files will be created.
License
LSAPI library code is under BSD license.
LSAPI ruby extension code is under Ruby license.
|