Skip to content

Latest commit

 

History

History
80 lines (53 loc) · 3.41 KB

system-architecture.md

File metadata and controls

80 lines (53 loc) · 3.41 KB

Responsibilities

imgflo-server is an image processing Service.

  • Service processes new images from input images, on behalf of a Client.
  • Client is responsible for fully specifying the processing to be done, and notify the Service via HTTP requests.
  • Service does not host/serve the images, this is deferred to a standard HTTP hosting service/CDN like Amazon S3.

API

TODO: Link documentation here

Components

The major pieces of the service that are part of the imgflo project are

Additionally, a number of external software components are used. Each of these dependencies have a thin layer of code which defines the interface used, to keep idiosynracies of the concrete implementation used from spreading too much in the codebase.

  • Cache database. Redis. ./src/redis.coffee Stores which cache entries exists, and where the result is.
  • Message broker. RabbitMQ. For communicating between workers using AMQP.
  • Image blob storage. Amazon S3. ./src/s3.coffee Hosts and serves the processed images.
  • Alternative image processing runtime: NoFlo + noflo-image + noflo-canvas. Can be used in addition to imgflo.

Communication over AMQP/RabbitMQ is done via MsgFlo.

Interactions

Shown here as UML sequence diagram, created with js-sequence-diagrams.

These are the prototypical scenarios for a request, shown separately. In a real-life deployment, many (10-1000) requests happen concurrently. Error-conditions are not covered, but generally follows the same paths.

Already cached image

Client requests an image which has been processed previously, and already exists in cache. This is the simplest case, and the most performant, and the most common (in terms of number of requests).

DSL | .SVG Sequence diagram for already cached images

Typically time spent in imgflo web from Client request to response is <<100ms.

Image must be processed urgently

Client requests an image which has not been processed before. It does not exist in the cache, and must be processed and put into cache.

DSL| .SVG Sequence diagram for already cached images

Typical time spent in imgflo is ~5000ms. With variable load there is a large variance, as jobs may need to wait in the RabbitMQ queue until a worker accepts new jobs. Client response within 30 seconds is available for >99% of requests.

Pre-heat image cache

Client requests an image to be processed, without waiting for the result.

DSL| .SVG Sequence diagram for already cached images

Processing is done by worker in the same manner as for urgent requests, but uses a separate queue and worker role, to not interfere with urgent requests.