4 ms·
How are PHP, RoR, node.js, Perl/CGI etc. engineers supposed to build offline processing? Crontab?
by dotborg 14y ago
How are PHP, RoR, node.js, Perl/CGI etc. engineers supposed to build offline processing? Crontab?
- hythloday 14y agoThere are worker queues for at least Perl & Ruby. I have no idea about PHP and JS but one assumes solutions exist.
- CWIZO 14y agoWe use gearman (and PHP, but it works with many other languages). It's great.
- benologist 14y agoNodeJS is insanely easy to do that with, it's one of the best reasons to use it in my experience: var queue = []; // request handling module.exports = function(request, response) { queue.push("bla"); response.end("bye"); }; // out-of-request work setInterval(function() { // do something with your queue either locally // or moving it to an external job queue that can // leverage the same script on a different thread }, 1000);
- dotborg 14y agowhat about concurrency?
- benologist 14y agoToo late to edit but I read you wrong lol. In terms of concurrency the out-of-request stuff is going to happen once per thread.
- benologist 14y agoIt comes down to whether you're going to dominate node's thread or not, if it's heavy or of course blocking then you'll have to do push that work off to be handled by a different thread. In my case I periodically query mongodb for new or updated data since the last time to be stored locally, push batches of data into redis, track and save load information etc all without any negative repercussions.
- rabidsnail 14y agoNode has AMQP and Redis drivers. PHP does too, but I think it would be a mistake to write your workers in PHP.