Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisroos/6e7e299c9467286d641c81cf316725c5 to your computer and use it in GitHub Desktop.
Save chrisroos/6e7e299c9467286d641c81cf316725c5 to your computer and use it in GitHub Desktop.

Comparing performance of different serving mechanisms

Instructions for setting up Asset Manager on EC2 are in https://gist.github.com/chrisroos/bf9e60642395c84e76cb0ecc1cd1272d.

Set-up

# Create 1MB file
$ dd if=/dev/zero of=1MB.dat  bs=1M count=1

# Upload file
$ curl http://asset-manager.ec2.gov.uk/assets/ \
--form "asset[file]=@1MB.dat"

The tests

# Sendfile
$ ab -n500 http://asset-manager.ec2.gov.uk/media/598dc47f0cec2d1065d18e4d/1MB.dat

# Rails proxy
$ ab -n500 http://asset-manager.ec2.gov.uk/media/598dc47f0cec2d1065d18e4d/1MB.dat?stream_from_s3=true

# Nginx proxy (with and without cache)
$ ab -n500 http://asset-manager.ec2.gov.uk/media/598dc47f0cec2d1065d18e4d/1MB.dat?proxy_via_nginx=true

# Redirect
# Note: I don't think ab follows the redirect
$ ab -n500 http://asset-manager.ec2.gov.uk/media/598dc47f0cec2d1065d18e4d/1MB.dat?redirect_to_s3=true

Summary

Mechanism Req/sec -n500 -c1 Req/sec -n500 -c5
Sendfile 300 580
Rails proxy 5 9
Nginx proxy 4.6 23
Nginx proxy + cache 200 420
Redirect 237 450
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment