Giter Site home page Giter Site logo

hazelcastrebrick's Introduction

Faster Rebrickable

Problem Statement:

  • Which lego sets and what percentage a user can compose with the existing sets at their home by reusing the parts?
  • Website rebrickable does it but it is too slow.
  • Around 10-15 seconds for a query
  • Only a single request at a time

Solution

  • Use Hazelcast platform compute and persistence capabilities and decrease the time down to msecs(750 msecs).

Matching algorithm:

  • User enters the 3 lego sets that he/she has at home
  • We find the Lego parts of the user’s old sets and combine them.
  • Run a test against each of 10713 sets and find what percentage of the set can be composed with the existing parts.
  • Need many comparisons: (10713 * average_number_of_parts_per_set * old_parts_number)
  • Sequential algorithm takes minutes.
  • Rebrickable does it around 10-15 seconds or more.

Our Implementation

  • Use Hazelcast compute power for the compute intensive algorithm:
  • Parse the csv files and load the Lego data set into the Hazelcast Imap. Use persistence so that this will not be repeated again but server will have the data ready on startup.
  • Use Lego set identifier as the key and submit jet jobs which will do the computation in parallel. Locality using jet mapping makes the computation local to the member node.
  • Aggregate the results in a result imap.
  • Use SQL select statement to display the first 50 items with matching percentage of highest first.
  • Added map index for percentage to order the Imap in terms of the percentage.

Results

  • Time drops down to 750 msecs for a query!
  • Can run multiple queries at the same time.
  • When the result can be obtained this fast, the user can be presented the results immediately as he/she types the existing Lego Set ids at the web site, no need to click on submit. Better user experience.

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.