hfalucas's avatar

Homestead and File Upload taking forever

Hi everyone,

Im using Laravel 4.1 with Homestead and just implemented a image upload using the intervention\image package. I have used this packaged before although it's the first time using it with Homestead.

So the upload time of images with around 2Mb on a local machine is huge, and this never happened while i was using other VM setups (Vaprobash). On the first try I got a '413 Request Entity Too Large' so I changed the 'client_max_body_size' to '20m'.

Anyone knows how to make this faster or it is just to me that this is happening?

0 likes
13 replies
bashy's avatar

Checked CPU/mem usage while it's doing it?

bashy's avatar

On the actual VM? I know intervention\image takes a lot of resources (PHP GD Library etc). Check inside the actual VM with htop or something.

hfalucas's avatar

The Ram is at 397-399MB and CPU usage is 4.0% and goes to 53% when the request is made @bashy . This in the actual VM

bashy's avatar

Is it stopping at PHP or Nginx? Try looking at the PHP settings as well like post_max_size, upload_max_filesize and memory_limit. Maybe execution time as well, depends if it's timing out after that.

hfalucas's avatar

I already changed those values and its not timing out. The thing is when i used the Vaprobash Vagrant file (with apache) this kind of uploads were almost instantaneous and now using Homestead they are taking 10 to 30 seconds.

bashy's avatar

Maybe it's something to do with it sending it to the VM

1 like
hfalucas's avatar

Yeah I start to think that was well, because even 200KB images are taking 5 to 10 seconds. But since I'm using the most of standards Homestead config ( followed every step in the videos here) i thought it would be fine for such a simple app like this one. Well I will have to investigate more

bashy's avatar

Maybe it's something to do with this particular setup you've got. Filesystem syncing between them both seems like the possible cause if Nginx/PHP is setup okay.

hfalucas's avatar

Really can't find a solution for this. It really is just me having this problem? Everyone else can upload files/images without a problem using Homestead?

drekinov's avatar

Maybe a little offtopic, but we have similar vagrant problems. If your Host OS is Windows, then it is probably the cause. Syncing is extremely slow and causing "kernal thread" load because of syscalls which php-fpm makes during lifecycle of request. High CPU usage in VM and x10-xN slower response time. Big symfony2 project could take ~60 seconds without any caching to serve a request. However in our case there was almost no difference between a request serving just a simple static blade , submitting a form or whatever (file uploads are not tested)

So we just gave up from Vagrant.

hfalucas's avatar

My Host OS is OS X 10.9.5 @drekinov, and it is really strange because it just happen when using Homestead, if i switch to Vaprobash everything works just fine

Please or to participate in this conversation.