aws / aws-sdk-php-zf2

ZF2 module for using the AWS SDK for PHP to interact with AWS services like S3, DynamoDB, SQS, EC2, etc.
http://aws.amazon.com/sdkforphp/
Apache License 2.0
103 stars 63 forks source link

Moving gc calls to garbageCollect on v3 #31

Closed Lansoweb closed 8 years ago

Lansoweb commented 8 years ago

On v3, as in official doc, the gc method does nothing anymore (found out the hard way :)), must call garbageCollect().

jeskew commented 8 years ago

One of the differences between v2 and v3 is that the SDK no longer supports automated garbage collection. The reason for this change is that garbage collection is completed with a combination of Scan and BatchWriteItem operations, which can cause you to exceed your provisioned throughput capacity when garbage collection is automated.

This change turns automated garbage collection back on in Zend applications, which I don't think is the right approach. You should use scheduled garbage collection (say, by calling $sessionHandler->garbageCollect() in a cron job) whether using the SDK or one of its framework integrations.

Hope that helps!

Lansoweb commented 8 years ago

@jeskew True. But can we have just the gargabeCollect method calling the saveHandler's same method? There is no getSaveHandler method to call garbageCollect upon.

Lansoweb commented 8 years ago

@jeskew Updated the PR accordingly.

jeskew commented 8 years ago

That makes sense, but doesn't this couple your code to the DynamoDB session handler? No other instance of Zend\Session\SaveHandler\SaveHandlerInterface will have a garbageCollect method, so calling ->getSaveHandler()->garbageCollect() isn't any more generic than creating an SDK session handler object and calling garbageCollect() on it.

Lansoweb commented 8 years ago

@jeskew Also true :) Guess i'll have to manually create the SDK session handler to make the garbageCollect(). Thanks!