Skip to content

Commit

Permalink
finished the first db benchmarking, the result was medium
Browse files Browse the repository at this point in the history
  • Loading branch information
ywarezk committed Mar 8, 2020
1 parent 579a92c commit 857d3d5
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 38 deletions.
11 changes: 9 additions & 2 deletions __tests__/db1/app-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@
*
*/

import express, { Application } from 'express';
import { Application } from 'express';
import { createApp } from '../test-utils';
import { Todo } from './todo.model';

export default function appCreator(isZone = true): Application {
const app = express();
const app = createApp(isZone);

app.get('*', async function(_req, res) {
const todos = await Todo.find();
res.json(todos);
});

return app;
}
19 changes: 19 additions & 0 deletions __tests__/db1/app.benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,30 @@
import 'reflect-metadata';
import appCreator from './app-creator';
import runBenchmarkTest from '../test-utils';
import { createConnection } from 'typeorm';
import { Todo } from './todo.model';

/**
* run benchmarking with zone and without zone
*/
async function main(): Promise<void> {
await createConnection({
type: 'sqlite',
database: 'db.sqlite',
entities: [Todo],
synchronize: true,
});
await Todo.delete({
title: 'stam',
});

for (let i = 0; i < 10000; i++) {
const todo = new Todo();
todo.title = 'stam';
todo.description = 'foo bar';
await todo.save();
}

// zone benchmark
await runBenchmarkTest(appCreator());

Expand Down
86 changes: 86 additions & 0 deletions __tests__/db1/benchmark-report.nozone.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"url": "http://localhost:3000",
"requests": {
"average": 30.45,
"mean": 30.45,
"stddev": 3.41,
"min": 21,
"max": 33,
"total": 274,
"p0_001": 21,
"p0_01": 21,
"p0_1": 21,
"p1": 21,
"p2_5": 21,
"p10": 21,
"p25": 31,
"p50": 31,
"p75": 32,
"p90": 33,
"p97_5": 33,
"p99": 33,
"p99_9": 33,
"p99_99": 33,
"p99_999": 33,
"sent": 284
},
"latency": {
"average": 368.45,
"mean": 368.45,
"stddev": 64.67,
"min": 101,
"max": 465.524389,
"p0_001": 101,
"p0_01": 101,
"p0_1": 101,
"p1": 102,
"p2_5": 113,
"p10": 331,
"p25": 356,
"p50": 382,
"p75": 399,
"p90": 428,
"p97_5": 460,
"p99": 464,
"p99_9": 465,
"p99_99": 465,
"p99_999": 465
},
"throughput": {
"average": 16141425.78,
"mean": 16141425.78,
"stddev": 1802789.96,
"min": 11134620,
"max": 17497260,
"total": 145280280,
"p0_001": 11141119,
"p0_01": 11141119,
"p0_1": 11141119,
"p1": 11141119,
"p2_5": 11141119,
"p10": 11141119,
"p25": 16441343,
"p50": 16441343,
"p75": 16973823,
"p90": 17498111,
"p97_5": 17498111,
"p99": 17498111,
"p99_9": 17498111,
"p99_99": 17498111,
"p99_999": 17498111
},
"errors": 0,
"timeouts": 0,
"mismatches": 0,
"duration": 10.48,
"start": "2020-03-08T20:38:34.911Z",
"finish": "2020-03-08T20:38:45.390Z",
"connections": 10,
"pipelining": 1,
"non2xx": 0,
"1xx": 0,
"2xx": 274,
"3xx": 0,
"4xx": 0,
"5xx": 0
}
86 changes: 86 additions & 0 deletions __tests__/db1/benchmark-report.zone.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"url": "http://localhost:3000",
"requests": {
"average": 27.5,
"mean": 27.5,
"stddev": 4.37,
"min": 21,
"max": 33,
"total": 275,
"p0_001": 21,
"p0_01": 21,
"p0_1": 21,
"p1": 21,
"p2_5": 21,
"p10": 21,
"p25": 23,
"p50": 28,
"p75": 31,
"p90": 31,
"p97_5": 33,
"p99": 33,
"p99_9": 33,
"p99_99": 33,
"p99_999": 33,
"sent": 285
},
"latency": {
"average": 402.32,
"mean": 402.32,
"stddev": 76.38,
"min": 110,
"max": 511.853116,
"p0_001": 110,
"p0_01": 110,
"p0_1": 110,
"p1": 113,
"p2_5": 120,
"p10": 362,
"p25": 388,
"p50": 411,
"p75": 444,
"p90": 465,
"p97_5": 507,
"p99": 510,
"p99_9": 511,
"p99_99": 511,
"p99_999": 511
},
"throughput": {
"average": 14581350.4,
"mean": 14581350.4,
"stddev": 2312677.52,
"min": 11134620,
"max": 17497260,
"total": 145810500,
"p0_001": 11141119,
"p0_01": 11141119,
"p0_1": 11141119,
"p1": 11141119,
"p2_5": 11141119,
"p10": 11141119,
"p25": 12197887,
"p50": 14852095,
"p75": 16441343,
"p90": 16441343,
"p97_5": 17498111,
"p99": 17498111,
"p99_9": 17498111,
"p99_99": 17498111,
"p99_999": 17498111
},
"errors": 0,
"timeouts": 0,
"mismatches": 0,
"duration": 11.2,
"start": "2020-03-08T20:38:23.369Z",
"finish": "2020-03-08T20:38:34.569Z",
"connections": 10,
"pipelining": 1,
"non2xx": 0,
"1xx": 0,
"2xx": 275,
"3xx": 0,
"4xx": 0,
"5xx": 0
}
Binary file added __tests__/db1/db.sqlite
Binary file not shown.
21 changes: 0 additions & 21 deletions __tests__/db1/index.ts

This file was deleted.

15 changes: 0 additions & 15 deletions __tests__/db1/ormconfig.json

This file was deleted.

0 comments on commit 857d3d5

Please sign in to comment.