1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

update benchmarks

This commit is contained in:
leibale
2021-12-07 11:01:42 -05:00
parent 12173e1cd7
commit b68f79538c
17 changed files with 248 additions and 91 deletions

View File

@@ -0,0 +1,9 @@
name: "set-get-delete-string-1KB"
clientconfig:
- command: |
npm install -ws
npm run build:tests-tools
cd benchmark
npm install
npm run start -- --name set-get-delete-string --size 1024 --redis-server-host ${server_private_ip}

View File

@@ -0,0 +1,9 @@
name: "set-get-delete-string-1MB"
clientconfig:
- command: |
npm install -ws
npm run build:tests-tools
cd benchmark
npm install
npm run start -- --name set-get-delete-string --size 1048576 --redis-server-host ${server_private_ip}

View File

@@ -0,0 +1,9 @@
name: "set-get-delete-string-8B"
clientconfig:
- command: |
npm install -ws
npm run build:tests-tools
cd benchmark
npm install
npm run start -- --name set-get-delete-string --size 8 --redis-server-host ${server_private_ip}

View File

@@ -1,19 +1,23 @@
import Redis from 'ioredis';
const client = new Redis({ lazyConnect: true });
export default async (host, { randomString }) => {
const client = new Redis({
host,
lazyConnect: true
});
export function setup() {
return client.connect();
}
await client.connect();
export function benchmark({ randomString }) {
return Promise.all([
client.set(randomString, randomString),
client.get(randomString),
client.del(randomString)
]);
}
export function teardown() {
return client.disconnect();
}
return {
benchmark() {
return Promise.all([
client.set(randomString, randomString),
client.get(randomString),
client.del(randomString)
]);
},
teardown() {
return client.disconnect();
}
}
};

View File

@@ -1,19 +0,0 @@
import { createClient } from '@node-redis/client-local';
const client = createClient();
export function setup() {
return client.connect();
}
export function benchmark({ randomString }) {
return Promise.all([
client.set(randomString, randomString),
client.get(randomString),
client.del(randomString)
]);
}
export function teardown() {
return client.disconnect();
}

View File

@@ -1,19 +0,0 @@
import { createClient } from '@node-redis/client-production';
const client = createClient();
export function setup() {
return client.connect();
}
export function benchmark({ randomString }) {
return Promise.all([
client.set(randomString, randomString),
client.get(randomString),
client.del(randomString)
]);
}
export function teardown() {
return client.disconnect();
}

View File

@@ -0,0 +1,27 @@
import { createClient } from 'redis-v3';
import { once } from 'events';
import { promisify } from 'util';
export default async (host, { randomString }) => {
const client = createClient({ host }),
setAsync = promisify(client.set).bind(client),
getAsync = promisify(client.get).bind(client),
delAsync = promisify(client.del).bind(client),
quitAsync = promisify(client.quit).bind(client);
await once(client, 'connect');
return {
benchmark() {
return Promise.all([
setAsync(randomString, randomString),
getAsync(randomString),
delAsync(randomString)
]);
},
teardown() {
return quitAsync();
}
};
};

View File

@@ -0,0 +1,20 @@
import { createClient } from '@node-redis/client';
export default async (host, { randomString }) => {
const client = createClient({ host });
await client.connect();
return {
benchmark() {
return Promise.all([
client.set(randomString, randomString),
client.get(randomString),
client.del(randomString)
]);
},
teardown() {
return client.disconnect();
}
};
};