-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
3,716 additions
and
317 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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,19 @@ | ||
VERSION 0.8 | ||
|
||
IMPORT github.com/formancehq/earthly:tags/v0.16.2 AS core | ||
|
||
run: | ||
LOCALLY | ||
ARG args="" | ||
RUN go test -bench="Write" -run ^$ -tags it -report.file ./report/report.json -timeout 60m $args | ||
|
||
generate-graphs: | ||
FROM core+base-image | ||
RUN apk update && apk add nodejs npm | ||
COPY charts /src | ||
COPY ./report/report.json /report/report.json | ||
WORKDIR /src | ||
RUN npm install | ||
RUN npm run build | ||
RUN node index.js | ||
SAVE ARTIFACT *.png AS LOCAL ./report/ |
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,47 +1,46 @@ | ||
# Performance test | ||
|
||
Each feature is tested against a test script involving a transaction from a source to a destination. | ||
The benchmarks also test the minimal set of features and the full set of features. | ||
|
||
Refer to [features](../../CONTRIBUTING.md/#features) for more information about features. | ||
|
||
Three types of script are actually tested: | ||
* world->bank : A transaction from `@world` to `@bank` | ||
* world->any : A transaction from `@world` to `@dst:<iteration>` | ||
* any(unbounded)->any : A transaction from `@src:<iteration>` to `@dst:<iteration>` | ||
|
||
## Run locally | ||
|
||
```shell | ||
go test -bench=. -run ^$ -tags it | ||
earthly +run | ||
``` | ||
|
||
You can pass additional arguments (the underlying command is a standard `go test -bench=.`) using the flag `--args`. | ||
For example: | ||
```shell | ||
earthly +run --args="-benchtime 10s" | ||
``` | ||
|
||
## Run on a remote stack | ||
|
||
```shell | ||
go test -bench=. -run ^$ -tags it \ | ||
--stack.url=XXX \ | ||
--client.id=XXX \ | ||
--client.secret=XXX | ||
earthly +run --args="--stack.url=XXX --client.id=XXX --client.secret=XXX" | ||
``` | ||
|
||
## Run on a remote ledger | ||
|
||
```shell | ||
go test -bench=. -run ^$ -tags it \ | ||
--ledger.url=XXX \ | ||
--auth.url=XXX \ | ||
--client.id=XXX \ | ||
--client.secret=XXX | ||
earthly +run --args="--ledger.url=XXX --auth.url=XXX --client.id=XXX --client.secret=XXX" | ||
``` | ||
|
||
## Results | ||
|
||
The output is a standard go bench output. | ||
TPS is included as a benchmark metrics. | ||
|
||
Additionally, you can pass the flag `-report.dir` to export results: | ||
```shell | ||
go test -bench=testserver -run ^$ -tags it -report.dir . | ||
You can generate some graphs using the command: | ||
``` | ||
earthly +generate-graphs | ||
``` | ||
|
||
The exported files are PNG. | ||
|
||
Each feature is tested against a test script involving a transaction from a source to a destination. | ||
The benchmarks also test the minimal set of features and the full set of features. | ||
|
||
Refer to [features](../../CONTRIBUTING.md/#features) for more information about features. | ||
|
||
Three types of script are actually tested: | ||
* world->bank : A transaction from `@world` to `@bank` | ||
* world->any : A transaction from `@world` to `@dst:<iteration>` | ||
* any(unbounded)->any : A transaction from `@src:<iteration>` to `@dst:<iteration>` | ||
See generated files in `report` directory. |
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,51 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs = __importStar(require("fs")); | ||
require("chartjs-to-image"); | ||
const graphs_1 = require("./src/graphs"); | ||
const main = () => __awaiter(void 0, void 0, void 0, function* () { | ||
let buffer = fs.readFileSync('../report/report.json', 'utf-8'); | ||
let reports = JSON.parse(buffer); | ||
yield (0, graphs_1.exportTPSGraph)({ | ||
output: 'tps.png', | ||
}, reports); | ||
yield (0, graphs_1.exportLatencyGraph)({ | ||
output: 'p99.png' | ||
}, 'P99', reports); | ||
yield (0, graphs_1.exportLatencyGraph)({ | ||
output: 'p95.png' | ||
}, 'P95', reports); | ||
}); | ||
main(); |
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,21 @@ | ||
import * as fs from 'fs'; | ||
import 'chartjs-to-image'; | ||
import {exportLatencyGraph, exportTPSGraph} from "./src/graphs"; | ||
|
||
const main = async () => { | ||
let buffer = fs.readFileSync('../report/report.json', 'utf-8'); | ||
let reports = JSON.parse(buffer); | ||
await exportTPSGraph({ | ||
output: 'tps.png', | ||
}, reports); | ||
|
||
const ps: (keyof MetricsTime)[] = ['P99', 'P95', 'P75', 'Avg'] | ||
for (let p of ps) { | ||
await exportLatencyGraph({ | ||
output: p.toLowerCase() + '.png' | ||
}, p, reports); | ||
} | ||
} | ||
|
||
main(); | ||
|
Oops, something went wrong.