title: Delegating multiple image resize operations to Laravel job does not speed up upload process
body: <p>I've been trying to optimize the UX for or admins when uploading images on our platform. The images are rather heavy (7-10MB) and uploaded in batches of 3 at a time, asynchronously (using <a href="https://docs.fineuploader.com/branch/master/" rel="nofollow noreferrer">FineUploader</a>). Each image is being stored in multiple sizes, using <a href="http://image.intervention.io/" rel="nofollow noreferrer">Intervention Image</a>.</p>
  
  <p><strong>Original logic</strong></p>
  
  <pre><code>&lt;?php
  
      $file = $request-&gt;file('qqfile'); // A big JPG file in the request
      $image = Image::make($file); // Building an Intervention Image object
  
      $sizes = array(2560, 1980, 1366, 1024, 768, 480, 320);
  
      foreach ($sizes as $size) {
  
          $image = $image-&gt;widen($size-&gt;width);
          Storage::put('public/image_'.$size.'.jpg', $image-&gt;encode('jpg', 90));
  
          // image_2560.jpg, image_1980.jpg, etc.
      }
  </code></pre>
  
  <p>Our current server is a small DigitalOcean droplet (512MB RAM, 1 vCPU). All things considered, the upload process was quite time-consuming (e.g. 3 images were being uploaded approx. 2 min).</p>
  
  <p><strong>Optimized version</strong></p>
  
  <p>To speed the process up for the admins, I decided to store only the biggest size during the upload request and then use <a href="https://laravel.com/docs/5.5/queues" rel="nofollow noreferrer">Laravel queues</a> (Redis) to delegate storing of the remaining sizes:</p>
  
  <pre><code>&lt;?php
  
      $file = $request-&gt;file('qqfile'); // A big JPG file in the request
      $image = Image::make($file); // Building an Intervention Image object
  
      $sizes = array(2560, 1980, 1366, 1024, 768, 480, 320);
  
      foreach ($sizes as $size) {
  
          if ($size == 2560) {
              // Store the biggest size: image_2560.jpg
              $image = $image-&gt;widen($size-&gt;width);
              Storage::put('public/image_'.$size.'.jpg', $image-&gt;encode('jpg', 90));
          } else {
              // Delegate the job to store a resized image, 15 minutes from now
              ProcessImageStoring::dispatch($size)-&gt;delay(Carbon::now()-&gt;addMinutes(15));
          }
      }
  </code></pre>
  
  <p>The <code>ProcessImageStoring</code> job works fine. It finds the already-stored <strong>2560px</strong> image and uses it to store a resized version.</p>
  
  <p>The problem is that - even with the job delayed by <code>15</code> minutes - the upload process <strong>did not get faster at all</strong>. And I don't get why. A single upload request needs to resize and store <strong>1 image instead of 7</strong>, the other 6 should be processed in 15 min.</p>
  
  <p>Any ideas? Could it just be the droplet power in general? Any PHP/Nginx settings that might be limiting the performance?</p>