Git Product home page Git Product logo

Comments (2)

djanjicek avatar djanjicek commented on May 30, 2024

Additionally, it would be nice if I can use the same blob storage for cached images.

from photosauce.

saucecontrol avatar saucecontrol commented on May 30, 2024

Using a remote file store is possible if you implement a VirtualPathProvider. There is a CachingAsyncVirtualPathProvider base class defined in WebRSize that takes care of most of the details. I don't have any samples, but the code is not difficult to follow.

You would override the IsPathCaptured method to designate a local path that is served from a remote location. You then provide overrides for FileExistsAsyncInternal and GetFileAsyncInternal so that WebRSize is able to check for the existence of a file and fetch it if necessary for processing.

There are a number of challenges with storing your images on remote storage, however. The main issue is speed (both latency and throughput). In order for WebRSize to know what size and format to serve and what processing is required, it needs to know some basic metadata from the header of the image. Checking for this metadata from a local file is very fast (<1 ms typically), whereas checking the metadata from a remote file will take hundreds to thousands of times as long. Similarly, when an image is needed for processing because the processed version is not already cached, that image must be downloaded from remote storage, which will be comparatively very slow. The download time will, in most cases, dwarf the processing time. For those reasons, it is preferable to cache files locally when they are sourced from remote storage so that subsequent processing requests for the same base image will be fast.

Storing the cached images on remote storage only exacerbates the problem, because checking to see if a cached image exists may take longer than processing a new one. The simple solution there is to use an edge-caching CDN, so it can serve the requests directly and only forward a request to your server when a new variant is needed.

from photosauce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.