Nginx-perl-1.1.17.1

Hello, everyone.

It’s been awhile since my last announce, it was 1.1.11.1 roughly two
months ago. And now it’s 1.1.17.1.

There were couple of bugfixes and new features. But most of the work
was done on automated testing to make it work properly on things like
cpantesters and travis-ci.

http://matrix.cpantesters.org/?dist=Nginx-Perl%201.1.16.1

So, it is now possible to use Nginx::Perl as a dependency for perl
modules and test against it on cpantesters and travis-ci. Here’s an
example of such module and its tests:

http://matrix.cpantesters.org/?dist=Nginx-HTTP
https://github.com/zzzcpan/Nginx-HTTP/tree/master/t

Also wanted to mention one example, just to show how much you can do:
“In nginx-perl every request object $r is created and destroyed with
nginx’s own request. This means, that it is possible to reorder
natural request flow in any way you want. It can be very helpful in
case of DDOS, unusual load spikes or anything else you can think of.”

http://zzzcpan.github.com/nginx-perl/Nginx.html#REQUEST_QUEUE
https://github.com/zzzcpan/nginx-perl/tree/master/eg/requestqueue

Webpage:
http://zzzcpan.github.com/nginx-perl/

Github:
https://github.com/zzzcpan/nginx-perl

CPAN:
Nginx::Perl

Changes:
https://raw.github.com/zzzcpan/nginx-perl/master/CHANGES.perl

Hello Alexander,

I’ve one simple question, how is performance affected when opening a
small text file (a small database).

I know if the file is small linux itself will cache into memory the
file, but I’m worried about how it will affect each url request to
open the file, even from memory reading again the whole file, then
querying, then closing the handler, etc. All in vain because this file
won’t change more than once per hour.

My question is:
There is any way to store information in memory to use between
different requests within perl?

Thank you,

Guzmn
On Thu, Mar 15, 2012 at 4:55 PM, Alexandr G. [email protected]
wrote:

natural request flow in any way you want. It can be very helpful in
https://github.com/zzzcpan/nginx-perl
http://mailman.nginx.org/mailman/listinfo/nginx

Guzmn B. Nez
Senior Perl Developer / Sysadmin
Web: http://guzman.braso.info
Mobile: +598 98 674020

My question is:
There is any way to store information in memory to use between
different requests within perl?

There is just one interpreter instance per worker. So every variable
outside of the handler’s scope is persistent across multiple requests.

my %cache;
my $count = 0;

sub handler {
    my ($r) = @_;
    ...
    $count++;
    ...
    my $uri = $r->uri;
    if ($cache{$uri}) {
        ...
    }
}

That’s just great, thank you!

Then I can load the db into each worker and reload db as I wish/need.

Thank you! (again)

Guzman

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs