Gaufrette icon indicating copy to clipboard operation
Gaufrette copied to clipboard

feature request: command buffering

Open bluppfisk opened this issue 7 years ago • 5 comments

As Gaufrette does not buffer commands, executing multiple commands on a remote service can cause considerable delays.

E.g. User deletes an uploaded image. All related sizes must also be removed from the remote service (e.g. S3). This will take 2 HTTP calls for every file: one to ensure the bucket exists, and one to delete the file. In the very regular situation where you keep 4 versions of each image, this will take 8(!) HTTP calls, a massive bottleneck.

I'd propose buffering of commands (after which a flush command executes all of it at once), or the option to concatenate commands.

bluppfisk avatar Jul 06 '17 10:07 bluppfisk

one to ensure the bucket exists, and one to delete the file. In the very regular situation where you keep 4 versions of each image, this will take 8(!) HTTP calls, a massive bottleneck.

Do you have any prove of that? The AwsS3::ensureBucketExists() method checks if the bucket exists only once.

I'd propose buffering of commands (after which a flush command executes all of it at once), or the option to concatenate commands.

It's not possible to do so right now: it would require some async filesystem implementation. But that's something we might do in some months :)

akerouanton avatar Jul 06 '17 10:07 akerouanton

@NiR- , you're right, I was looking at a deprecated version which has an ensureBucketExists() on every delete() call. However, S3 supports deleting multiple objects:

http://docs.aws.amazon.com/AmazonS3/latest/dev/DeletingMultipleObjectsUsingPHPSDK.html

Would it be possible to allow access to this?

bluppfisk avatar Jul 06 '17 10:07 bluppfisk

Then what you're looking for is a batchDelete method. We can add it through a new BatchAdapter interface, and mimic the behavior in the Filesystem if adapters don't implement it. So yeah, it's totally feasible ;)

akerouanton avatar Jul 07 '17 15:07 akerouanton

Hi @akerouanton @bluppfisk Is this issue is still relevant or can i close it ?

KevinArtus avatar Apr 28 '23 08:04 KevinArtus

Hi @akerouanton @bluppfisk Is this issue is still relevant or can i close it ?

Hi

I no longer use Gaufrette and I've written some custom code to achieve what I wanted, but I imagine it could still be a useful feature.

bluppfisk avatar Apr 28 '23 08:04 bluppfisk