Git Product home page Git Product logo

hwx-pe-k8s-grid's Introduction

hwx-pe-k8s-grid

Architectural variation of hwx-pricing-engine using a grid of compute workers running on K8s.

It comprises of the following two components:

  • compute-engine
  • compute-manager

Architecture

arch

compute-engine

A simple client-server application written in Go. eodservice simulates the client that submits valuation requests to a grid of remote compute engine (server) instances - valengine. The valengine responds to requests by doing static pricing compute using QuantLib library through a Java wrapper library - computelib. The application uses the Kite micro-services framework for RPC.

eodservice breaks job submissions into batches with a max size of 100 (pricing requests) and the computelib prices them in parallel.

The compute-engine's docker image builds on top of a pre-baked image of the computelib.

FROM amolthacker/mockcompute-base
LABEL maintainer="[email protected]"

# Paths
ENV COMPUTE_BASE /hwx-pe/compute/

# Copy lib and scripts
RUN mkdir -p $COMPUTE_BASE
ADD . $COMPUTE_BASE
RUN chmod +x $COMPUTE_BASE/compute.sh
RUN cp $COMPUTE_BASE/compute.sh /usr/local/bin/.
RUN cp $COMPUTE_BASE/mockvalengine-0.1.0.jar /usr/local/lib/.

# Start Engine
ENTRYPOINT go run $COMPUTE_BASE/valengine.go

# Ports : 6000 (RPC) | 8000 (HTTP-Health)
EXPOSE 6000 8000

compute-manager

A web based management user interface for the compute-engine that facilitates following operational tasks:

  • Submission of valuation jobs to the compute engine
  • Scaling of compute
  • Aggregated compute engine log stream

The backend is written in Go and frontend with AngularJS

The demo below will:

  • First go through deployment specifics
  • Submit a bunch of compute jobs
  • Watch the pods auto-scale out
  • See the subsequent job submissions get balanced across the scaled-out compute engine grid
  • See the compute engine grid scale back in after a period of reduced activity

Demo - https://youtu.be/OFkEZKlHIbg

Dependencies

The application uses following Go libraries:

Operations

Setup

Minikube

  • Start minikube
$ minikube start

ACS

  • Provisiong infrastructure

    $ cd acs
    $ az group deployment create -n hwx-pe-k8s-grid-create -g k8s-pe-grid --template-file az-deploy.json --parameters @az-deploy.parameters.json
    
  • Point kubectl to this K8s cluster

    $ az acs kubernetes get-credentials --ssh-key-file ~/.ssh/az --resource-group=k8s-pe-grid --name=containerservice-k8s-pe-grid
    
  • Start the proxy

    $ nohup kubectl proxy 2>&1 < /dev/null &
    

K8s App

  • Deploy the K8s cluster

    $ kubectl apply -f k8s/
    
  • Deploy compute-manager

    Clone the repo and add utils under src/compute-manager/scripts/linux to PATH
    
  • Update the config/env.toml file to use the setup environment properties for compute-engine and Kubernetes

  • Run the web server

$ cd ${path-to-compute-manager} 
$ go run ComputeManager.go
  • Start the SSH tunnel

    Update SSH config as under scripts/ssh-config
    $ ./scripts/hwxadmin-tunnel.sh start
    
  • Access the compute-manager Web UI

    http://localhost:8090/login
    

Teardown

K8s App

  • Stop the SSH tunnel

    $ ./scripts/hwxadmin-tunnel.sh stop
    
  • Destroy the K8s cluster

    $ kubectl delete -f k8s/
    

Minikube

  • Stop minikube
    $ minikube stop
    

ACS

  • Teardown the AZ infrastructure
    $ cd acs
    $ az group deployment create -n hwx-pe-k8s-grid-create -g k8s-pe-grid --template-file az-teardown.json
    

hwx-pe-k8s-grid's People

Contributors

amolthacker avatar

Watchers

James Cloos avatar  avatar

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.