3

I have developed a Mojolicious app on Windows XP, strawberry perl 5.14.2 and Mojolicious version 3.84. For high performance i want to create multiple instances of this app and listening on different ports but same computer. To achieve that i made two copies of my program and used Plack::Middleware::Proxy::Loadbalancer script like this below:

use Plack::Builder;
use Plack::App::Proxy;

builder {
    enable "Proxy::LoadBalancer", backends => ['http://l27.0.0.1:8080', 'http://127.0.0.1:8081'];
    Plack::App::Proxy->new()->to_app;
};

i start the instances on 8080 and 8081 and then start loadbalancer using plackup loadb.pl command. It listens fine on localhost:5000. But strangely when you connect to port 5000 only 8081 comes up, if it switches to 8080 it gives error Bad Gateway. I am newbie in deployment side so need help here. What is causing the http requests to return only from 8081 ? it seems to be network layer error or something else ? Trying apache loadbalancer will be good idea ?

friedo
  • 65,762
  • 16
  • 114
  • 184
Nishant Bhardwaj
  • 638
  • 1
  • 6
  • 13
  • Are you really sure that the instance that is supposed to listen on 8080 is really running? Use netstat to find out whether that port really is active. – innaM Jul 06 '13 at 10:04

1 Answers1

1

I am also not a deployment guy, but what I can say is this: your deployment stack seems more limiting than helpful at this point. When running under one of Mojolicious' own servers (daemon, morbo, hypnotoad) they are already using a high powered event loop, which you lose by using a plack server. Also under windows you cannot use hypnotoad which does preforking worker processes to allow more load.

I recommend you read though the deployment section of the cookbook then deploy using nginx and hypnotoad on a linux server somewhere if possible.

Joel Berger
  • 20,180
  • 5
  • 49
  • 104