2
0
mirror of https://github.com/boostorg/redis.git synced 2026-01-19 04:42:09 +00:00

Adds nodejs echo_server benchmark program.

This commit is contained in:
Marcelo Zimbres
2022-06-19 14:12:10 +02:00
parent b058cc0c02
commit 8af1c9f19c
6 changed files with 23 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ EXTRA_PROGRAMS += commands
if HAVE_CXX20
EXTRA_PROGRAMS += echo_server
EXTRA_PROGRAMS += echo_server_direct
EXTRA_PROGRAMS += echo_server_over_redis
EXTRA_PROGRAMS += chat_room
EXTRA_PROGRAMS += echo_server_client
endif
@@ -47,9 +48,10 @@ adapter_SOURCES = $(top_srcdir)/examples/adapter.cpp
if HAVE_CXX20
test_high_level_SOURCES = $(top_srcdir)/tests/high_level.cpp
echo_server_SOURCES = $(top_srcdir)/examples/echo_server.cpp
echo_server_over_redis_SOURCES = $(top_srcdir)/benchmarks/echo_server_over_redis.cpp
echo_server_direct_SOURCES = $(top_srcdir)/tools/echo_server_direct.cpp
chat_room_SOURCES = $(top_srcdir)/examples/chat_room.cpp
echo_server_client_SOURCES = $(top_srcdir)/tools/echo_server_client.cpp
echo_server_client_SOURCES = $(top_srcdir)/benchmarks/echo_server_client.cpp
endif
nobase_include_HEADERS =\

View File

@@ -0,0 +1,7 @@
var net = require('net');
net.createServer(function(socket){
socket.on('data', function(data){
socket.write(data.toString())
});
}).listen(55555);

View File

@@ -0,0 +1,13 @@
import { createClient } from 'redis';
import * as net from 'net';
const client = createClient();
client.on('error', (err) => console.log('Redis Client Error', err));
await client.connect();
net.createServer(function(socket){
socket.on('data', async function(data) {
const value = await client.ping(data.toString());
socket.write(data)
});
}).listen(55555);