Comparing version 7.2.0 to 7.3.0
@@ -17,2 +17,29 @@ # Changelog | ||
## [7.3.0] - 2021-03-08 | ||
### Changed | ||
- Changed the default for `agentOptions.scheduling` to `"lifo"` | ||
This is already the default in Node v15.6 but can reduce latency caused by | ||
sockets expiring, especially with larger connection pools and infrequent | ||
requests. | ||
- Removed `keepAlive`-specific throughput optimization | ||
Previously arangojs would allow `agentOptions.maxSockets * 2` concurrent | ||
requests, to optimize socket reuse by avoiding idle time. This behavior | ||
could trigger deadlocks when attempting to perform multiple transactions | ||
in parallel and only marginally improved throughput in some high-load | ||
scenarios. The connection pool size now always reflects the value set in | ||
`agentOptions.maxSockets` regardless of whether `keepAlive` is enabled. | ||
- Changed `agentOptions.maxSockets` default value when using `ROUND_ROBIN` | ||
As the connection pool is shared across all server connections when using | ||
`ROUND_ROBIN` load balancing, the default value of `3` is too limiting for | ||
most scenarios involving multiple coordinators. When passing multiple URLs | ||
via the `url` option and specifying `ROUND_ROBIN` load balancing, arangojs | ||
will now default this value to `url.length * 3` instead. | ||
## [7.2.0] - 2020-12-02 | ||
@@ -1130,2 +1157,3 @@ | ||
[7.3.0]: https://github.com/arangodb/arangojs/compare/v7.2.0...v7.3.0 | ||
[7.2.0]: https://github.com/arangodb/arangojs/compare/v7.1.1...v7.2.0 | ||
@@ -1132,0 +1160,0 @@ [7.1.1]: https://github.com/arangodb/arangojs/compare/v7.1.0...v7.1.1 |
@@ -378,7 +378,13 @@ /// <reference types="node" /> | ||
* | ||
* The option `maxSockets` can also be used to limit how many requests | ||
* The option `maxSockets` is also used to limit how many requests | ||
* arangojs will perform concurrently. The maximum number of requests is | ||
* equal to `maxSockets * 2` with `keepAlive: true` or equal to `maxSockets` | ||
* with `keepAlive: false` (or in the browser). | ||
* equal to `maxSockets`. | ||
* | ||
* **Note:** arangojs will limit the number of concurrent requests based on | ||
* this value even if an `agent` is provided. | ||
* | ||
* **Note:** when using `ROUND_ROBIN` load balancing and passing an array of | ||
* URLs in the `url` option, the default value of `maxSockets` will be set | ||
* to `3 * url.length` instead of `3`. | ||
* | ||
* Default (Node.js): `{ maxSockets: 3, keepAlive: true, keepAliveMsecs: 1000 }` | ||
@@ -385,0 +391,0 @@ * |
@@ -70,2 +70,3 @@ "use strict"; | ||
constructor(config = {}) { | ||
var _a, _b; | ||
this._activeTasks = 0; | ||
@@ -78,2 +79,8 @@ this._arangoVersion = 30400; | ||
this._transactionId = null; | ||
const URLS = config.url | ||
? Array.isArray(config.url) | ||
? config.url | ||
: [config.url] | ||
: ["http://localhost:8529"]; | ||
const MAX_SOCKETS = 3 * (config.loadBalancingStrategy === "ROUND_ROBIN" ? URLS.length : 1); | ||
if (config.arangoVersion !== undefined) { | ||
@@ -84,14 +91,13 @@ this._arangoVersion = config.arangoVersion; | ||
this._agentOptions = request_1.isBrowser | ||
? { maxSockets: 3, ...config.agentOptions } | ||
? { maxSockets: MAX_SOCKETS, ...config.agentOptions } | ||
: { | ||
maxSockets: 3, | ||
maxSockets: MAX_SOCKETS, | ||
keepAlive: true, | ||
keepAliveMsecs: 1000, | ||
scheduling: "lifo", | ||
...config.agentOptions, | ||
}; | ||
this._maxTasks = this._agentOptions.maxSockets; | ||
if (this._agentOptions.keepAlive) | ||
this._maxTasks *= 2; | ||
this._headers = { ...config.headers }; | ||
this._loadBalancingStrategy = config.loadBalancingStrategy || "NONE"; | ||
this._loadBalancingStrategy = (_a = config.loadBalancingStrategy) !== null && _a !== void 0 ? _a : "NONE"; | ||
this._useFailOver = this._loadBalancingStrategy !== "ROUND_ROBIN"; | ||
@@ -105,10 +111,5 @@ this._precaptureStackTraces = Boolean(config.precaptureStackTraces); | ||
this._shouldRetry = true; | ||
this._maxRetries = config.maxRetries || 0; | ||
this._maxRetries = (_b = config.maxRetries) !== null && _b !== void 0 ? _b : 0; | ||
} | ||
const urls = config.url | ||
? Array.isArray(config.url) | ||
? config.url | ||
: [config.url] | ||
: ["http://localhost:8529"]; | ||
this.addToHostList(urls); | ||
this.addToHostList(URLS); | ||
if (config.auth) { | ||
@@ -115,0 +116,0 @@ if (isBearerAuth(config.auth)) { |
{ | ||
"name": "arangojs", | ||
"version": "7.2.0", | ||
"version": "7.3.0", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=10" |
@@ -12,7 +12,7 @@ # ArangoDB JavaScript Driver | ||
* [API Documentation](https://arangodb.github.io/arangojs/latest/modules/_index_.html) | ||
- [API Documentation](https://arangodb.github.io/arangojs/latest/modules/_index_.html) | ||
* [Changelog](https://arangodb.github.io/arangojs/CHANGELOG) | ||
- [Changelog](https://arangodb.github.io/arangojs/CHANGELOG) | ||
* [Migration Guide](http://arangodb.github.io/arangojs/MIGRATING) | ||
- [Migration Guide](http://arangodb.github.io/arangojs/MIGRATING) | ||
@@ -325,3 +325,3 @@ ## Install | ||
### Streaming transactions | ||
### Streaming transactions leak | ||
@@ -348,2 +348,18 @@ When using the `transaction.step` method it is important to be aware of the | ||
### Streaming transactions timeout in cluster | ||
Transactions have | ||
[different guarantees](https://www.arangodb.com/docs/stable/transactions-limitations.html#in-clusters) | ||
in a cluster. | ||
When using arangojs in a cluster with load balancing, you may need to adjust | ||
the value of `agentOptions.maxSockets` to accommodate the number of transactions | ||
you need to be able to run in parallel. The default value is likely to be too | ||
low for most cluster scenarios involving frequent streaming transactions. | ||
**Note**: When using a high value for `agentOptions.maxSockets` you may have | ||
to adjust the maximum number of threads in the ArangoDB configuration using | ||
[the `server.maximal-threads` option](https://www.arangodb.com/docs/3.7/programs-arangod-server.html#server-threads) | ||
to support larger numbers of concurrent transactions on the server side. | ||
## License | ||
@@ -350,0 +366,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2084229
18216
366