And although this is per session blocker in node, it still allows other sessions to continue.At a basic level in nodejs, you do this (as an example):Thanks for the response, I think my original email basically outlined my issue, but I will break it down.If 10 people visit my page at the moment, and the page has to retrieve database/memcached info for the 10 people, and it takes 1 second to do all the pre-work to load the page, then each of those requests for each person, is done separately, taking a total of 10 seconds for the last person to retrieve their data, since it has to wait for each other process to finish before attending to the next person.
router.get('/', function (req, res, next) {
Post.find(function(err, Patients) {
if (err) { return next(err) }
res.json(People)
},'Firstname Surname')
})
I want to know how to achieve this or a similar effect in Dancer2. Or, do I just look at it as an issue with Perl and solve it through something like AnyEvent::Util::fork_callDavidOn Wed, Nov 18, 2015 at 12:32 AM, Rick Leir <richard.leir@canadiana.ca> wrote:_______________________________________________On Tue, Nov 17, 2015 at 7:00 AM, <dancer-users-request@dancer.pm> wrote:The sleep call will always cause blocking, even a sleep(0). Likewise a flush. In the sense that there is a context switch to some other thread or process.
delayed {
my $TextToWrite = ReturnText();
sleep(10); # Do something that takes a few seconds
content "$TextToWrite";
done;
};
How are you testing whether it is blocking? Sorry, I do not know what you are trying to do.
Linux will not schedule a cpu intensive task to the exclusion of I/O. You can affect its scheduling using nice:
http://stackoverflow.com/questions/2012852/control-a-perl-scripts-cpu-utilizationor spawn a C program with pthreads and freeze your screen!cheers -- Rick
dancer-users mailing list
dancer-users@dancer.pm
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________
dancer-users mailing list
dancer-users@dancer.pm
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users