Search code examples
phpamazon-web-servicesnginxamazon-s3s3fs

amazon s3 mount with fuse and s3fs


I have an Nginx Server with php-fpm installed on Centos 6.4

1. Current status:

I use the NFS server to hold versions and files, Nginx mounts the NFS and serves files from it. this scenario is working and handles large volumes of traffic

2. Desired scenario

Replace the NFS with S3 and mount it using fuse & s3fs. In that scenario the server fails when forced to handle high traffic.

Is fuse & s3fs much slower or am i missing something? Thx


Solution

  • The problem is in thinking that S3 behaves like an NFS mount. It does not. NFS and other disk volumes work on blocks, s3 works on entire objects. Generally when accessing files from s3fs, the entire file is copied to tmp and it has much higher latency than disk access.

    A couple of solutions:

    If you prefer NFS, you can set up an NFS share from a separate instance and mount it on the instances that need it.

    Otherwise, you can deploy your code directly to the instance itself, (which is something you can automate) and run your code from there. Static assets could be served directly from s3 via cloudfront and/or with cloudfront using a custom origin.