soluvas / soluvas-framework

Soluvas Framework: Integrated Libraries and Tooling for Java
https://www.soluvas.com/
10 stars 5 forks source link

Transform (resize) images OnDemand #51

Open ceefour opened 11 years ago

ceefour commented 11 years ago

There should be 3 modes :

  1. PREPROCESS. This is what we're doing right now.
  2. BACKGROUND. After an add, image transformation jobs are run in the background. Also during image repository initialization, untransformed images are transformed in background.
  3. ON_DEMAND. After an add, no image transformation is run. During fetch, if no transformed image is found, a transformation job is run. If the transformation takes less than threshold (say 500 ms), then the image is returned. If the transformation takes more than threshold, then a null or not found image is returned. However when the transformation eventually completes, it should be good for next request. Threshold is not accumulated, i.e. it is per method call or image, not per "web request".
ceefour commented 9 years ago

It needs at least 8 URI generators, but not all of them used, and you must use URI templates (configured per tenant) instead of putting entire URIs in each image metadata.

8 URI templates are:

  1. Ondemand appserver
  2. Ondemand CDN-fronted
  3. File server/S3 origin
  4. File server/S3 CDN-fronted

Plus each of above for HTTPS.

ceefour commented 9 years ago

On first request to appserver, it checks if file is generated and exists in image server. If so then do a redirect.

If not exist, it generate first, save, then redirect.

Same like foursquare and facebook does it.