Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 5 Using the Example Code : ASPerf

ASPerf
Overview
ASPerf is an example that demonstrates how to perform timing measurements to calculate how long it takes ActiveSpaces to perform an action. ASPerf consists of a master and any number of slaves. The master is used to remotely invoke methods on the slaves. Each remote invocation method on a slave times the action being performed and the timings are returned in the results of the remote invocation. The master then displays the results returned from each of the slaves.
The ASPerf example uses two different spaces:
ASPerfCtrl  Used by the master to remotely invoke methods on the slaves.
ASPerfShared  Used by all of the remote invocation methods of the slaves for performing the actions of the remote invocation methods, such as putting data into the space.
Additionally, each slave creates its own individual space, which the slave can use instead of using the ASPerfShared space that it shares with all of the other slaves. Remote invocations from the master indicate which space a slave should use. In this way, you can see the timing differences between when a slave uses its own local space or uses the shared space in its remote invocation methods.
The ASPerf master creates the ASPerfCtrl space and then joins it as a leech. Each slave joins the ASPerfCtrl space as a seeder. In this way, the ASPerf master can use remote invocation on all seeders to invoke the same remote invocation method on all of the slaves of the ASPerfCtrl space.
ASPerf slaves can join the ASPerfShared space or their own local space as seeders or leeches.
Whether a slave joins these spaces as a leech or a seeder is controlled by the command line options of the ASPerf slave. The minimum number of seeders required for the ASPerfShared space and the ASPerf slave's own space is one. So if an ASPerf slave is started as a leech, an as-agent must also be run so that the slave's own space will have a seeder.
Since an as-agent joins all spaces in a metaspace as a seeder, when the ASPerf master tries to remotely invoke a method on all seeders of the ASPerfCtrl space, the remote invocation is also be tried on the as-agent. Since the as-agent does not know about the ASPerf remote invocation methods, as-agent reports an error back to the ASPerf master. For this reason, a special version of as-agent, ASPerfAgent, is provided with the ASPerf example.
Similar to as-agent, ASPerfAgent joins spaces in a metaspace as a seeder and thereby lends its computing resources to the space. However, ASPerfAgent specifically does not join the ASPerfCtrl space. So when the ASPerf master does remote invocations on all seeders of the ASPerfCtrl space, the remote invocation is not be tried on the ASPerfAgent and unnecessary errors are not reported back to the master.
Starting the ASPerf Master
The following are examples of how to invoke the ASPerf master for each of the APIs:
Java Invocation
java ASPerf -metaspace examplems -member_name master
.NET Invocation
ASPerf.exe -metaspace examplems -member_name master
C Invocation
ASPerf.exe -metaspace examplems -member_name master
The ASPerf master joins the ASPerfCtrl space as a leech. When you start the ASPerf master, you see the following message until an ASPerf slave is started:
Waiting for the control space to be ready (no slave connected yet)...
After an ASPerf slave is started, the master continues, and you see the following prompt, which allows you to enter commands to cause the remote invocation of methods on the slaves:
Invoke on slaves (enter 'h' for help):
The following are some of the remote invocation methods that can be invoked using the ASPerf master:
LatencyGet, LatencyPut, LatencyTake  Returns the execution times when space operations are individually performed. For example, by default, LatencyPut returns the time it takes to store 1000 tuples of data into a space by doing 1000 puts.
ThroughputGet, ThroughputPut, ThroughputTake   Returns the execution times when space operations are performed as batches. For example, by default, ThroughputPut returns the time it takes to store 1000 tuples of data into a space by putting the tuples into the space in batches of 100.
To see the full list of commands, enter h at the prompt after the ASPerf master starts up.
Starting the ASPerf Slave
The following are examples of how to invoke an ASPerf slave for each of the APIs:
Java Invocation
java ASPerfSlave -metaspace examplems -member_name slave1 -role seeder
.NET Invocation
ASPerfSlave.exe -metaspace examplems -member_name slave1 -role seeder
C Invocation
ASPerfSlave.exe -metaspace examplems -member_name slave1 -role seeder
Starting the ASPerf Agent
The following are examples of how to invoke an ASPerf agent for each of the APIs:
Java Invocation
java ASPerfAgent -metaspace examplems -member_name agent1
.NET Invocation
ASPerfAgent.exe -metaspace examplems -member_name agent1
C Invocation
ASPerfAgent.exe -metaspace examplems -member_name agent1

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved