JMeter inspectIT CMR driver
The inspectIT projects offers a simple JMeter Java driver that can be used to loadtest the CMR itself. The project inspectITJMeter is located with the inspectIT main git repository.
Supported samplers
Currently the following Java samplers for loadtesting the CMR are available:
SamplerName | Description | Requires | Output |
---|---|---|---|
InspectITGetConnectedAgents | Gets all connected agents from a given CMR | Host, Port | <agents> <connectedAgents> <agent platformId="30" name="inspectIT" status="connected"/> </connectedAgents> </agents> |
InspectITAggregatedTimer | Requests the aggregated timers from the CMR without time restriction | Host, Port, platformId | <sqls> <platformId>30</platformId> <count>12</count> </sqls> |
InspectITAggregatedSQL | Requests the aggregated sqls from the CMR without time restriction | Host, Port, platformId | <timers> <platformId>30</platformId> <count>57</count> </timers> |
InspectITException | Requests the grouped exception view without time restriction | Host, Port, platformId | <exceptions> <platformId>30</platformId> <count>0</count> </exceptions> |
InspectITInvocationOverview | Gets the invocation overview for the defined number of invocations | Host, Port, platformId, #retrieve, provideOutput | <invocations> <platformId>30</platformId> <count>200</count> <invocationIds> <long>4611686018495897694</long> <long>4611686018495904752</long> <long>4611686018495902874</long> <long>4611686018495899740</long> <long>4611686018495900463</long> <long>4611686018495905050</long> <long>4611686018495902788</long> <long>4611686018495904837</long> <long>4611686018495902560</long> <long>4611686018495900249</long> ... (detailed IDs are only available if provideOutput is set) |
InspectITInvocationDetails | Gets the detail for one invocation sequence | Host, Port, platformId, invocationId | <invocation-detail> <id>4611686018495828706</id> <duration>0.04881858825683594</duration> <childCount>0</childCount> </invocation-detail> |
InspectITHttpAggregation | gets the overview of the http aggregated view | Host, Port, platformId | <http-aggregation platformId="30"> <count>32</count> </http-aggregation> |
InspectITHttpUsecaseAggregation | gets the overview of the http usecase view | Host, Port, platformId | <http-usecase platformId="30"> <count>22</count> </http-usecase> |
Usage in JMeter
To use the the samplers in JMeter, follow these steps:
- Execute the build with targets clean, package
- Copy [release]/dependencies/ to [JMeter_Install_Dir]/lib/ext. Ensure that all files are copied flattened, meaning all jar files need to be directly in the ext folder.
- Copy [release]/sampler/ to [JMeter_Install_Dir]/lib.
- Start JMeter and use a JavaSampler, here you can select the classes listed above.
Build
The inspectITSampler provides an ANT build file. To build the sampler, the target package should be executed.
Design
Communication re-uses inspectIT UI interfaces
The driver uses the interfaces of the inspectIT UI project to easily connect to the CMR. There are a few necessary changes as the interfaces in the UI are not built as external services. Thus some classes of inspectIT needs to be changed - as this was not easily possible, we realized that by overwriting the classes themselves (read: providing a new version of the class and using this one instead of the class of inspectIT UI). The classes that are overwritten all reside in the source folder overwrite. The most important class is info.novatec.inspectit.rcp.InspectIT, which acts as lookup delegator for services. In inspectIT osgi is used for looking up services, inspectITJMeter simply uses Spring and thus changes the lookup logic.
Sampler structure and hierarchy
info.novatec.inspectit.jmeter.InspectITSamplerBase acts as the base class for all inspectIT samplers. It hides the jmeter logic and provides easy to understand template methods that need to be realized by concrete sampler realizations.
Configuration
JMeter loadtests are configured using String-String pairs that are passed to the JavaSampler using the JavaSamplerContext. The InspectITSamplerBase hides the JMeter logic from the concrete samplers. In addition it simplifies the use of configuration settings.
inspectIT thus defines the Configuration enumeration. This enumeration contains all available configuration settings, their name (as seen in JMeter), their default value and their data type.
For all inspectIT samplers the configuration is only possible via configuration elements.
Template methods
All concrete samplers must realize the methods:
- getRequiredConfiguration
- setup
- run
- getResult
Execution order and SamplerBase features
The SamplerBase class calls the concrete samplers and provides information in the following order:
At definition time of the sampler, the default parameters are requested from JMeter, the SamplerBase
- gets the required parameters from the concrete sampler (getRequiredConfiguration)
- and adds the always necessary configurations for the CMR Host and CMR Port
During the test setup (JavaSampler.setup), the SamplerBase
- reads the JavaSamplerContext (String-String pairs) and stores them locally (hidden from the concrete samplers)
- verifies that CMR Host and CMR Port are available
- initializes the repository that is used in the samplers to execute CMR services
At test execution stage (JavaSampler.runTest), the SamplerBase
- allows the concrete sampler to setup()
- runs the concrete sampler logic (run())
- deals with starting and stopping the timings.
- handles all errors for the sampler. Each exception that is thrown is regarded as test error
- Uses the ResultService to fill the current result with data from the test execution.
- After the test run, the SamplerBase requests the result of the concrete sampler as POJO
- The ResultService transform the result to readable XML representation.
Result output
The result is formatted as XML string using the XStream library. A sample output looks as follows:
<agents> <connectedAgents> <agent platformId="30" name="inspectIT" status="connected"/> </connectedAgents> </agents>
Test
The Sampler projects provides a simple (quick & dirty) local test that runs the samplers as if executed by JMeter, uses the results of the samplers and forwards them to the next one. There is no automated testing available.