Note that there are some explanatory texts on larger screens.

plurals
  1. POUpload with paperclip very slow (unicorn)
    text
    copied!<p>Sitting here with a simple rails 3 app in which I have a simple Gallery model and each gallery has many images. The image model is extended with paperclip and with the following options</p> <pre><code>has_attached_file :local, :styles =&gt; { :large =&gt; "800x800&gt;", :medium =&gt; "300x300&gt;", :thumb =&gt; "100x100#", :small =&gt; "60x60#" } </code></pre> <p>In my galleries_controller I have the following action that is implemented in order to work with the <a href="https://github.com/blueimp/jQuery-File-Upload" rel="nofollow">jQuery-File-Upload</a> plugin. thereby the json response. </p> <pre><code>def add_image gallery = Gallery.find params[:id] image = gallery.images.new({:local =&gt; params[:local]}) if image.save render :json =&gt; {:thumb =&gt; image.url(:thumb), :original =&gt; image.url} else render :json =&gt; { :result =&gt; 'error'} end end </code></pre> <p>To me this is fairly straight forward. But here comes the issue. In Development under mongrel any kind of upload works just fine with about 500-1000ms/upload. </p> <p>However when I push it in to production I constantly get timeouts of my unicorn workers and when it does send an image through it takes anywhere from 30-55 seconds for one file.</p> <p><em>the files I upload are around 100k in size</em></p> <p>I have done some testing of the bandwidth between my VPS and my dev computer witH ipref and got an average speed of about 77kbps so the upload should not be a problem. </p> <p>Note I also did a test with a non ajax file upload using the same app with user model that has an avatar. Development => Completed 302 Found in 693ms Production => Completed 302 Found in 21618ms</p> <p>Anyone experienced a similar issue with (rails3, unicorn) file uploads?</p>
 

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