Skip to content
shahar z edited this page Aug 19, 2022 · 15 revisions

NdBench REST API

Common prefix

The string value of the common path prefix for all REST calls will depend on how you deploy your application to your servlet container.

The default prefix used in NDBench is 'REST', as follows:

http://<HostName>:<ContainerPort>/REST/ndbench/<Module>/<API>

In our case, we use it with following prefix: "http://127.0.0.1:7001/REST/ndbench"

E.g. to invoke getdrivers, which is under "/driver" module, the REST call would be "http://127.0.0.1:7001/REST/ndbench/driver/getdrivers"

NdBench Driver Resource REST API

Module API Description Optional query params Header Body
/driver /initfromscript Initializes dynamic plugin from script multipart/form-data utf-8 encoded Java/Groovy script
/driver /startDataFill Start the data fill process
/driver /startDataFillAsync Start the data fill process asynchronously.
/driver /startConditionalDataFill Starts the conditional data fill process.
/driver /startVerifyDataFill Starts the verification for data fill process
/driver /stopDataFill Stops data fill process
/driver /shutdownDataFill stops data fill process
/driver /init/{client} Initializing the client defined in {client} client name
/driver /start Starts the NDBench test both read and write loadPattern (String) One of random, sliding_window, or zipfian; default random. windowSize (int) Window size for sliding_window pattern. durationInSec (int) Test duration for sliding_window. bulkSize (int) Number of keys to call readBulk()/writeBulk() API's; default 1 (readSingle()/writeSingle() API's will be called)
/driver /startReads Starts the NDBench read tests Same as /start
/driver /stopReads Stops the NDBench read tests
/driver /startWrites Starts the NDBench write tests Same as /start
/driver /stopWrites Stops the NDBench read tests
/driver /stop Stops the NDBench test both read and write
/driver /readSingle/{key} Reads single key from initialized driver key
/driver /writeSingle/{key} Writes single key to initizlied driver key
/driver /stats Gets NDBench stats
/driver /getReadStatus Gets NDBench read status
/driver /getWriteStatus Gets NDBench write status
/driver /shutdownclient disconnets and calls shudown process/ method on plugins. It also stop running reads and writes
/driver /getdrivers Gets the list of drivers
/driver /getserverstatus Returns a JSON for the status of the server
/driver /runworkflow Runs NDBench workflow process

NdBench Cluster Resource REST API

Module API Description Query params
/cluster /list To get list of NdBench cluster available in the environment/ datacenter/ AWS region
/cluster /{clusterNane}/list To get the list of instances available for a given NdBench cluster

NdBench Config Resource REST API

Module API Description Query params
/config /list To get list of NdBench configurations available for NdBench core module
/config /set POST request with JSON map of <key, value> pairs of configurations to set Input JSON body would be serialized to Map<String,String>
/config /tunable/list To get list of NdBench Tunable / Runtime change-able configurations available for NdBench core module
/config /set POST request with JSON map of <key, value> pairs of Tunable / Runtime change-able configurations to set Input JSON body would be serialized to Map<String,String>

Using Sample InMemoryTest plugin with REST API (Sequence)

Step #1 GetInfo GetDrivers REST API to see drivers available

http://127.0.0.1:7001/REST/ndbench/driver/getdrivers

Step #2 Init - Initialize InMemoryTest Driver

http://127.0.0.1:7001/REST/ndbench/driver/init/InMemoryTest

Step #3 Verify Read Single Key - To check read connectivity/ permissons of the driver to backend system

http://127.0.0.1:7001/REST/ndbench/driver/readSingle/firstkey

Step #3 Verify Write Single Key - To check write connectivity/ permissions of the driver to backend system

http://127.0.0.1:7001/REST/ndbench/driver/writeSingle/firstkey

Step #3 Verify Repeat Step #3 - Verify Read Single Key - To see if previously written key is being read back from the driver

http://127.0.0.1:7001/REST/ndbench/driver/readSingle/firstkey

Step #4 Optional Data Backfill - Depends on usecase, this can be used if backfill is needed for backend datastore

http://127.0.0.1:7001/REST/ndbench/driver/startDataFillAsync

Step #5 Load Start Write Load - To start the write load test with defaults

http://127.0.0.1:7001/REST/ndbench/driver/startWrites

Step #5 Load Start Read Load - To start the read load test with defaults

http://127.0.0.1:7001/REST/ndbench/driver/startReads

Step #6 STOP Stop Load - To stop both read and write load tests

http://127.0.0.1:7001/REST/ndbench/driver/stop