Class LayeredExamples

java.lang.Object
jline.examples.java.basic.LayeredExamples

public class LayeredExamples extends Object
Layered network examples mirroring the example notebooks in layeredModel.

This class contains Java implementations that mirror the example notebooks found in jar/src/main/java/jline/examples/java/basic/layeredModel/. Each method demonstrates a specific layered network concept using models from the basic package.

The examples cover: - Basic layered network structures with processors and tasks - Activity precedence patterns and synchronous calls - Multi-solver approaches for layered networks - Enterprise application modeling patterns - BPMN-style workflow representations

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    static void
    BPMN-style layered network (lqn_bpmn.ipynb).
    static void
    Iteration trace of the layered fixed point (lqn_bpmn_trace.m).
    static void
    Method 'flat.ph': the squashed layering with the composed encoding (lqn_flatph.m).
    static void
    Initializing a layered run from the LQNS solution (lqn_init.m).
    static void
    Join-the-shortest-queue call dispatch over a set of target tasks (lqn_jsq.m).
    static void
    Multi-solver layered network (lqn_multi_solvers.ipynb).
    static void
    OFBiz-style layered network (lqn_ofbiz.ipynb).
    static void
    Identify hidden LQN parameters from measured performance (lqn_paramident.m).
    static void
    Round-robin call dispatch over a set of target tasks (lqn_rrobin.m).
    static void
    Serial layered network (lqn_serial.ipynb).
    static void
    A processor whose servers are not interchangeable (lqn_server_pools).
    static void
    Layered network with a setup / delay-off task (lqn_setup.ipynb).
    static void
    Sock Shop microservice layered network (lqn_sockshop).
    static void
    Method 'srvn.ph': an entry's activity graph as a phase-type law (lqn_srvnph.m).
    static void
    Transient (time-dependent) analysis of a layered network (lqn_transient.m).
    static void
    Two-task layered network (lqn_twotasks.ipynb).
    static void
    Workflow layered network (lqn_workflows.ipynb).
    static void
    main(String[] args)
    Main method demonstrating selected layered network examples.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LayeredExamples

      public LayeredExamples()
  • Method Details

    • lqn_rrobin

      public static void lqn_rrobin() throws Exception
      Round-robin call dispatch over a set of target tasks (lqn_rrobin.m).

      Only the squashed ("flat") layering can express this: under "srvn" each server task lives in its own submodel and is replaced, in the client's submodel, by a surrogate delay, so no node ever has arcs to more than one of them. The layer solver must also implement state-dependent routing (SSA here); MVA, NC and FLD are rejected rather than silently returning the probabilistic split.

      Throws:
      Exception - if the solver fails
    • lqn_jsq

      public static void lqn_jsq() throws Exception
      Join-the-shortest-queue call dispatch over a set of target tasks (lqn_jsq.m).

      The twin of lqn_rrobin(), with the cyclic pointer replaced by the least loaded target at dispatch time. Like round-robin it needs the squashed layering and a layer solver carrying state-dependent routing.

      Throws:
      Exception - if the solver fails
    • lqn_bpmn_trace

      public static void lqn_bpmn_trace() throws Exception
      Iteration trace of the layered fixed point (lqn_bpmn_trace.m).

      Drives the layered solver by hand (init, pre, analyze, post, converged) instead of through the analyzer, printing the largest throughput and queue length each layer carries at each iteration. That is what makes a non-converging or a silently-zero layer visible, which an aggregate table hides.

      Throws:
      Exception - if the solver fails
    • lqn_paramident

      public static void lqn_paramident() throws Exception
      Identify hidden LQN parameters from measured performance (lqn_paramident.m).

      Demonstrates InferLqn.inferLqn, an Extended Kalman Filter that tracks hidden LQN parameters (host demands, think times) from measurable performance data, following Zheng, Yang, Woodside, Litoiu, Iszlai, "Tracking Time-Varying Parameters in Software Systems with Extended Kalman Filters", CASCON 2005.

      Two parameters are hidden: the reference-task think time (the paper's Z) and the P2 host demand of activity AS3 (the paper's service demand S_d). The measurable vector is [R(E1), U(P1), U(P2)]. A measurement sequence with a step change plus noise is synthesised, then the parameter trajectory is recovered.

      Throws:
      Exception - if the solver fails
    • lqn_transient

      public static void lqn_transient() throws Exception
      Transient (time-dependent) analysis of a layered network (lqn_transient.m).

      getTranAvg returns the transient mean queue length, utilization and throughput of every ensemble layer over time. The traces are assembled block-diagonally: layer e occupies a disjoint block of rows (its stations) and columns (its classes). Only transient-capable per-layer solvers (Fluid, CTMC, SSA) produce them; here the layers are solved with the fluid ODE solver. Do NOT set a timespan on the per-layer factory: the steady-state fixed point rejects it, and getTranAvg auto-selects the timespan per layer.

      The initial point is the layer's default state (all closed jobs at the reference station), NOT the converged occupancy, so each curve relaxes from all-at-reference to the layer steady state.

      Throws:
      Exception - if the solver fails
    • lqn_init

      public static void lqn_init() throws Exception
      Initializing a layered run from the LQNS solution (lqn_init.m).

      Runs the external solver first, when it is installed, then the layered solver on its own, and finally reads the response-time CDF off the layer the calls terminate in. The layer solver must be transient-capable for that last step, which is why it is the fluid one.

      Throws:
      Exception - if the solver fails
    • lqn_flatph

      public static void lqn_flatph() throws Exception
      Method 'flat.ph': the squashed layering with the composed encoding (lqn_flatph.m).

      A method name of the layered solver carries TWO decisions. The part before the dot is the LAYERING, which fixes what a submodel is; the part after it is the ENCODING, which fixes how an activity graph is written into that submodel. The four combinations are "srvn.cs", "srvn.ph", "flat.cs" and "flat.ph".

      "flat" is the ALIAS of "flat.cs" and resolves unconditionally rather than probing "flat.ph", because a model is squashed in order to express the routed call groups that only the routing encoding dispatches; naming "flat.ph" is therefore not the same as naming "flat".

      Throws:
      Exception - if the solver fails
    • lqn_srvnph

      public static void lqn_srvnph() throws Exception
      Method 'srvn.ph': an entry's activity graph as a phase-type law (lqn_srvnph.m).

      The default method turns every activity graph into routing: one class per task, entry, activity and call, plus Fork, Join, Router and ClassSwitch nodes. Method "srvn.ph" composes each entry graph into a single phase-type law by the exact series-parallel reduction, so a layer becomes a two-station cycle, Delay plus Queue, with one closed class per caller task. The sequencing survives as a distribution rather than as routing.

      Throws:
      Exception - if the solver fails
    • lqn_server_pools

      public static void lqn_server_pools() throws Exception
      A processor whose servers are not interchangeable (lqn_server_pools).

      Prints the fully-compatible pool, which is the neutral declaration, and then the compatibility graph, under which neither task reaches more than two of the three servers.

      Throws:
      Exception
    • lqn_basic

      public static void lqn_basic() throws Exception
      Throws:
      Exception
    • lqn_serial

      public static void lqn_serial() throws Exception
      Serial layered network (lqn_serial.ipynb).

      Shows serial activity precedence in layered networks with synchronous call patterns.

      Throws:
      Exception
    • lqn_multi_solvers

      public static void lqn_multi_solvers() throws Exception
      Multi-solver layered network (lqn_multi_solvers.ipynb).

      Demonstrates different solver approaches for layered networks with infinite server capacity.

      Throws:
      Exception
    • lqn_twotasks

      public static void lqn_twotasks() throws Exception
      Two-task layered network (lqn_twotasks.ipynb).

      Shows interaction between multiple tasks with synchronous call patterns.

      Throws:
      Exception
    • lqn_bpmn

      public static void lqn_bpmn() throws Exception
      BPMN-style layered network (lqn_bpmn.ipynb).

      Shows fork-join patterns with OrFork, AndFork, OrJoin, and AndJoin activity precedence.

      Throws:
      Exception
    • lqn_setup

      public static void lqn_setup() throws Exception
      Layered network with a setup / delay-off task (lqn_setup.ipynb).

      The servers of task F2 switch off when idle and pay a setup time when a request reactivates them.

      Throws:
      Exception
    • lqn_workflows

      public static void lqn_workflows() throws Exception
      Workflow layered network (lqn_workflows.ipynb).

      Demonstrates loop and fork-join precedence patterns with nested synchronous calls.

      Throws:
      Exception
    • lqn_ofbiz

      public static void lqn_ofbiz() throws Exception
      OFBiz-style layered network (lqn_ofbiz.ipynb).

      Enterprise application model inspired by Apache OFBiz with database and application layers.

      Throws:
      Exception
    • lqn_sockshop

      public static void lqn_sockshop() throws Exception
      Sock Shop microservice layered network (lqn_sockshop).

      Demonstrates a multi-tier microservice architecture with processor replication, fan-in/fan-out, and PS scheduling.

      Throws:
      Exception
    • main

      public static void main(String[] args) throws Exception
      Main method demonstrating selected layered network examples.
      Throws:
      Exception