ChrisDekker
ChrisDekker

Reputation: 1773

Linux command line queueing system

I am running a webservice to convert ODT documents to PDF using OpenOffice on an Ubuntu server.

Sadly, OpenOffice chokes occasionally when more then 1 request is made simultaneously (converting a PDF takes around 500-1000ms). This is a real threat since my webservice is multithreaded and jobs are mostly issued in batches.

What I am looking for is a way to hand off the conversion task from my webservice to a intermediate process that queues all requests and streamlines them 1 by 1 to OpenOffice.

However, sometimes I want to be able to issue a high priority conversion that gets processed immediately (after the current one, if busy) and have the webservice wait (block) for that. This seems a tricky addition that makes most simple scheduling techniques obsolete.

Upvotes: 0

Views: 140

Answers (1)

Aubrey Kilian
Aubrey Kilian

Reputation: 366

What you're after is some or other message/work queue system. One of the simplest work queueing systems I've used, that also supports prioritisation, is beanstalkd.

You would have a single process running on your server, that will run your conversion process when it receives a work request from beanstalkd, and you will have your web application push a work request onto beanstalkd with relevant information.

The guys at DigitalOcean have written up a very nice intro to it here: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-beanstalkd-work-queue-on-a-vps

Upvotes: 1

Related Questions