addrate — measure add and delete throughput and response time
Synopsis
addrate {options} template-file-path
Description
This utility can be used to measure add and optionally delete throughput and response time of a directory server using user-defined entries. The {template-file-path} argument identifies a template file that has the same form as a template file for the makeldif command.
Examples:
This example adds entries and randomly deletes them while the number of entries added is greater than 10,000:
addrate -p 1389 -f -c 10 -C random -s 10000 addrate.template
This example adds entries and starts to delete them in the same order if their age is greater than a certain time:
addrate -p 1389 -f -c 10 -C fifo -a 2 addrate.template
For details about the template file, see makeldif.template.
When you do not use the -f
option to keep connections open and rebind on the connections, the tool can exhaust its available ports, causing the tool to crash. You can work around this problem on test systems by changing TCP settings on the system.
For example, on Linux systems, set the following parameters in the /etc/sysctl.conf
file:
net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 1
The parameter net.ipv4.tcp_fin_timeout
sets the length of time in seconds to wait for a final FIN packet before forcing a close of the socket. The default is 60 (seconds).
The parameter net.ipv4.tcp_tw_recycle
enables fast recycling of TIME_WAIT sockets. The default is 0 (false). Enabling this can cause Network Address Translation (NAT) issues.
The parameter net.ipv4.tcp_tw_reuse
enables reuse of TIME_WAIT sockets for new connections. The default is 0 (false).
These settings are recommended only for testing, and not for production systems.
After making the changes to /etc/sysctl.conf
, reload the configuration with the sysctl command:
# sysctl -p
Options
The addrate command takes the following options:
Command options:
-a | --deleteAgeThreshold {seconds}
Specifies the age at which added entries will become candidates for deletion.
-B | --warmUpDuration {warmUpDuration}
Warm up duration in seconds.
Default: 0
-c | --numConnections {numConnections}
Number of connections.
Default: 1
-C | --deleteMode {fifo | random | off}
The algorithm used for selecting entries to be deleted which must be one of "fifo", "random", or "off".
Default: FIFO
-d | --maxDuration {maxDuration}
Maximum duration in seconds, 0 for unlimited.
Default: 0
-e | --percentile {percentile}
Calculate max response time for a percentile of operations.
-f | --keepConnectionsOpen
Keep connections open.
Default: false
-F | --noRebind
Keep connections open and do not rebind.
Default: false
-g | --constant {name=value}
A constant that overrides the value set in the template file.
-i | --statInterval {statInterval}
Display results each specified number of seconds.
Default: 5
-m | --maxIterations {maxIterations}
Max iterations, 0 for unlimited.
Default: 0
-M | --targetThroughput {targetThroughput}
Target average throughput to achieve.
Default: 0
-n | --noPurge
Disable the purge phase when the tool stops.
Default: false
-r | --resourcePath {path}
Path to look for template resources (e.g. data files).
The utility looks for resources in the following locations in this order:
The current directory where the command is run.
The resource path directory.
The built-in files.
-R | --randomSeed {seed}
The seed to use for initializing the random number generator. To always generate the same data with the same command, use the same non-zero seed value. A value of zero (the default) results in different data each time the tool is run.
Default: 0
-s | --deleteSizeThreshold {count}
Specifies the number of entries to be added before deletion begins.
Default: 10000
-S | --scriptFriendly
Use script-friendly mode.
Default: false
-t | --numConcurrentRequests {numConcurrentRequests}
Number of concurrent requests per connection.
Default: 1
-Y | --proxyAs {authzID}
Use the proxied authorization control with the given authorization ID.
LDAP connection options:
--connectTimeout {timeout}
Maximum length of time (in milliseconds) that can be taken to establish a connection. Use '0' to specify no time out.
Default: 30000
-D | --bindDn {bindDN}
DN to use to bind to the server.
Default:
-E | --reportAuthzId
Use the authorization identity control.
Default: false
-h | --hostname {host}
Fully-qualified server host name or IP address.
Default: localhost.localdomain
-N | --certNickname {nickname}
Nickname of the certificate that should be sent to the server for SSL client authentication.
-o | --saslOption {name=value}
SASL bind options.
-p | --port {port}
Directory server port number.
-q | --useStartTls
Use StartTLS to secure communication with the server.
Default: false
-T | --trustStorePassword {trustStorePassword}
Truststore cleartext password.
--useJavaKeyStore {keyStorePath}
JKS keystore containing the certificate which should be used for SSL client authentication.
--useJavaTrustStore {trustStorePath}
Use a JKS truststore file for validating server certificate.
--useJceKeyStore {keyStorePath}
JCEKS keystore containing the certificate which should be used for SSL client authentication.
--useJceTrustStore {trustStorePath}
Use a JCEKS truststore file for validating server certificate.
--useJvmTrustStore
Use the a JVM truststore for validating server certificate.
Default: false
--usePasswordPolicyControl
Use the password policy request control.
Default: false
--usePkcs11KeyStore
PKCS#11 keystore containing the certificate which should be used for SSL client authentication.
Default: false
--usePkcs12KeyStore {keyStorePath}
PKCS#12 keystore containing the certificate which should be used for SSL client authentication.
--usePkcs12TrustStore {trustStorePath}
Use a PKCS#12 truststore file for validating server certificate.
-w | --bindPassword {bindPassword}
Password to use to bind to the server. Omit this option while providing the bind DN to ensure that the command prompts for the password, rather than entering the password as a command argument.
-W | --keyStorePassword {keyStorePassword}
Keystore cleartext password.
-X | --trustAll
Trust all server SSL certificates.
Default: false
-Z | --useSsl
Use SSL for secure communication with the server.
Default: false
Utility input/output options:
--no-prompt
Use non-interactive mode. If data in the command is missing, the user is not prompted and the tool will fail.
Default: false
--noPropertiesFile
No properties file will be used to get default command line argument values.
Default: false
--propertiesFilePath {propertiesFilePath}
Path to the file containing default property values used for command line arguments.
-v | --verbose
Use verbose mode.
Default: false
General options:
-V | --version
Display Directory Server version information.
Default: false
-H | --help
Display this usage information.
Default: false
Exit Codes
- 0
The command completed successfully.
- 80
The command could not complete due to an input/output error.
- 89
An error occurred while parsing the command-line arguments.
Examples
The following example adds entries, and then randomly deletes them when more than 10,000 entries have been added:
$addrate \ --hostname localhost \ --port 1389 \ --bindDn uid=admin \ --bindPassword password \ --numConnections 10 \ --keepConnectionsOpen \ --deleteMode random \ --deleteSizeThreshold 10,000 \ /path/to/opendj/config/MakeLDIF/addrate.template
-------------------------------------------------------------------------------------- | Throughput | Response Time | Additional | | (ops/second) | (milliseconds) | Statistics | | recent average | recent average 99.9% 99.99% 99.999% | err/sec Add% | -------------------------------------------------------------------------------------- | 275.3 275.3 | 12.057 12.057 102.76 113.25 113.25 | 0.0 100.00 | | 329.1 302.2 | 10.181 11.036 93.85 113.25 113.25 | 0.0 100.00 | | 339.2 314.5 | 9.719 10.563 113.25 122.16 122.16 | 0.0 100.00 | | 365.6 327.3 | 7.616 9.740 105.91 120.59 122.16 | 0.0 100.00 | | 385.8 339.0 | 7.312 9.187 102.76 120.59 122.16 | 0.0 100.00 | | 366.8 343.6 | 7.776 8.936 99.61 120.59 122.16 | 0.0 91.44 | | 337.2 342.7 | 10.746 9.191 119.01 505.41 509.61 | 0.0 49.61 |
^C
| 372.8 343.8 | 7.662 9.130 119.01 505.41 509.61 | 0.0 50.30 | Purge phase...
The following example also adds entries, and then deletes them in the order they were added after they are 10 seconds old:
$addrate \ --hostname localhost \ --port 1389 \ --bindDn uid=admin \ --bindPassword password \ --numConnections 10 \ --keepConnectionsOpen \ --deleteMode fifo \ --deleteAgeThreshold 10 \ /path/to/opendj/config/MakeLDIF/addrate.template
-------------------------------------------------------------------------------------- | Throughput | Response Time | Additional | | (ops/second) | (milliseconds) | Statistics | | recent average | recent average 99.9% 99.99% 99.999% | err/sec Add% | -------------------------------------------------------------------------------------- | 377.8 377.8 | 7.258 7.258 18.87 20.71 20.71 | 0.0 100.00 | | 393.2 385.5 | 7.069 7.161 18.09 23.20 23.20 | 0.0 100.00 | | 387.8 386.3 | 7.226 7.183 28.18 36.44 37.49 | 0.0 50.05 | | 396.8 388.9 | 6.957 7.125 23.20 36.44 37.49 | 0.0 50.18 | | 400.6 391.2 | 6.906 7.080 19.27 36.44 37.49 | 0.0 49.73 |
^C
| 397.6 391.4 | 7.083 7.080 19.27 36.44 37.49 | 0.0 50.00 | Purge phase...
These examples use the following options:
--hostname localhost
,--port 1389
Access the server running on the local system on port 1389.
--bindDn uid=admin
,--bindPassword password
Authenticate as the directory root user
uid=admin
with the bind password that is literallypassword
.This user is not subject to access control, so rates may be higher than what you observe with a regular user.
--numConnections 10
Open 10 connections to the server.
--keepConnectionsOpen
Keep the connections open to reuse them during the operation.
--deleteMode (random | fifo)
After adding entries, delete them in random order, or in first-in-first-out order.
--deleteSizeThreshold 10,000
Add 10,000 entries before starting to delete them.
--deleteAgeThreshold 10
Begin to delete entries when they are 10 seconds old.
/path/to/opendj/config/MakeLDIF/addrate.template
When building entries to add, use this file as the template.
Notice the following characteristics of the output:
The first two columns show the throughput in operations completed per second.
The recent column shows the average rate for operations reflected in this row of output.
The average column shows the average rate since the beginning of the run.
The response time columns indicate characteristics of response latency in milliseconds.
The recent column shows the average latency for operations reflected in this row of output.
The average column shows the average latency since the beginning of the run.
The "99.9%" column shows the latency after which 99.9% of operations have completed. Only 1 operation in 1000 took longer than this.
The "99.99%" column shows the latency after which 99.99% of operations have completed. Only 1 operation in 10,000 took longer than this.
The "99.999%" column shows the latency after which 99.999% of operations have completed. Only 1 operation in 100,000 took longer than this.
The additional statistics columns show information about what is happening during the run.
The "err/sec" column shows the rate of error results per second for this row of output. Unless you have intentionally set up the command to generate errors, this column should indicate
0.0
. Check that this column matches your expectations before looking at any other columns.The "Add%" column shows the percentage of operations performed that were adds. The rest are delete operations. Notice that the percentage of add operations drops as the command begins to delete entries.