|Description||Simulates resources in inventory inside the agent|
The performance testing (perftest) plugin simulates high loads of resources in JON. It is just like any other plugin written for JON and should be deployed as such.
The size of the environment is specified through the use of scenario files. A scenario describes the results of invocations against the plugin. For instance, the scenario will dictate how many resources of each resource type should be returned on a discovery. Thus, multiple scenario files may be written to simulate different environments.
The perftest plugin is found in subversion under trunk/modules/plugins/perftest. It is currently not built as part of the enterprise build and must be built and deployed into JON explicitly. Once the perftest plugin is deployed, it is configured at runtime through system properties. The bare minimum that must be specified is the name of the scenario to run. The scenario name is the name of the scenario XML file without the .xml extension and is specified by the following system property (substituting the actual scenario name as the value):
The above property tells the perftest plugin to load the scenario file named scenario-name.xml. This property is passed into the agent via the JON_AGENT_JAVA_OPTS environment variable.
Scenarios are XML files that adhere to the perftest-scenario.xsd schema. They indicate and configure the generator used to create the resources. Configuring generators can be as simple as specifying how many of an item to return or more complex environment modeling.
Some generators allow a property name to be specified instead of a hard coded value. This allows the user to specify at agent runtime certain configuration values. For instance, the scenario configurable-1 allows the number of resources to be specified through the property "on.perftest.server-a-count". Using this technique, the plugin does not need to be rebuilt with a new scenario for a different number of servers, the amount can be passed in at runtime. For example:
-Don.perftest.scenario=configurable-1 -Don.perftest.server-a-count=10 -Don.perftest.service-a-count=50
The above configuration will run the scenario file configurable-1, resulting in 10 resources of type server-a and 50 child services of type service-a on each server-a resource.
A scenario can specify which resource types will return resources on discovery. Each resource type referenced as a resource in the scenario must be defined in the plugin descriptor. When specifying a resource type, a resource generator must be provided. The following resource generators are supported
- SimpleResourceGenerator - Configurable to indicate how many of the associated resource type to return. The amount of resources may be hard coded through the attribute "numberOfResources". Additionally, a property name may be specified for passing in this value at runtime through the "property" attribute. If specified, the generator will look for a property of the indicated name and use that value as the number of resources to return. This generator will return the exact same set of resources on each discovery, named using the resource type and a counter from 0 to the total number of resources.
Metric handling is currently very coarse grained in the perftest plugin. Each resource specified in the scenario may indicate a metric value generator. If one is specified, it will be used for all metrics on that resource type. If one is not specified, any calls to MeasurementFacet.getValues will return the same report as passed in without any measurement data added to it. The following metric generators are supported:
- SimpleNumericMetricGenerator - Each metric requested as part of the report will have a random value generated.
By default, when new resources are detected, an empty configuration instance is used as the plugin configuration. A generator can be supplied to populate this configuration instance. Any of the configuration generators can be used to this end. The following configuration generators are supported:
- SimpleConfigurationGenerator - Each property in the configuration definition is assigned a hard coded string value. This generator does not support numeric, or more generally any validated, properties. As such, the plugin descriptor should define the plugin configuration as containing only string properties.
An artifact generator should be specified for every artifact type that the scenario wants artifacts to be discovered. Only artifacts types that are referenced by a generator will have artifacts discovered; discoveries on other artifact types will find no artifacts. Additionally, when specifying an artifact generator, a revision generator may be specified. The following artifact generators are supported:
- SimpleArtifactGenerator - This functions very similar to the SimpleResourceGenerator with regard to the "numberOfArtifacts" and "property" attributes. Additionally, the type of artifact must be specified.
For each artifact generator, a revision generator may be specified. If one is not specified, a single revision will be discovered for each artifact returned in the system. The following revision generators are supported:
- SimpleArtifactRevisionGenerator - This generator allows the scenario to specify how many new revisions will be returned for the artifact type. For instance, if the "numberOfRevisions" property is set to 3, the first three revision discoveries will return revisions; subsequent discoveries will show no change to the revision. The details for each revision are hardcoded to test values.
The implementation of the scenario handling does not take into account the parent resource type. It is just simpler to keep a cache mapped by resource type name rather than maintaining the parent-child relationship. As such, each resource type in the perftest plugin descriptor, regardless of parent, must be uniquely named. Note that the JON data model allows two resource types with different parents to have the same name; it is a limitation of the perftest plugin that this is not supported.