Dancer on Starman, why slow down?
Hi all, Why dancer on starman becomes very slow? Am I doing something wrong? #### directly starman$ cat app.psgimy $app = sub { return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello World' ] ];};$ starman &$ ab gives me 4000 reqs/second #### directly dancer$ cat app.pl#!/usr/bin/env perluse Dancer;get '/' => sub { "Hello World!" };dance; $ perl app.pl &$ ab gives me 600 reqs/second #### dancer on starman$ starman app.pl &$ ab still gives me 600 reqs/second Why so slow?Is it possible let dancer deal with HTML request, and starman deal with non-HTML request directly?
On Thu, 30 May 2013 15:56:45 +0900 hommura hiroaki <hommura_hiroaki@outlook.com> wrote:
Hi all, Why dancer on starman becomes very slow? Am I doing something wrong? #### directly starman$ cat app.psgimy $app = sub { return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello World' ] ];};$ starman &$ ab gives me 4000 reqs/second #### directly dancer$ cat app.pl#!/usr/bin/env perluse Dancer;get '/' => sub { "Hello World!" };dance; $ perl app.pl &$ ab gives me 600 reqs/second #### dancer on starman$ starman app.pl &$ ab still gives me 600 reqs/second Why so slow?Is it possible let dancer deal with HTML request, and starman deal with non-HTML request directly?
Yeah, Dancer will be slower than a bare-bones PSGI app, as, well, it's giving you a lot of features, which don't come free. 600 req/sec is still pretty fast, I'd say :) I think what you're asking for is to prevent static requests (images, stylesheets etc) reaching Dancer, which is sensible; I tend to have my Dancer apps proxied behind nginx, and configure nginx to serve up the static stuff for me, so those requests never hit the Dancer app. Pretty sure there's an example of that in the deployment docs. Cheers Dave P -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github
Actually, I have a site now providing two services. One is web powered by Dancer, and one is api server. http://hostname/forum ==> all HTML staff and of course database staffhttp://hostname/api ==> RESTful api, only retrieve data from backend database and return it back to client. And now /api request grows up and affect /forum. So is it possible to let Starman process /api directly, and dancer handle /forum only? I dont want to introduce nginx or anything else.
Date: Thu, 30 May 2013 09:58:26 +0100 From: davidp@preshweb.co.uk To: dancer-users@dancer.pm Subject: Re: [dancer-users] Dancer on Starman, why slow down?
On Thu, 30 May 2013 15:56:45 +0900 hommura hiroaki <hommura_hiroaki@outlook.com> wrote:
Hi all, Why dancer on starman becomes very slow? Am I doing something wrong? #### directly starman$ cat app.psgimy $app = sub { return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello World' ] ];};$ starman &$ ab gives me 4000 reqs/second #### directly dancer$ cat app.pl#!/usr/bin/env perluse Dancer;get '/' => sub { "Hello World!" };dance; $ perl app.pl &$ ab gives me 600 reqs/second #### dancer on starman$ starman app.pl &$ ab still gives me 600 reqs/second Why so slow?Is it possible let dancer deal with HTML request, and starman deal with non-HTML request directly?
Yeah, Dancer will be slower than a bare-bones PSGI app, as, well, it's giving you a lot of features, which don't come free. 600 req/sec is still pretty fast, I'd say :)
I think what you're asking for is to prevent static requests (images, stylesheets etc) reaching Dancer, which is sensible; I tend to have my Dancer apps proxied behind nginx, and configure nginx to serve up the static stuff for me, so those requests never hit the Dancer app. Pretty sure there's an example of that in the deployment docs.
Cheers
Dave P
-- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
On Fri, 31 May 2013 18:49:29 +0900 hommura hiroaki <hommura_hiroaki@outlook.com> wrote:
Actually, I have a site now providing two services. One is web powered by Dancer, and one is api server. http://hostname/forum ==> all HTML staff and of course database staffhttp://hostname/api ==> RESTful api, only retrieve data from backend database and return it back to client. And now /api request grows up and affect /forum. So is it possible to let Starman process /api directly, and dancer handle /forum only? I dont want to introduce nginx or anything else.
How would Starman "process" /api ? Starman doesn't do much by itself, it's a server which will process requests and pass them through to your code. I'm not sure quite what you're expecting it to do?
participants (2)
-
David Precious -
hommura hiroaki