S3 GET latency
I have been experimenting with S3 but find that there is a great deal of latency when requesting _known_ objects.
In my simplest test case, requesting a known object from a bucket which contains only two objects takes on average 180-220ms. Note: this is not counting the time spent creating the request or sending the request but just the time that it takes for a PHP socket_read to return any data. Requesting an object which does not exist takes on average 60-70ms. Example code:
In the following test case, the response time is rather quick leading me to believe that S3 just takes a while to actually locate a known object within S3:
Thanks in advance!
-Abe
In my simplest test case, requesting a known object from a bucket which contains only two objects takes on average 180-220ms. Note: this is not counting the time spent creating the request or sending the request but just the time that it takes for a PHP socket_read to return any data. Requesting an object which does not exist takes on average 60-70ms. Example code:
$obj = new s3();The readObject() function merely calls socket_read with a maximum number of bytes to return set to 4096. The $key requested in the test case is not even this large. Also, readObject() returns raw data and does not parse the response header.
$obj->connect();
$obj->requestObject($bucket, $key); // generates a request and writes to the socket
$timer->start();
$data = $obj->readObject(); // reads response from the socket
error_log(sprintf("took %s sec", $timer->get_time()));
In the following test case, the response time is rather quick leading me to believe that S3 just takes a while to actually locate a known object within S3:
$obj = new s3();I am hoping to stream media from S3, but this delay is very noticeable when scanning through clips. Will I be able to leverage S3 into my application? Or will there always be a long delay while S3 locates my files on their storage network before sending me back some data?
$obj->connect();
$obj->requestObject($bucket, $key); // generates a request and writes to the socket
usleep(2000000); // sleep for two seconds
$timer->start();
$data = $obj->readObject(); // reads response from the socket
error_log(sprintf("took %s sec", $timer->get_time()));
Thanks in advance!
-Abe












You must be logged in to post a comment.