forked from proddata/nodeIngestBench
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove duplicate function * Remove other variants of the scripts * Add eslint * Minor formatting fixes * Fix indentation * Replace usages of ++/-- * Remove unused randomFloat method * Add dangling commas * Use dot notation for environment variables * Allow configuring SSL * No need to pass stats_global as a parameter * Use const where applicable * Use cammel case consistently for naming * Use === * Declare functions before using them * Disable some additional eslint rules for now * Update README.md
- Loading branch information
1 parent
bd848a3
commit 8da3de2
Showing
11 changed files
with
3,093 additions
and
851 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = { | ||
env: { | ||
browser: false, | ||
es2021: true, | ||
}, | ||
extends: [ | ||
'airbnb-base', | ||
], | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
"no-console": "off", | ||
"quotes": "off", | ||
"one-var": "off", | ||
"one-var-declaration-per-line": "off", | ||
"no-inner-declarations": "off", | ||
"no-use-before-define": "off", | ||
"no-restricted-syntax": "off", | ||
"guard-for-in": "off", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,60 @@ | ||
# NodeIngestBench | ||
# Node.js CrateDB Ingest Benchmark | ||
|
||
a simple nodejs script to quickly test ingest performance on CrateDB clusters. | ||
A multi-process Node.js script to run high-performance ingest benchmarks on CrateDB clusters. | ||
The script generates random data and runs batched insert statements against a single table using CrateDB's [HTTP endpoint](https://crate.io/docs/crate/reference/en/4.7/interfaces/http.html). | ||
|
||
top measured performance with single nodejs client : 1 200 000 rows / s | ||
The top measured performance (single Node.js process, seven-node CrateDB cluster with 30 vCPUs each) was 1,200,000 rows/s. | ||
|
||
## new improved version (app.js) | ||
## Setup | ||
|
||
Ubuntu | ||
|
||
```sh | ||
apt update && apt upgrade | ||
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - | ||
apt update | ||
sudo apt-get install -y nodejs | ||
npm install | ||
node app.js --batchsize 20000 --max_rows 1000000 --table "doc.benchmark" --shards 12 --concurrent_requests 20 | ||
``` | ||
|
||
|
||
```env | ||
1. Install Node.js using one of the available [installation methods](https://nodejs.org/en/download/current/) | ||
2. Clone this repository: `git clone https://github.com/proddata/nodeIngestBench.git` | ||
3. Change into the cloned repository: `cd nodeIngestBench` | ||
4. Install dependencies: `npm install` | ||
5. Configure the connection to your CrateDB cluster by creating a `.env` file: | ||
```bash | ||
CRATE_HOST=localhost | ||
CRATE_USER=admin | ||
CRATE_PASSWORD=secret-password | ||
CRATE_DB=doc | ||
CRATE_PORT=4200 | ||
CRATE_SSL=true | ||
``` | ||
|
||
## Running benchmarks | ||
|
||
Start the benchmarking with `node appCluster.js`. The script takes several optional command-line parameters: | ||
* `table`: The name of the table used for benchmarking. The table will automatically be created if it doesn't exist yet. | ||
* `shards`: The number of shards that will be allocated for the table. | ||
* `dropTable`: If `true`, the table will be dropped and re-created when running the script. | ||
* `batchsize`: The number of rows that are inserted as part of a single `INSERT` statement. | ||
* `processes`: The number of child processes that will be spawned. Each child process inserts data independently. | ||
* `concurrent_requests`: Each child process will run this number of concurrent queries. | ||
* `max_rows`: The number of rows after which a child process will terminate. Overall, the (maximum) number of rows that will be inserted is `processes * max_rows`. | ||
|
||
## example run with app.js | ||
## Example | ||
|
||
3 nodes (10 vCPUs) CrateDB cluster | ||
Below is a basic example that was run on a three-node CrateDB cluster with 10 vCPUs each: | ||
|
||
```bash | ||
node app.js --batchsize 20000 --max_rows 1000000 --table "doc.benchmark" --shards 12 --concurrent_requests 20 | ||
$ node appCluster.js --batchsize 20000 --max_rows 1000000 --shards 12 --concurrent_requests 20 --processes 1 | ||
|
||
-------- Options --------- | ||
{ | ||
dropTable: true, | ||
processes: 1, | ||
batchsize: 20000, | ||
max_rows: 6000000, | ||
table: 'doc.benchmark', | ||
table: 'doc.cpu', | ||
shards: 6, | ||
concurrent_requests: 20 | ||
} | ||
-------------------------- | ||
... Buffer updated | ||
-------- Results --------- | ||
[...] | ||
-------- Global Results --------- | ||
Time 25.179 s | ||
Rows 6,020,000 records | ||
Speed 239,088.13 rows per sec | ||
-------- Results --------- | ||
Speed 239,088.13 rows per sec | ||
--------------------------------- | ||
``` | ||
|
||
=> 2,400,000 Metrics / sec | ||
|
||
As each row contains ten numeric metrics, this is equal to a throughput of 2,400,000 metrics/s. |
Oops, something went wrong.