Code Monkey home page Code Monkey logo

akka-monitoring-tool's Introduction

akka-monitoring-tool

This project aims to provide a simple way to visualize Akka.NET cluster and allow cluster admin to control cluster "leave/down" of each nodes.

In fact, although there are more powerful tools to do the job, such as Petabridge.cmd, I still want to try this idea as an alternative approach to combine the web technology and make it a little bit visually attractive.

Screenshot

Screenshot

Design in a nutshell

The fundamental idea of this project is to allow a web application (Angular app) connect to an Akka.NET cluster via seed nodes. These seed nodes will have a self-host OWIN with websocket for streamming events and actions to and from the web front-end.

Why I let web app connect to seed node via websocket?

  • Firstly, websocket allows more flexible connection establishment from single web page. Indeed, with websocket, as compared to SignalR, we can disconnect from one endpoint and connect to another one easily.
  • Secondly, exposing websocket from seed nodes ensure a more accurate and up-to-date cluster state for the web front-end.
  • Lastly, if all seed nodes can offer the cluster state separately, listening to all of them can provide us a better view on possible split brain or any network partition scenarios.

One important point to mention is that I have compacted all of the logic required for OWIN websocket into a single C# library, so-called MonitorLib. This single library allows a seamless integration to any seed nodes as below. This is very much like a standard startup for OWIN.

string hostUrl = $"http://*:{10000 + clusterPort}/";
monitorApp = MonitorLib.ClusterMonitoring.Start(hostUrl, ClusterSystem);
Console.WriteLine($"Web app is running at {hostUrl}");

The library internally offers

  • Message contracts (serializeable in JSON with Newtonsoft) to communicate between web app and backend
  • Real-time push for cluster state whenever change happens
  • Allow cluster actions: Leave and Down any members inside a cluster

How to run

This project is organized into 2 sub directories:

  • web for the Angular app
  • cluster for an example of a cluster with 2 types of members: seed node and odinary member

To run angular app

yarn
ng serve

To run cluster seed node, I introduce an environment variable CLUSTER_PORT to allow port override. Hence, let's use this to run seed node in 2 different ports

# in first console
set CLUSTER_PORT=8081
SeedNode.exe


# in second console
set CLUSTER_PORT=8082
SeedNode.exe

Then go to localhost:4200 to view the web app.

The web app has LocalStorage integrated to allow users to save down cluster alias and seed nodes in a format clusterName@host:port,clusterName@host:port. And users can add as many cluster configs or seed nodes as they want.

Happy hacking!

akka-monitoring-tool's People

Contributors

daedrag avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

seungyongshim

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.