Giter VIP home page Giter VIP logo

scala-image-processor's Introduction

Scala Image Processor demo

Heroku

Small demo to test multi vs single thread performance when converting images, using a combination of http / websockets for communicating between the client and server.

This small app applies a set of filters to an image (using scrimage library) in order to test performance in two different execution contexts. Some of the tech used:

  • Play framework for the MVC backend
  • Akka actor system to handle websocket communications
  • BaconJS for handling websockets communications as streams

Execution Contexts:

Two different thread execution contexts are tested (configuration)

Multi-Threaded: Uses the default scala fork-join-executor

multi-thread-context {
  type = Dispatcher
  executor = "fork-join-executor"
  fork-join-executor {
  }
  throughput = 100
}

Single-Threaded: Uses a thread-pool-executor restricted to 1 core.

single-thread-context {
  type = Dispatcher
  executor = "thread-pool-executor"
  thread-pool-executor {
    fixed-pool-size = 1,
    # minimum number of threads to cap factor-based core number to
    core-pool-size-min = 1
    # No of core threads ... ceil(available processors * factor)
    core-pool-size-factor = 1.0
    # maximum number of threads to cap factor-based number to
    core-pool-size-max = 1
  },
  throughput = 1
}

Generated Images:

Because of hosting limitations, images will be wiped 5 minutes after creation

Websockets

Each pageview registers a websocket connection with the backend, and the websocket identifier is linked to the user session Id. When a request for processing images comes from the user, the session ID is used to lookup the correct websocket to send the update after processing has finished.

  • Due to Heroku's hosting limitations, the client must send a ping to keep the connection alive every 30 secs.

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.