plack-middleware-sizelimit
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Terminate processes if they grow too large
# NAME

Plack::Middleware::SizeLimit - Terminate processes if they grow too large

# SYNOPSIS

    use Plack::Builder;

    builder {
        enable SizeLimit => (
            max_unshared_size_in_kb => '4096', # 4MB
            # min_shared_size_in_kb => '8192', # 8MB
            # max_process_size_in_kb => '16384', # 16MB
            check_every_n_requests => 2,
            log_when_limits_exceeded => 1
        );
        $app;
    };

# DESCRIPTION

This middleware is a port of the excellent [Apache::SizeLimit](https://metacpan.org/pod/Apache::SizeLimit) module
for multi-process Plack servers, such as [Starman](https://metacpan.org/pod/Starman), [Starlet](https://metacpan.org/pod/Starlet),
[Gazelle](https://metacpan.org/pod/Gazelle) and `uWSGI`.

This middleware only works when the environment `psgix.harakiri` is
set to a true value by the Plack server.  If it's set to false, then this
middleware simply does nothing.

You must use at least version 0.2006 of Starman (July 2010), and 0.19 of
Starlet (June 2013). Earlier versions ignore the flag to stop the process.

# CONFIGURATIONS

- max\_unshared\_size\_in\_kb

    The maximum amount of _unshared_ memory the process can use;
    usually this option is all one needs.

    Experience on one heavily trafficked [mod\_perl](https://metacpan.org/pod/mod_perl) site showed that
    setting this option and leaving the others unset is the most effective
    policy.

    This is because it only kills off processes that are truly using too much
    physical RAM, allowing most processes to live longer and reducing the
    process churn rate.

- min\_shared\_size\_in\_kb

    Sets the minimum amount of shared memory the process must have.

- max\_process\_size\_in\_kb

    The maximum size of the process, including both shared and unshared memory.

- check\_every\_n\_requests

    Since checking the process size can take a few system calls on some platforms
    (e.g. linux), you may specify this option to check the process size every _N_
    requests. The default value for _N_ is 1, i.e. to check after the processing
    of every request.

- log\_when\_limits\_exceeded

    When true, the middleware will log a warning whenever it signals to the server
    that the process is to be terminated.  This is false by default.

# SEE ALSO

[Starman](https://metacpan.org/pod/Starman), [Starlet](https://metacpan.org/pod/Starlet), [Gazelle](https://metacpan.org/pod/Gazelle)

# AUTHORS

Audrey Tang 

# LICENSE

This work is under the **CC0 1.0 Universal** license.

To the extent possible under law, 唐鳳 has waived all copyright and related
or neighboring rights to [Plack::Middleware::SizeLimit](https://metacpan.org/pod/Plack::Middleware::SizeLimit).

This work is published from Taiwan.

[http://creativecommons.org/publicdomain/zero/1.0](http://creativecommons.org/publicdomain/zero/1.0)

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。