Giter Club home page Giter Club logo

gossip-glomers's Introduction

Solutions for Gossip Glomers Challenges in Scala using ZIO-Maelstrom

What is Maelstrom?

https://github.com/jepsen-io/maelstrom

Gossip Glomers Challenges?

https://fly.io/dist-sys/

ZIO-Maelstrom?

https://zio-maelstrom.bilal-fazlani.com/


Contents

Status Challenge Source code
- 1: Echo /echo/
- 2: Unique ID Generation /unique-id-generation/
- 3a: Single-Node Broadcast /single-node-broadcast/
- 3b: Multi-Node Broadcast /multi-node-broadcast/
- 3c: Fault Tolerant Broadcast /fault-tolerant-broadcast/
- 3d: Efficient Broadcast, Part I /efficient-broadcast-1/
- 3e: Efficient Broadcast, Part II /efficient-broadcast-2/
- 4: Grow-Only Counter /grow-only-counter/
- 5a: Single-Node Kafka-Style Log /kafka-style-log/
- 5b: Multi-Node Kafka-Style Log /multi-node-kafka-style-log/
- 5c: Efficient Kafka-Style Log /efficient-kafka-style-log/
- 6a: Single Node, Totally Available Transactions /single-node-totally-available-transactions/
- 6b: Totally-Available, Read Uncommitted Transactions /totally-available-read-uncommitted-transactions/
- 6c: Totally-Available, Read Committed Transactions /totally-available-read-committed-transactions/

Pre-requisites

  1. Maelstrom should be installed and should be available in PATH
  2. Coursier should be installed and should be available in PATH
  3. GraalVM Community Edition with native-image tool should be installed
  4. sh / bash should be available

Getting started

This is a template repository. Use the below option to create your own repo using this template.

image

Setup

Using running jar files does not work because they start too slow and the tests timeout. So, we need to compile them to native binaries using graalvm

There are three custom (and useful) commands available on every solution subproject:

  1. bootstrap

    bootstrap command uses coursier cli to build a fat jar will all dependencies. It also create a maelstrom runner script testjar.sh file which can be used to run the jar file via maelstrom with expected load for the challenge.

    #replace with the challenge you want to package
    sbt efficient-broadcast-1/bootstrap

    You can now run testjar.sh script from target directory

    ./efficient-broadcast-1/target/testjar.sh
  2. maelstromRunAgent

    In order to create a native binary, we first run the java application (single node) with a very small load from maelstrom. Using command maelstromRunAgent. This runs with graalvm agent and generates reflection configuration in resources/META-INF/native-image/

    Reflection configurations don't change very often. So, we can reuse them for future compilations.

  3. nativePackage

    After reflection configs are generated, we can now compile the application to a native binary using nativePackage command. This task also creates a test.sh file which can be used to run the native binary via maelstrom with expected load for the challenge.

    #replace with the challenge you want to compile
    sbt efficient-broadcast-1/maelstromRunAgent
     
    sbt efficient-broadcast-1/nativePackage

    You can now run test.sh script from target directory

    ./efficient-broadcast-1/target/test.sh

Notes

  • Take a look at build.sbt to get familiar with the build setup
  • This is template tested on MacOS. Linux should be supported too. Windows might require minor tweaks
  • You may have to change nativeImageGraalHome in build.sbt to point to your graalvm home directory
  • Recommended to use latest Graalvm CE version

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.