Constructor
new CommandQueuePolicy(propsopt)
- Description:
Initializes a new CommandQueuePolicy from the provided policy values.
- Source:
- See:
-
Aerospike.setupGlobalCommandQueue
- function used to initialize the global command queue.
Example
const Aerospike = require('aerospike')
const policy = {
maxCommandsInProcess: 50,
maxCommandsInQueue: 150
}
Aerospike.setupGlobalCommandQueue(policy)
Aerospike.connect()
.then(client => {
let commands = []
for (var i = 0; i < 100; i++) {
let cmd = client.put(new Aerospike.Key('test', 'test', i), {i: i})
commands.push(cmd)
}
// First 50 commands will be executed immediately,
// remaining commands will be queued and executed once the client frees up.
Promise.all(commands)
.then(() => console.info('All commands executed successfully'))
.catch(error => console.error('Error:', error))
.then(() => client.close())
})
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object |
<optional> |
Policy values Properties
|
Members
maxCommandsInProcess :Number
- Description:
Maximum number of commands that can be processed at any point in time. Each executing command requires a socket connection. Consuming too many sockets can negatively affect application reliability and performance. If you do not limit command count in your application, this setting should be used to enforce a limit internally in the client.
If this limit is reached, the next command will be placed on the client's command queue for later execution. If this limit is zero, all commands will be executed immediately and the command queue will not be used. (Note:
Config#maxConnsPerNode
may still limit number of connections per cluster node.)If defined, a reasonable value is 40. The optimal value will depend on the CPU speed and network bandwidth.
- Source:
- Default Value:
- 0 (execute all commands immediately)
Maximum number of commands that can be processed at any point in time. Each executing command requires a socket connection. Consuming too many sockets can negatively affect application reliability and performance. If you do not limit command count in your application, this setting should be used to enforce a limit internally in the client.
If this limit is reached, the next command will be placed on the
client's command queue for later execution. If this limit is zero, all
commands will be executed immediately and the command queue will not be
used. (Note: Config#maxConnsPerNode
may still limit number of
connections per cluster node.)
If defined, a reasonable value is 40. The optimal value will depend on the CPU speed and network bandwidth.
Type:
- Number
maxCommandsInProcess :Number
- Description:
Maximum number of commands that can be processed at any point in time. Each executing command requires a socket connection. Consuming too many sockets can negatively affect application reliability and performance. If you do not limit command count in your application, this setting should be used to enforce a limit internally in the client.
If this limit is reached, the next command will be placed on the client's command queue for later execution. If this limit is zero, all commands will be executed immediately and the command queue will not be used. (Note:
Config#maxConnsPerNode
may still limit number of connections per cluster node.)If defined, a reasonable value is 40. The optimal value will depend on the CPU speed and network bandwidth.
- Source:
- Default Value:
- 0 (execute all commands immediately)
Maximum number of commands that can be processed at any point in time. Each executing command requires a socket connection. Consuming too many sockets can negatively affect application reliability and performance. If you do not limit command count in your application, this setting should be used to enforce a limit internally in the client.
If this limit is reached, the next command will be placed on the
client's command queue for later execution. If this limit is zero, all
commands will be executed immediately and the command queue will not be
used. (Note: Config#maxConnsPerNode
may still limit number of
connections per cluster node.)
If defined, a reasonable value is 40. The optimal value will depend on the CPU speed and network bandwidth.
Type:
- Number
maxCommandsInQueue :Number
- Description:
Maximum number of commands that can be stored in the global command queue for later execution. Queued commands consume memory, but they do not consume sockets. This limit should be defined when it's possible that the application executes so many commands that memory could be exhausted.
If this limit is reached, the next command will be rejected with error code
ERR_ASYNC_QUEUE_FULL
. If this limit is zero, all commands will be accepted into the delay queue.The optimal value will depend on the application's magnitude of command bursts and the amount of memory available to store commands.
- Source:
- Default Value:
- 0 (no command queue limit)
Maximum number of commands that can be stored in the global command queue for later execution. Queued commands consume memory, but they do not consume sockets. This limit should be defined when it's possible that the application executes so many commands that memory could be exhausted.
If this limit is reached, the next command will be rejected with error
code ERR_ASYNC_QUEUE_FULL
. If this limit is zero, all
commands will be accepted into the delay queue.
The optimal value will depend on the application's magnitude of command bursts and the amount of memory available to store commands.
Type:
- Number
maxCommandsInQueue :Number
- Description:
Maximum number of commands that can be stored in the global command queue for later execution. Queued commands consume memory, but they do not consume sockets. This limit should be defined when it's possible that the application executes so many commands that memory could be exhausted.
If this limit is reached, the next command will be rejected with error code
ERR_ASYNC_QUEUE_FULL
. If this limit is zero, all commands will be accepted into the delay queue.The optimal value will depend on the application's magnitude of command bursts and the amount of memory available to store commands.
- Source:
- Default Value:
- 0 (no command queue limit)
Maximum number of commands that can be stored in the global command queue for later execution. Queued commands consume memory, but they do not consume sockets. This limit should be defined when it's possible that the application executes so many commands that memory could be exhausted.
If this limit is reached, the next command will be rejected with error
code ERR_ASYNC_QUEUE_FULL
. If this limit is zero, all
commands will be accepted into the delay queue.
The optimal value will depend on the application's magnitude of command bursts and the amount of memory available to store commands.
Type:
- Number
queueInitialCapacity :Number
- Description:
Initial capacity of the command queue. The command queue can resize beyond this initial capacity.
- Source:
- Default Value:
- 256 (if command queue is used)
Initial capacity of the command queue. The command queue can resize beyond this initial capacity.
Type:
- Number
queueInitialCapacity :Number
- Description:
Initial capacity of the command queue. The command queue can resize beyond this initial capacity.
- Source:
- Default Value:
- 256 (if command queue is used)
Initial capacity of the command queue. The command queue can resize beyond this initial capacity.
Type:
- Number