Thanks Jan, knew it existed but had never take a close look before. I think it's perfect when you need to establish an SSH connection to some host, send a command, wait for the answer and tear down the connection, all that inside same controller and for some route. I guess it can be problematic if SSH connections or hosts slow down for some reason (timeout connection, slow command response, etc), because it will be difficult to control the amount of processes it would spawn and to be able to handle congestion nicely. As I am now getting convinced that a full non-blocking solution will be just too complicated to implement, I think I will go for a preforked solution, so you can configure for each particular host how many connections you would like to have to it, and each connection would read commands from a common queue and send command responses back to another queue. I have actually implemented such a solution based on perl threads and Thread::Queue. It works great, but for several other reasons I am planning to refactor it to work with a Mojolicious / Hypnotoad frontend (instead of today's CGI/Apache). When I took a look in the way Mojo::UserAgent interacts non-blocking with http hosts, I thought that something similar for SSH was the way to go, handling everything inside Mojolicious. But as I said before, probably a separated module with preforked SSH connections will be better. I think I will just need to connect current queues with something Mojolicious can handle, like using a Redis backend with Mojo::Redis to push and pop commands, answers and status, or a Mongo backend using either Minion or Mojo::Mango (haven't taken a close look on these last two though).
El lunes, 14 de julio de 2014 19:50:29 UTC-3, Jan Henning Thorsen escribió: > > About SSH tasks: > Have you looked at https://metacpan.org/pod/Mojo::IOLoop::ReadWriteFork? > (Feedback wanted) > > On Monday, July 14, 2014 4:11:08 PM UTC+2, Daniel Mantovani wrote: >> >> Thanks for the feedback, took a look at the code and I think it's a nice >> way to integrate ssh tasks to Mojolicious. Not realy non-blocking in the >> way Mojo::UserAgent is though, as far as I understood it uses one process >> per ssh connection. (Mojo::UserAgent just runs inside the ioloop instead). >> >> El domingo, 13 de julio de 2014 21:12:01 UTC-3, bduggan escribió: >>> >>> On Saturday, July 12, sri wrote: >>> > - SSH and Telnet clients on Mojo::IOLoop (meaning non-blocking >>> clients). >>> > > Probably not very demanded requests, but in my opinion they would >>> help >>> > > developers to choose mojolicious as a base framework for apps that >>> > > concentrate several platforms with different interfaces (so you can >>> choose >>> > > using Mojo::UserAgent or for instance Mojo::SSHClient or >>> Mojo::TelnetClient >>> > > in a non-blocking way depending on what the target platform >>> supports). >>> > > >>> > >>> > Haha, this one is way way way way way out there... i'm not even sure a >>> > non-blocking SSH client exists on CPAN yet. >>> >>> We did something like this by using Mojo::Reactor->io to watch the >>> output >>> of external ssh client processes : >>> >>> https://metacpan.org/pod/distribution/Clustericious-Admin/bin/clad >>> >>> Brian >>> >>> -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
