Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I use Gearman for File Processing Without Killing the DB?
    primarykey
    data
    text
    <p>I'm currently designing a system for processing uploaded files.</p> <p>The files are uploaded through a LAMP web frontend and must be processed through several stages some of which are sequential and others which may run in parallel. </p> <p>A few key points:</p> <ul> <li>The clients uploading the files only care about safely delivering the files not the results of the processing so it can be completely asynchronous. </li> <li>The files are max 50kb in size</li> <li>The system must scale up to processing over a million files a day </li> <li>It is critical that no files may be lost or go unprocessed</li> <li>My assumption is MySQL, but I have no issue with NoSQL if this could offer an advantage.</li> </ul> <p>My initial idea was to have the front end put the files straight into a MySQL DB and then have a number of worker processes poll the database setting flags as they completed each step. After some rough calculations I realised that this wouldn't scale as the workers polling would start to cause locking problems on the upload table. </p> <p>After some research it looks like Gearman might be the solution to the problem. The workers can register with the Gearman server and can poll for jobs without crippling the DB. </p> <p>What I am currently puzzling over is how to dispatch jobs in the most efficient manner. There are three ways I can see to do this:</p> <ul> <li>Write a single dispatcher to poll the database and then send jobs to Gearman</li> <li>Have the upload process fire off an asynchronous Gearman job when it receives a file</li> <li>Use the Gearman MySQL UDF extension to make the DB fire off jobs when files are inserted</li> </ul> <p>The first approach will still hammer the DB somewhat but it could trivially recover from a failure. The second two approaches would seem to require enabling Gearman queue persistence to recover from faults, but I am concerned that if I enable this I will loose the raw speed that attracts me to Gearman and shift the DB bottleneck downstream. </p> <p>Any advice on which of these approaches would be the most efficient (or even better real world examples) would be much appreciated.</p> <p>Also feel free to pitch in if you think I'm going about the whole thing the wrong way.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload