E-commerce For Everyone - Amazon Storefront Solutions

Using EC2 as a proxy to S3 using PHP+sockets

I currently have a PHP application installed on an EC2 instance which acts as a proxy to S3 by buffering some data from S3 and then spitting it back to the client.  However, the cost for the initial PHP socket_read takes on average, 400-500ms.

So I ran a simple test script to see how long a single PHP socket_read would take from EC2 to S3 (without acting as a proxy) and it takes on average, 180-220ms, for the socket_read to complete (even if it only reads 1400 bytes or so of data).

I've also observed that if I request an object which does not exist in S3, the PHP socket_read completes rather quickly at around 25-60ms.

Has anyone attempted to use EC2 in this fashion where low latency is necessary for interactive applications?  Just wondering if this is a limitation of PHP's sockets implementation or a limitation of S3.  Thanks in advance!

Leave a Comment

You must be logged in to post a comment.



E-commerce For Everyone - Amazon Storefront Solutions