Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bala_dev's avatar

Laravel Process vs Laravel Jobs

Hi Everyone,

I am beginner in the Laravel. In my project I need to run a big process divided into smaller chunks.

(i.e) If I have 5000 records to run, I will split 1000 records and to run each 1000 records parallely. I have made the smaller chunks and having a confusion about implementing running records with "Process" and "Jobs" method.

Also In implementing, I will pass the Min id and Max id as parameter to identify which records to run.

Can anyone suggest me which is the best method for this scenario?

Thanks

0 likes
2 replies
tisuchi's avatar
tisuchi
Best Answer
Level 70

@bala_dev

Jobs in Laravel are part of its queue system, which is designed for deferred and asynchronous execution of tasks.

VS

Processes in Laravel, typically managed via the Symfony Process component, are suitable for executing command-line scripts or system commands from your Laravel application.

In your case, I suggest you to use Job:

For example:


// Assuming you have a method to calculate chunk ranges
$chunks = calculateChunkRanges(5000, 1000);

foreach ($chunks as $chunk) {
    ProcessRecordChunk::dispatch($chunk['minId'], $chunk['maxId']);
}

3 likes
bala_dev's avatar

Hi @tisuchi Thanks for the recommendation and detailed explanation. I will implement this with Jobs.

1 like

Please or to participate in this conversation.