statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Browsing Amazon S3 assets is very slow since 2.5 #1271

Open mikemartin opened 7 years ago

mikemartin commented 7 years ago

Expected behaviour

Browsing and viewing AmazonS3 folders and assets has been extremely slow since migrating to 2.5. Is this a known problem with S3 currently? What can I do to improve the speed?

1) Do you recommend the S3 bucket be in the same region as your site? (I'm running S3 in US-West-2 (oregon) and my site at US-West-1) 2) I have redis running locally and on Forge with the cache set to 360. Should I increase this? 3) Would enabling s3 transfer acceleration help? it appears to require a different url your-site.s3-accelerate.amazonaws.com

Steps to reproduce

1) Go to Assets 2) Browse folders 3) View asset

@jasonvarga stil has access to the private repo if he'd like to test: http://github.com/mikemartin/structurecraft

Server configuration

Operating system:

Web server: Digital Ocean (SFO 1GB )

PHP version: 7.0

Statamic version: 2.5.3

Updated from an older Statamic or fresh install:

List of installed addons:

Logs

If any logs (browser, server, or Statamic) are appropriate...

Add those logs here
marconucara commented 7 years ago

I've the same issue, I never used S3 with older statamic so I can't compare speeds. But I can compare it with any other program that access S3, like cyberduck: if i open a folder (never opened before, so no cache) i need about 1 second with any normal program and about 10/15 seconds with statamic. Using Redis solve the speed problem, but Is very hard to use assets with a cache... I just can't see what I just upload! I'm not sure if it's involved with #1240 , maybe without that issue the cache would be updated during upload. I hope you'll fix both soon 'cause S3 is pretty unusable right now.

jackmcdade commented 7 years ago

We've tried and tried to figure out how to make S3 faster, but even outside of Statamic and every time we've ever used it, it's just slow and molasses on a winter morning. Does anyone know an S3 expert we could talk to? I feel like we're missing something (and making it miserable for everyone).

codyspring commented 7 years ago

I'm doing some testing on this and here's what I've found so far. Note that I'm not using redis at all to reduce the variables during the process.

Server on AWS in same region (west):

Server on DigitalOcean (west):

I'm going to give it some time and try again, as well as some additional testing and will report back with my findings; I'd really like to help solve this one. D:

jasonvarga commented 7 years ago

The initial load times on fresh servers are due to the thumbnails being created, fyi.

marconucara commented 7 years ago

I did similar tests but in my case I do not have such a clear difference between the first opening and the second. Moreover for my assets the root contains only 4 folders and no images, but takes 15 / 20s to list this folder (every times).

@jasonvarga anyway thumbnail creation shouldn't be async?

jamiedumont commented 7 years ago

I'll add my plus-one just for the record. I've been experiencing this issue too.

Most folders are slow to load, even when there is only one or two images present. This is when running on local (2015 MBP) using Valet and Redis with a 120 second cache time, so not the best environment to benchmark and test, but enough that the loading speed suggests something running amok.

I also have a few folders (each with about 30 images in total) that refuse to load. I get an endless "Loading" spinner with what looks like an error in the logs relating to memory exhaustion. Is this simply a byproduct of my local environment (hope not...) or a memory leak somewhere?

Also, I've been getting the same issues when uploading as @codyspring (the 'Could not read the image <filename>. error.). Permissions are again set to AllAccessS3.

Hope you guys find the cause! Any more testing you want me to do, just shout!