Class LayeredNetwork
-
- All Implemented Interfaces:
-
java.io.Serializable
,jline.lang.Copyable
public class LayeredNetwork extends Ensemble implements Copyable
LayeredNetwork represents a layered queueing network (LQN) model for performance analysis of distributed and multi-tiered software systems.
Layered queueing networks extend traditional queueing networks by modeling software systems where processes can both serve requests and make requests to other processes, creating a layered architecture. This is particularly useful for analyzing:
- Multi-tier web applications (web server, application server, database)
- Service-oriented architectures and microservices
- Client-server systems with nested service calls
- Cloud computing and distributed systems
The network consists of:
- Hosts: Physical or virtual processors that execute tasks
- Tasks: Software processes that can serve requests and make calls
- Entries: Service interfaces exposed by tasks
- Activities: Individual processing steps within tasks
- Precedences: Execution order and control flow relationships
LayeredNetwork supports both open models (with external arrivals) and closed models (with fixed population), and can model complex interactions including synchronous calls, asynchronous messaging, fork-join parallelism, and probabilistic routing.
The model can be solved using various algorithms including Mean Value Analysis (MVA), simulation, and matrix-analytic methods to obtain performance metrics such as response times, throughputs, and resource utilizations.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Integer, Host>
hosts
protected Map<Integer, Task>
tasks
protected Map<Integer, Task>
reftasks
protected Map<Integer, Activity>
activities
protected Map<Integer, Entry>
entries
protected Map<Integer, LayeredNetworkElement>
nodes
protected List<Network>
ensemble
-
Constructor Summary
Constructors Constructor Description LayeredNetwork(String name)
Creates a new layered queueing network with the specified name.
-
Method Summary
Modifier and Type Method Description static LayeredNetwork
load(String filename, boolean verbose)
Loads a layered queueing network from an XML file. static LayeredNetwork
load(String filename)
Loads a layered queueing network from an XML file with default verbose setting. static LayeredNetwork
parseXML(String filename)
Parses a layered queueing network from an XML file with default verbose setting. static LayeredNetwork
parseXML(String filename, boolean verbose)
Parses a layered queueing network from an XML file. static LayeredNetwork
readXML(String filename)
Reads a layered queueing network from an XML file with default verbose setting. static LayeredNetwork
readXML(String filename, boolean verbose)
Reads a layered queueing network from an XML file. static void
viewModel(String filename)
Views a layered queueing network model using the default JLQN path. static void
viewModel(String jlqnPath, String filename)
Views a layered queueing network model using the specified JLQN path. void
generateGraph()
Generates the graph representation of the layered network. List<Network>
getEnsemble()
Gets the list of network models in this ensemble. List<Network>
getLayers()
Gets the list of network layers in this layered network. LayeredNetworkElement
getNodeByName(String nodeName)
Retrieves a network element by its name. Integer
getNodeIndex(LayeredNetworkElement node)
Gets the index of a network element in the node collection. List<String>
getNodeNames()
Gets the names of all network elements (hosts, tasks, entries, activities). int
getNumberOfLayers()
Gets the number of layers in the layered network. int
getNumberOfModels()
Gets the number of models in the layered network ensemble. LayeredNetworkStruct
getStruct()
Gets the structural representation of the layered network. LayeredNetworkStruct
getStruct(boolean regenerate)
Gets the structural representation of the layered network. void
init()
Initializes the layered network by generating the graph and setting default parameters. void
initDefault()
Initializes the layered network with default settings. void
reset(boolean isHard)
Resets the layered network to its initial state. void
sendModel(String outputPath, String portNumber)
Sends the model to a local server using the default IP address (127.0.0.1). void
sendModel(String outputPath, String ipNumber, String portNumber)
Sends the model to a server at the specified IP address and port. void
summary()
Prints a summary of the layered network structure to standard output. void
view()
Views the layered network model by creating a temporary JLQN file and opening it. void
writeJLQN(String filename)
Writes the layered network to a JLQN file with default naming. void
writeJLQN(String filename, boolean abstractNames)
Writes the layered network to a JLQN file. void
writeXML(String filename)
Writes the layered network to an XML file with default naming. void
writeXML(String filename, boolean abstractNames)
Writes the layered network to an XML file. void
initUsedFeatures()
Initialize the used features for each model in the ensemble void
setUsedFeatures(String feature)
Set a language feature as used FeatureSet
getUsedLangFeatures()
Get the used language features by analyzing the layered network structure -
Methods inherited from class jline.lang.Ensemble
getModel, setEnsemble, size
-
Methods inherited from class jline.lang.Copyable
copy
-
Methods inherited from class jline.lang.Model
getName, getVersion, setName, setVersion
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
LayeredNetwork
LayeredNetwork(String name)
Creates a new layered queueing network with the specified name.- Parameters:
name
- the name of the layered network
-
-
Method Detail
-
load
static LayeredNetwork load(String filename, boolean verbose)
Loads a layered queueing network from an XML file.
- Parameters:
filename
- the path to the XML file to loadverbose
- if true, enables verbose output during loading- Returns:
the loaded LayeredNetwork instance
-
load
static LayeredNetwork load(String filename)
Loads a layered queueing network from an XML file with default verbose setting.
- Parameters:
filename
- the path to the XML file to load- Returns:
the loaded LayeredNetwork instance
-
parseXML
static LayeredNetwork parseXML(String filename)
Parses a layered queueing network from an XML file with default verbose setting.
- Parameters:
filename
- the path to the XML file to parse- Returns:
the parsed LayeredNetwork instance
-
parseXML
static LayeredNetwork parseXML(String filename, boolean verbose)
Parses a layered queueing network from an XML file.
- Parameters:
filename
- the path to the XML file to parseverbose
- if true, enables verbose output during parsing- Returns:
the parsed LayeredNetwork instance
-
readXML
static LayeredNetwork readXML(String filename)
Reads a layered queueing network from an XML file with default verbose setting.
- Parameters:
filename
- the path to the XML file to read- Returns:
the read LayeredNetwork instance
-
readXML
static LayeredNetwork readXML(String filename, boolean verbose)
Reads a layered queueing network from an XML file.
- Parameters:
filename
- the path to the XML file to readverbose
- if true, enables verbose output during reading- Returns:
the read LayeredNetwork instance
-
viewModel
static void viewModel(String filename)
Views a layered queueing network model using the default JLQN path.
- Parameters:
filename
- the path to the model file to view
-
viewModel
static void viewModel(String jlqnPath, String filename)
Views a layered queueing network model using the specified JLQN path.
- Parameters:
jlqnPath
- the path to the JLQN executablefilename
- the path to the model file to view
-
generateGraph
void generateGraph()
Generates the graph representation of the layered network. This method is currently not implemented.
-
getEnsemble
List<Network> getEnsemble()
Gets the list of network models in this ensemble.
- Returns:
the list of network models
-
getLayers
List<Network> getLayers()
Gets the list of network layers in this layered network.
- Returns:
the list of network layers
-
getNodeByName
LayeredNetworkElement getNodeByName(String nodeName)
Retrieves a network element by its name.
- Parameters:
nodeName
- the name of the node to find- Returns:
the LayeredNetworkElement with the specified name, or null if not found
-
getNodeIndex
Integer getNodeIndex(LayeredNetworkElement node)
Gets the index of a network element in the node collection.
- Parameters:
node
- the network element to find the index for- Returns:
the index of the node, or -1 if not found
-
getNodeNames
List<String> getNodeNames()
Gets the names of all network elements (hosts, tasks, entries, activities).
- Returns:
a list containing all node names in the network
-
getNumberOfLayers
int getNumberOfLayers()
Gets the number of layers in the layered network.
- Returns:
the number of layers
-
getNumberOfModels
int getNumberOfModels()
Gets the number of models in the layered network ensemble.
- Returns:
the number of models
-
getStruct
LayeredNetworkStruct getStruct()
Gets the structural representation of the layered network.
- Returns:
the LayeredNetworkStruct containing the network structure
-
getStruct
LayeredNetworkStruct getStruct(boolean regenerate)
Gets the structural representation of the layered network.
- Parameters:
regenerate
- if true, forces regeneration of the structure- Returns:
the LayeredNetworkStruct containing the network structure
-
init
void init()
Initializes the layered network by generating the graph and setting default parameters.
-
initDefault
void initDefault()
Initializes the layered network with default settings. Currently this method contains placeholder implementation.
-
reset
void reset(boolean isHard)
Resets the layered network to its initial state.
- Parameters:
isHard
- if true, performs a hard reset clearing all network elements; if false, performs a soft reset clearing only the ensemble
-
sendModel
void sendModel(String outputPath, String portNumber)
Sends the model to a local server using the default IP address (127.0.0.1).
- Parameters:
outputPath
- the path where the model output should be storedportNumber
- the port number for the server connection
-
sendModel
void sendModel(String outputPath, String ipNumber, String portNumber)
Sends the model to a server at the specified IP address and port.
- Parameters:
outputPath
- the path where the model output should be storedipNumber
- the IP address of the serverportNumber
- the port number for the server connection
-
summary
void summary()
Prints a summary of the layered network structure to standard output.
-
view
void view()
Views the layered network model by creating a temporary JLQN file and opening it.
-
writeJLQN
void writeJLQN(String filename)
Writes the layered network to a JLQN file with default naming.
- Parameters:
filename
- the path to write the JLQN file
-
writeJLQN
void writeJLQN(String filename, boolean abstractNames)
Writes the layered network to a JLQN file.
- Parameters:
filename
- the path to write the JLQN fileabstractNames
- if true, uses abstract names in the output
-
writeXML
void writeXML(String filename)
Writes the layered network to an XML file with default naming.
- Parameters:
filename
- the path to write the XML file
-
writeXML
void writeXML(String filename, boolean abstractNames)
Writes the layered network to an XML file.
- Parameters:
filename
- the path to write the XML fileabstractNames
- if true, uses abstract names in the output
-
initUsedFeatures
void initUsedFeatures()
Initialize the used features for each model in the ensemble
-
setUsedFeatures
void setUsedFeatures(String feature)
Set a language feature as used
- Parameters:
feature
- the name of the feature to mark as used
-
getUsedLangFeatures
FeatureSet getUsedLangFeatures()
Get the used language features by analyzing the layered network structure
- Returns:
FeatureSet containing all features used in this layered network
-
-
-
-