Hi oak-dev, Creating a signed download URI itself is really fast and does not require communication with the cloud storage service (e.g. Azure, S3) to create the URI. However, in the current implementation we actually make at least three network calls when we do this: 1 and 2) When we call BinaryImpl#getUri(), we check to see if we can get a reference [0] for the binary to ensure the binary is not inlined. We cannot create a signed download URI for an inlined binary obviously. However, calling getReference() actually turns into two network calls, at least for Azure - one to check if the blob ID exists in the blob store, and one to get the blob properties that are needed to construct a DataRecord (e.g. last modified time, content length). Then the reference is returned from this record. 3) When the data store backend creates the URI it checks to see if the binary is actually in the cloud storage before creating the URI [1] (see OAK-7998). It is possible to have a Binary instance get a reference for it even if it is not uploaded yet (i.e. it is in the cache still).
I'm looking for ways to speed this up (seek OAK-8551 and OAK-8552). Some questions: * Is there a better way to see if a Binary is stored inline than trying to get a reference for it? * For the purposes of getting a reference, could we bypass the creation of the DataRecord and just ask the storage backend for a reference? If you follow the code path you can see the creation of the DataRecord and therefore the network calls are not actually needed to get the reference. * Could we instead rely on the BlobIdTracker for the exists() check in the storage backend? This of course would require a fix for OAK-8298. Any other ideas? [0] - https://github.com/apache/jackrabbit-oak/blob/2bef22fe5c8ebd69d65bb05fd457c08713f51aa4/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/value/jcr/BinaryImpl.java#L96 [1] - https://github.com/apache/jackrabbit-oak/blob/2bef22fe5c8ebd69d65bb05fd457c08713f51aa4/oak-blob-cloud-azure/src/main/java/org/apache/jackrabbit/oak/blob/cloud/azure/blobstorage/AzureBlobStoreBackend.java#L778 -MR
