GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Gazelle(3) User Contributed Perl Documentation Gazelle(3)

Gazelle - a Preforked Plack Handler for performance freaks

    $ plackup -s Gazelle --port 5003 --max-reqs-per-child 50000 \
         -E production -a app.psgi

Gazelle is a PSGI Handler. It is derivied from Starlet. A lot of its code was rewritten or optimized by converting it to XS code.

Gazelle supports following features:

  • Supports HTTP/1.1. (Without Keepalive support.)
  • Ultra fast HTTP processing using picohttpparser.
  • Uses accept4(2) if the operating system supports it.
  • Uses writev(2) for output responses.
  • Prefork and graceful shutdown using Parallel::Prefork.
  • Hot deploy and unix domain socket using Server::Starter.

Gazelle is suitable for running HTTP application servers behind a reverse proxy such as nginx.

One can find a Benchmark here: <https://github.com/kazeburo/Gazelle/wiki/Benchmark> .

nginx.conf:

  http {
    upstream app {
      server unix:/path/to/app.sock;
    }
    server {
      location / {
        proxy_pass http://app;
      }
      location ~ ^/(stylesheets|images)/ {
        root /path/to/webapp/public;
      }
    }
  }

command line of running Gazelle

  $ start_server --path /path/to/app.sock --backlog 16384 -- plackup -s Gazelle \
    -workers=20 --max-reqs-per-child 1000 --min-reqs-per-child 800 -E production -a app.psgi

start_server is bundled with Server::Starter

In addition to the options supported by plackup, Gazelle accepts the following options:

Number of worker processes (default: 10).

Seconds until timeout (default: 300).

Maximal number of requests to be handled before a worker process exits (default: 1000).

If set, randomize the number of requests handled by a single worker process between this value and the one supplied by "--max-reqs-per-child" (default: none).

If set, worker processes will not be spawned more than once than every number of seconds given in the parameter. Furthermore, when a SIGHUP is being received, no more than one worker processes will be collected during this interval. This feature is useful for doing a "slow-restart". See <http://blog.kazuhooku.com/2011/04/web-serverstarter-parallelprefork.html> for more information. (default: none)

the subroutine code to be executed right before a child process exits. e.g. "--child-exit='sub { POSIX::_exit(0) }'". (default: none)

Gazelle exposes a callback named "psgix.informational" that can be used for sending an informational response. The callback accepts two arguments, the first argument being the status code and the second being an arrayref of the headers to be sent. Example below sends an 103 response before processing the request to build a final response. sub { my $env = shift; $env["psgix.informational"}->(103, [ 'link' => '</style.css>; rel=preload' ]); my $resp = ... application logic ... $resp; }

Starlet Parallel::Prefork Server::Starter <https://github.com/h2o/picohttpparser>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See <http://www.perl.com/perl/misc/Artistic.html>

Copyright (C) Masahiro Nagano.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Masahiro Nagano <kazeburo@gmail.com>
2022-04-09 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.