mardi 18 octobre 2016

Queue system for instant front-end feedback actions (single actions)

I've written a queue manager based around pheanstalk (beanstalkd), and I'm at the point of deciding what type of actions to funnel through this system. The queue manager can send to and read from 3 different priority tubes: fast, medium, slow.

The difference in priority is execution time. Actions in the fast queue will have the most worker processes and should execute almost instantaneously after being added to the queue. Medium will have fewer workers and slow even fewer.

We have mass actions that will no doubt go through the queue in the medium or slow lane. But we also have single actions on a single record (composed of one to a few quick queries) for which the user will need immediate feedback.

The initial non queue method is simple:

  • Click to do action, ajax and wait for response, visual representation on success.

The way with queue would be:

  • Ajax action, send to queue, refresh visual representation and hope the queue system finished executing the action before we refreshed the data

I can increase the workers for the fast queue so that there will never be any pending actions in the tube, but I will never be able to guarantee that the action will be done before the refresh of data.

What are some common solutions/patterns to this issue? I would prefer to run everything through the queue.

Aucun commentaire:

Enregistrer un commentaire