<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 13, 2016 at 4:49 AM, Sawyer X <span dir="ltr"><<a href="mailto:xsawyerx@gmail.com" target="_blank">xsawyerx@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Could you provide some sample code so I could play with it?<div><br></div><div>Also, how are you implementing the delayed server? What event loop are you using? Are you trying to do fully non-blocking asynchronous or are you just having a delayed response? There is a big difference.</div><div><br></div><div>The problem with delayed responses is that there are several options and in between them you need to understand how they work, what they do, event loop, the effect *on* your code, the effect *of* your code etc. That's why it's a pretty advanced feature that is usually unnecessary and the usage of it should probably be very well contained.</div><div><br></div></div><div class=""><div class="h5"><div class="gmail_extra"><br></div></div></div></blockquote><div><br>So, after writing basic test app, then retesting my own code, it appears the issue I was having is resolved.<br></div><div>For the record, my test app is below, which I've tested with --workers 1 and --workers 3 and --workers 1 will block, whereas --workers 3 works with 3 children.<br><br></div><div>The method I use is to go to <a href="http://servername:5001/">http://servername:5001/</a><br></div><div>Then in another tab, go to <a href="http://servername:5001/PlainRoute">http://servername:5001/PlainRoute</a> while / is running.<br></div><div>Now, for some reason, the whole thing works and it will just server up /PlainRoute even if / is still going on doing its stuff.<br></div><div>It may be that in some of my routes, there is some code that blocks starman, I don't know, so I will keep an eye on this and if I find a situation I willgo from there.<br><br>This is my test app and startup command:<br><br>plackup -s Starman -p 5001 ./bin/app.psgi<br></div><div> <br></div><div>This is the basic code, connecting to MongoDB and doing some stuff:<br><br><span style="color:rgb(61,133,198)"><font size="2">package TestApp;<br>use Dancer2;<br>use MongoDB;<br><br>our $VERSION = '0.1';<br><br>sub connect_MongoDB_referral_db {<br> my $database;<br> my $client = MongoDB::MongoClient->new(<br> host => 'mongodb://user:pass@localhost/ICSIntakeReferralsDev',<br> auto_connect => 1,<br> query_timeout => -1,<br> );<br> $database = $client->get_database('ICSIntakeReferralsDev');<br> }<br> return $database;<br>}<br><br><br><br><br>get '/PlainRoute' => sub {<br><br> template 'index';<br><br>};<br><br>get '/' => sub {<br> my %Data;<br> for (1..100) {<br> my $MongoDBConnection = connect_MongoDB_referral_db();<br> my $MongoReturnData = $MongoDBConnection->get_collection('Patients')->find;<br> while ( my $MongoReturnObject = $MongoReturnData->next ) {<br> my $IDObj = $MongoReturnObject->{'_id'};<br> my $IDString = $IDObj->to_string;<br> print "ID string is $IDString\n";<br> $Data{$IDString}++;<br> }<br> }<br><br> template 'index';<br>};<br><br>true;</font></span><br><br></div><div>This is the pretty picture version:<br><br><img alt="Inline image 1" src="cid:ii_15238342f9b978a9" height="561" width="520"><br></div><div><br></div><div><br></div><div>So, as mentioned, it appears that it is all working now but I'll keep monitoring closely.<br><br></div><div>Thanks for all your help everyone.<br><br></div><div>David<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jan 8, 2016 at 5:55 PM, Andrew Beverley <span dir="ltr"><<a href="mailto:andy@andybev.com" target="_blank">andy@andybev.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>On Sat, 2016-01-09 at 00:09 +1030, David H wrote:<br>
> I'm not sure if there is a way (or if this even makes sense) to fork<br>
> out each request so the dancer site isn't just sitting there waiting<br>
> for the last thing to complete.<br>
<br>
</span>Really stupid question, but I assume you do have Starman configured for<br>
multiple processes accepting requests on the server-side? Otherwise you<br>
would of course see the behaviour you describe.<br>
<span><br>
> I tried using the Delayed responses (Async/Streaming) listed here:<br>
<br>
</span>I would expect that. Delayed is still single-threaded (?), it just<br>
allows responses to be sent part way through processing request (I<br>
think, I've not looked at it in detail).<br>
<br>
I certainly would have thought that Starman or other multi-threaded<br>
server is the way to go.<br>
<br>
I do have some resource-intensive processes in one of my apps (that<br>
produce data for the same webpage via a separate request), and I've<br>
never noticed a problem. I've never looked at it in detail though. I'm<br>
using fast-cgi in Apache.<br>
<br>
Andy<br>
<div><div><br>
<br>
<br>
_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div></div>