[Warszawa-pm] WebNano

pp pp w webtel.pl
Wto, 4 Maj 2010, 16:06:15 PDT


On Wed, 21 Apr 2010 12:49:13 +0100, Zbigniew Lukasiak <zzbbyy w gmail.com>
wrote:
> Hej!
> 
> Ostatnio trochę pracowałem nad http://github.com/zby/WebNano - i
> wydaje mi się, że to już może być całkiem użyteczne.  Macie jakieś
> pomysły na ciekawe przykłady?
> 
> Na razie za dokumentację muszą wystarczyć testy - ale mam nadzieję, że
> łatwo się zorientować o co chodzi.


jak juz zrozumiesz placka, to chyba mozna sie polapac;)


znalazlem chwile i posiedzialem sobie troche nad tym plackiem.

jak rozumiem, WebNano to taka konkurencja dla Plack::Middleware ?

kusi aby napisac sobie framework;)


poki co prosta aplikacyjka "hello world" 

--------------------
package t1;
use parent qw(Plack::Component);
use Plack::Response;

sub call {
    my ( $self, $env ) = @_;
    return [
        200,
        [ 'Content-Type' => 'text/html', 'X-PP' => 'PP' ],
        ['<HtMl><BoDy>PEPE</BoDy><HtML>']
        ];
    }

t1->to_app;
----------------------



odpalana przez Plack::App::PSGIBin



-------------
use Plack::App::PSGIBin;
use Plack::Builder;

my $app = Plack::App::PSGIBin->new( {'root' => '/home/pp/psgi/1/app'}
)->to_app;
builder {
    mount "/psgi" => $app;
};
-------------



dziala "in no time" ;)





odpalana przez Starleta (serwer http w perlu)
--------------------
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)


Server Software:        Plack::Handler::Starlet
Server Hostname:        127.0.0.1
Server Port:            5000

Document Path:          /psgi/t1.psgi
Document Length:        29 bytes

Concurrency Level:      1
Time taken for tests:   9.499 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      1730000 bytes
HTML transferred:       290000 bytes
Requests per second:    1052.77 [#/sec] (mean)
Time per request:       0.950 [ms] (mean)
Time per request:       0.950 [ms] (mean, across all concurrent requests)
Transfer rate:          177.86 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     1    1   0.9      1      23
Waiting:        0    1   0.9      1      22
Total:          1    1   0.9      1      23

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      1
  98%      2
  99%      7
 100%     23 (longest request)

---


a przez lighttpd i FastCGI
---
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:        lighttpd/1.4.26
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /psgi/psgi/t1.psgi
Document Length:        29 bytes

Concurrency Level:      1
Time taken for tests:   5.758 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      1640020 bytes
HTML transferred:       290000 bytes
Requests per second:    1736.77 [#/sec] (mean)
Time per request:       0.576 [ms] (mean)
Time per request:       0.576 [ms] (mean, across all concurrent requests)
Transfer rate:          278.16 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     0    1   0.4      1      29
Waiting:        0    0   0.4      0      28
Total:          0    1   0.4      1      29

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      1
  98%      1
  99%      1
 100%     29 (longest request)

---

na intel core2duo 2.8GHz
widac, ze light jednak lepszy od starleta;)


choc przy wylaczonym fastcgi light obslugiwal
polaczenie (zwracajac blad 503) w 0.1 sekundy, czyli cala komunikacja
z perlem i generowanie napisu zajmowala 0.4 sekundy



jak znajde czas to przerobie mala aplikacyjke 
co dziala przez apache/fastcgi/CGI::Application,CGI,Template::Toolkit
na apache/fastcgi/plack,Template::Toolkit i porownam ile sie
zyskuje uzywajac plack'a zamiast CGI.pm




no i pytanie: pisac wlasny framework, czy kolejne moduly Plack::Middleware
;)
zeby to jeszcze mozna puszczac watkami na wielu procesorach jednoczesnie 
zachowujac dostep do wspolnej pamieci dla dachych
(zamiast kilku niezaleznych procesow/interpreterow jak to jest obecnie) ,

ech...

--
pzdr
pp


Więcej informacji o liście Warszawa-pm