gradle-s3-build-cache icon indicating copy to clipboard operation
gradle-s3-build-cache copied to clipboard

Avoid doesObjectExist to make the retrieval faster

Open vlsi opened this issue 4 years ago • 3 comments

https://github.com/myniva/gradle-s3-build-cache/blob/0e22597934a682786096599f270724183e1f110c/src/main/java/ch/myniva/gradle/caching/s3/internal/AwsS3BuildCacheService.java#L64

I guess the implementation can use getObject API to tell if the object exists or not.

vlsi avatar Jul 20 '20 06:07 vlsi

Can you please share more information about this issue? In which situations do you encounter performance issues regarding retrieval of cache objects? Have you run any performance tests?

I assume that AmazonS3#getObject would just throw an AmazonServiceException if the object does not exist. So I am not sure if that would make the code more reliable.

myniva avatar Jul 24 '20 08:07 myniva

@myniva , doesObjectExist is a separate request which goes over the internet. So if the same thing is implemented as a single network call, then it should be faster.

Note: AmazonServiceException is still possible (e.g. 403 forbidden), so the code has to account for it anyway.

vlsi avatar Jul 24 '20 08:07 vlsi

Good point. So we would just need to distinct between 404 and other errors in the exception handling.

myniva avatar Jul 24 '20 09:07 myniva