TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Queue everything and delight everyone

33 pointsby rajbalaover 11 years ago

7 comments

dchukover 11 years ago
I&#x27;ve built quite a few apps that use queueing to do the heavy processing behind the scenes, and I&#x27;ve always used a polling system to check progress. But it always has felt like a half-baked solution.<p>Are there any patterns or documentation projects or books or tutorials or anything else out there that cover how to have users submit something into a queue system, provide immediate feedback, then provide accurate progress updating as the job is processed, then show the results, all without having the user refresh their process or navigate away and back again?<p>Let&#x27;s say for instance, I built a service that lets a user upload 20 images at a time to be cropped and resized. Is there a commonly accepted pattern for alerting them of the resizing job progress as it is happening?
评论 #7099935 未加载
评论 #7099586 未加载
orthecreedenceover 11 years ago
The implementation&#x2F;operational complexity of a queue (assuming you don&#x27;t just hammer it into your existing database, which can sometimes be a bad idea) many times outweighs the user having to wait an extra 200ms.<p>It&#x27;s nice when you <i>have</i> to have a queue for image&#x2F;audio&#x2F;video processing, page scraping, etc because then you can use the queue for other stuff, but for the most part, excluding large jobs, you can get away without having a queue for quite a while.<p>So if you have a queuing system, great, use it. If you don&#x27;t, try to avoid building it until you really need it.
评论 #7100638 未加载
ambiateover 11 years ago
I&#x27;m currently working with ActiveMQ. I try to think of it as multiple IRC networks. Channels as topics for users by users, servers as gateways to isolated materials&#x2F;users, server global messages as topics for users by servers, server local messages as queues for users by servers and private messages as queues for users by users.<p>It is absolutely fascinating offloading a message to the queue and letting the back-end handle workflow and shuffling it to another queue for micro-tasking (such as in the article). In fact, the topic&#x2F;queue paradigm has really shifted my whole view on services.<p>Forgot to mention the queue added a layer of security. Our front-end is now the same as spawning a shell in the server (as far as data access). If you can spawn a shell on the webserver, the server is isolated from everything except the MQ ip&#x2F;port combo. This means that what was possible on the front end is the only thing possible on the back end (as far as penetrating data). I&#x27;m sure a clever person could get figure out a way, but for your average person, that will be a show stopper.
评论 #7099204 未加载
fragsworthover 11 years ago
I understand the purpose of doing this, but in most cases I don&#x27;t see any extremely simple way to implement it. Lots of decisions tend to revolve around whether the development&#x2F;maintenance time spent doing something justifies the efficiency provided by it.<p>Especially if you&#x27;re building a minimum viable product, if something on a server responds 10ms later than a queue implementation, but takes 1 hour to implement instead of 5, I am inclined to go with the 10ms delay.
MaxGabrielover 11 years ago
Something at work we use that&#x27;s great for this is ResqueDelayable. Typically I see Resque tutorials extract bits of logic out into worker classes, but this adds refactoring&#x2F;organization overhead. ResqueDelayable allows this non-queued work:<p><pre><code> def post_comment add_comment self.notify_followers # Could have lots of followers Analytics.record_new_comment # Unnecessary for api response end </code></pre> to become queued work, with no real refactoring:<p><pre><code> def post_comment add_comment self.rdelay.notify_followers Analytics.rdelay.record_new_comment end</code></pre>
lstamourover 11 years ago
FYI: Published in 2008. (Still true today, but I think we&#x27;ve learned these lessons now.)
jbuzbeeover 11 years ago
Makes me think of Meteor where changes to a document are reflected in the client immediately and then possibly rolled back if the the server-side equivalent change fails which typically would be very rare.