Skip to content
This repository has been archived by the owner on Aug 21, 2019. It is now read-only.

Simplified Compute Service (PaaS) implementation, essentially a mini version / simulation of Azure's load balancer (w/ WorkerRole and RoleEnvironment support). [School Project - Faculty of Technical Sciences] 🏫

DaniloNovakovic/cloud-compute-service-simulator

Repository files navigation

Simplified Cloud Compute Service

No Maintenance Intended

School project from Cloud Computing course in Applied Software Engineering department (Faculty of Technical Sciences Novi Sad).

Table of Contents

Getting Started

To start application:

  1. Copy files from ./_JobWorkerDllsForTesting/ into ./_PlacePackageDllsHere/ folder (Check Compute Configuration section if you want to change path)
  2. Build solution
  3. (Optional) Set solution to multiple startup projects ( Right Click Solution > Properties > Multiple Startup Perojects) where Compute project will be loaded first and then Client
  4. Run solution

This project is made using .NET Framework 4.7.2

Note: It is important that you build entire solution first instead of starting Compute right away because it relies on Container's .exe file generated when you build solution.

Client

Provides an interface for user to load roles by entering role name aswell as number of instances / containers on which they should run.

Client Console Image

Client Configuration

Expected address for Common.IComputeManagement's endpoint to match the address of Compute's WCF Service that is implementing the Common.IComputeManagement interface

<system.serviceModel>
  <client>
    <endpoint name="Common.IComputeManagement"
              address ="net.tcp://localhost:10200/IComputeManagement"
              binding="netTcpBinding"
              contract="Common.IComputeManagement" />
  </client>
</system.serviceModel>

Common

Holds the interfaces that are used through the solution for WCF Communication.

Compute

Compute manages containers (starts them up and closes them down dynamically on Client request).

Aside from it's console's window feature to display logged data, it also provides the ability to close all of the running containers by pressing ENTER key on keyboard.

Compute Console Image

Compute Configuration

appSettings holds static values that are used loaded and stored inside ComputeConfiguration singleton class and used through the program.

Values of interest for change:

  • PackageRelativeFolderPath - relative path to the folder in which the .xml with its .dll pair (and it's dependencies) are expected.

  • PackageTempRelativeFolderPath - relative path to the folder which will hold NumberOfContainersToStart copies of .dlls with it's dependencies from PackageRelativeFolderPath. (Names of these copies will are assigned at runtime)

  • PackageConfigFileName - name of package configuration (.xml) file that is expected to be located inside PackageRelativeFolderPath

<appSettings>
    <add key="ContainerRelativeFilePath" value="..\..\..\Container\Bin\Debug\Container.exe" />
    <add key="MaxPort" value="10050" />
    <add key="MinPort" value="10010" />
    <add key="NumberOfContainersToStart" value="4" />
    <add key="PackageConfigFileName" value="JobWorker.xml" />
    <add key="PackageRelativeFolderPath" value="..\..\..\_PlacePackageDllsHere\" />
    <add key="PackageTempRelativeFolderPath" value="..\..\..\_PlacePackageDllsHere\Temp\" />
  </appSettings>

system.serviceModel defines endpoints for WCF Services that Compute provides. It is advised not to modify these since RoleEnvironmentLibrary as well as Client rely on them.

<system.serviceModel>
  <services>
    <service name="Compute.RoleEnvironment">
      <endpoint address="" binding="netTcpBinding" contract="Common.IRoleEnvironment" />
      <host>
        <baseAddresses>
          <add baseAddress="net.tcp://localhost:10100/IRoleEnvironment" />
        </baseAddresses>
      </host>
    </service>
    <service name="Compute.ComputeManagement">
      <endpoint address="" binding="netTcpBinding" contract="Common.IComputeManagement" />
      <host>
        <baseAddresses>
          <add baseAddress="net.tcp://localhost:10200/IComputeManagement" />
        </baseAddresses>
      </host>
    </service>
  </services>
</system.serviceModel>

Expected Package Configuration

While reading a package Compute will expect PackageConfigFileName file located in PackageRelativeFolderPath to have following structure:

<?xml version="1.0"?>
<doc>
    <assembly>
        <name>JobWorker</name>
    </assembly>
    <numberOfInstances value="2"/>
</doc>

Where <assembly><name> specifies the name of the assembly (worker role), and <numberOfInstances value=""> defines the number of Containers that Compute will call Load method to.

If the .xml configuration is invalid (ex. numberOfInstances's value is bigger then NumberOfContainersToStart, .xml is in incorrect format, or name.dll (ex. JobWorker.dll) from <assembly><name> does not exist), then Compute will delete all files and folders located inside PackageRelativeFolderPath.

Container

Console application that implements IContainerManagement interface and provides two methods as WCF Service:

  • Load(string assemblyName)

    • Checks if the assembly on provided path implements interface IWorker
    • Calls Start method from loaded .dll
  • CheckHealth()

    • Returns 'Healthy'.

Essentialy it provides an environment / home for Role instance to live in.

Container Console Image

If no port is provided as args during Container application start up then port 10100 will be taken by default.

JobWorker

Example of valid implementation of .dll that Container would load.

RoleEnvironmentLibrary

Contains client version of RoleEnvironment class that is meant for JobWorker to use. It connects to Common's WCF service to acquire information about current and brother role instances.

_JobWorkerDllsForTesting

A folder that holds valid implemented package (.xml and .dll) with its dependencies. For testing purpose it is advised to copy these files into the PackageRelativeFolderPath specified in Compute Configuration

About

Simplified Compute Service (PaaS) implementation, essentially a mini version / simulation of Azure's load balancer (w/ WorkerRole and RoleEnvironment support). [School Project - Faculty of Technical Sciences] 🏫

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages