addrate
addrate
— measure add and delete throughput and response time
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 1636 -Z -X -D uid=admin -w password -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 1636 -Z -X -D uid=admin -w password -f -c 10 -C fifo -a 2 addrate.template
For details about the template file, see the documentation.
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.
--providerArg {argument}
-
Configuration argument for the PKCS#11 provider.
--providerClass {class}
-
Full class name of the PKCS#11 provider.
--providerName {name}
-
Name of the PKCS#11 provider.
-q | --useStartTls
-
Use StartTLS to secure communication with the server. Default: false
-T | --trustStorePassword[:env|:file] {trustStorePassword}
-
Truststore password which will be used as the cleartext configuration value.
--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 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[:env|:file] {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[:env|:file] {keyStorePassword}
-
Keystore password which will be used as the cleartext configuration value.
-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 1636 \ --useSsl \ --usePkcs12TrustStore /path/to/opendj/config/keystore \ --trustStorePassword:file /path/to/opendj/config/keystore.pin \ --bindDn uid=admin \ --bindPassword password \ --numConnections 10 \ --keepConnectionsOpen \ --deleteMode random \ --deleteSizeThreshold 10,000 \ --maxDuration 30 \ /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% | -------------------------------------------------------------------------------------- | 499.7 499.7 | 13.666 13.666 141.56 212.86 212.86 | 0.0 100.00 | | 1114.4 807.0 | 6.340 8.608 98.04 167.77 212.86 | 0.0 100.00 | | 1441.8 1018.6 | 4.946 6.880 72.35 167.77 212.86 | 0.0 63.36 | | 1554.5 1152.6 | 4.615 6.116 53.74 167.77 212.86 | 0.0 49.98 | | 1708.2 1263.7 | 4.176 5.592 49.55 141.56 212.86 | 0.0 49.96 | | 1112.6 1238.5 | 6.455 5.721 51.38 203.42 212.86 | 0.0 50.02 | | 611.1 1238.2 | 9.125 5.722 51.38 203.42 212.86 | 0.0 0.00 | Purge phase... 9999 entries have been successfully purged
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 1636 \ --useSsl \ --usePkcs12TrustStore /path/to/opendj/config/keystore \ --trustStorePassword:file /path/to/opendj/config/keystore.pin \ --bindDn uid=admin \ --bindPassword password \ --numConnections 10 \ --keepConnectionsOpen \ --deleteMode fifo \ --deleteAgeThreshold 10 \ --maxDuration 30 \ /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% | -------------------------------------------------------------------------------------- | 1489.6 1489.6 | 4.585 4.585 28.70 31.20 51.64 | 0.0 100.00 | | 1262.8 1376.2 | 5.698 5.096 41.68 52.69 55.31 | 0.0 100.00 | | 1596.2 1449.5 | 4.430 4.851 36.18 52.43 55.31 | 0.0 50.71 | | 1237.8 1396.6 | 5.859 5.075 44.56 115.34 119.01 | 0.0 50.00 | | 1156.0 1348.5 | 6.195 5.267 44.83 115.34 119.01 | 0.0 49.96 | | 1373.3 1352.6 | 5.226 5.260 46.40 114.82 119.01 | 0.0 49.99 | Purge phase... Purge in progress: 8195/13885 entries deleted (1638.2 ops/sec). ETA 00:00:03
These examples use the following options:
--hostname localhost
,--port 1636
,--useSsl
,--usePkcs12TrustStore /path/to/opendj/config/keystore
,--trustStorePassword:file /path/to/opendj/config/keystore.pin
-
Access the server running on the local system over a secure LDAPS connection to port 1636.
--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.
--maxDuration 30
-
Run for a maximum of 30 seconds.
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.