C++ Benchmark
The XAP c++ API benchmark framework provides a simple report of the average response time in different scenarios, running with different space topologies and activating different types of operations and space classes. You can import the report to any spread sheet (e.g. Excel) for further processing and for producing graphical results. You can plug-in your own space entry classes in case the ones provided with the benchmark do not fit your needs.
The benchmark source code can be found under: <XAP Root>\cpp\examples\benchmark
.
Benchmark Operations
The benchmark tests the following operations:
- write
- update
- read
- take
- notify
- writeMiltiple
- readMultiple
- takeMultiple
- GSIterator
- query
Benchmark Command Arguments
Here are the different command arguments that the c++ benchmark program accepts:
- <url> – Space url. This can be a remote clustered space or an embedded one.
- <warmups> – Number of runs before starting the actual benchmark
- <repeats> – Number of times to re-run the whole benchmark
- <threads> – Number of concurrent threads
- <iterations> – Total amount of entries in the space
- <payload> – Payload size for each entry (for Payload object type)
- <batch size> – Size for batch operations
- <Space Class Type> – Entry class/type. See Supported Space Class Types for details.
- <use transactions> – Whether to use transactions and their type. Options are: true|false|jini (true – use Local Transactions, jini - use Jini Transactions).
- <Test Name> (Optional) – Can have any of the operations listed in Benchmark Operations.
Supported Space Class Types
The benchmark can accept any of the following Class Types:
- Payload — Object that includes a Payload
string
field type with variable size - Mixed — Object with two
string
fields, oneboolean
field and onelong
field - Doubles — Object with 15
double
fields - PayloadFifo — Same as Payload, except that it uses fifo flag.
- ComplexObjectWithInnerBinaryPOJO — Aggregated object that includes an inner Payload field stored as binary type.
All the classes above inherit from benchmarkBase Class, which includes a long
type uid (Indexed field) and a string
based field storing the object UID.
Benchmark Command Examples
- Benchmark command example communicating with a remote space:
benchmark "jini://localhost/*/mySpace" 1 1 2 10000 1000 100 Payload false
- Benchmark command example communicating with an embedded space (collocated with the benchmark program running in the same process):
benchmark "/./mySpace" 1 1 2 10000 1000 100 Payload false
The benchmark produces an output file that includes the test name, its duration and the average throughput of the tested operation.
Benchmark Files Location
The benchmark program is located at:
<XAP Root>\cpp\examples\benchmark\
The benchmark classes xml declaration file is located at:
<XAP Root>\cpp\examples\benchmark\serializer\benchmark.gs.xml
The benchmark generated serializer code is located at:
<XAP Root>\cpp\examples\benchmark\serializer\
The benchmark serializer DLL is located at:
<XAP Root>\cpp\lib\platform\native\
The benchmark program executable is located at:
<XAP Root>\cpp\bin\$(PLATFORM)\$(COMPILER)\
Adding your Space Class
To add your own Space Class into the benchmark framework you should add a class inherited from the Benchmark class and add your code.
You should add into the <XAP Root>\cpp\examples\benchmark\serializer\benchmark.gs.xml
your class space declaration that is supported by your new benchmark implementation.