You've already forked node-redis
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:
9
benchmark/lib/set-get-delete-string/1KB.yml
Normal file
9
benchmark/lib/set-get-delete-string/1KB.yml
Normal 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}
|
9
benchmark/lib/set-get-delete-string/1MB.yml
Normal file
9
benchmark/lib/set-get-delete-string/1MB.yml
Normal 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}
|
9
benchmark/lib/set-get-delete-string/8B.yml
Normal file
9
benchmark/lib/set-get-delete-string/8B.yml
Normal 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}
|
@@ -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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -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();
|
||||
}
|
@@ -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();
|
||||
}
|
27
benchmark/lib/set-get-delete-string/v3.js
Normal file
27
benchmark/lib/set-get-delete-string/v3.js
Normal 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();
|
||||
}
|
||||
};
|
||||
|
||||
};
|
20
benchmark/lib/set-get-delete-string/v4.js
Normal file
20
benchmark/lib/set-get-delete-string/v4.js
Normal 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();
|
||||
}
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user