Skip to content

Instantly share code, notes, and snippets.

@locker
locker / tnt-vshard-bench.go
Last active July 5, 2021 16:02
Tarantool vshard microbenchmark
package main
import (
"flag"
"fmt"
"log"
"strings"
"sync"
"time"
"github.com/tarantool/go-tarantool"
@locker
locker / tarantool-port-msgpack-dump-array-as-tuple.patch
Last active July 6, 2021 14:43
Make Tarantool pass msgpack arrays as tuples (instead of tables) to Lua calls
diff --git a/src/box/lua/misc.cc b/src/box/lua/misc.cc
index e356f2d4b996..d82822cef2d1 100644
--- a/src/box/lua/misc.cc
+++ b/src/box/lua/misc.cc
@@ -90,8 +90,17 @@ port_msgpack_dump_lua(struct port *base, struct lua_State *L, bool is_flat)
const char *args = port->data;
uint32_t arg_count = mp_decode_array(&args);
- for (uint32_t i = 0; i < arg_count; i++)
- luamp_decode(L, luaL_msgpack_default, &args);
@locker
locker / tnt-bench.go
Created July 8, 2021 12:10
Tarantool Go connector microbenchmark
package main
import (
"flag"
"fmt"
"log"
"sync"
"time"
"github.com/tarantool/go-tarantool"
)
@locker
locker / tnt-bench.c
Last active July 8, 2021 12:51
Tarantool C connector microbenchmark
/*
== BUILD & RUN ==
# build msgpuck lib
git clone git@github.com:tarantool/msgpuck.git
cd msgpuck
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo
cd ..
@locker
locker / tnt-bench.cpp
Last active July 8, 2021 12:55
Tarantool C++ connector microbenchmark
/*
== BUILD & RUN ==
# get tncxx lib
git clone git@github.com:tarantool/tntcxx.git
# build & run the test
g++ tnt-bench.cpp -o tnt-bench-cxx -Itntcxx/src -DNDEBUG -lrt -O2 --std=c++17
./tnt-bench-cxx
@locker
locker / tnt-bench.lua
Created July 8, 2021 12:46
Tarantool net.box connector microbenchmark
clock = require('clock')
fiber = require('fiber')
net_box = require('net.box')
function test(method)
print('==== TEST(' .. method .. ') ====')
local conn = net_box.connect('127.0.0.1:3301')
local n_iters = 500
local n_reqs_per_iter = 2000
local n_reqs = n_iters * n_reqs_per_iter
@locker
locker / tarantool-net-box-call-in-c.patch
Last active July 8, 2021 14:29
POC: Rewrite Tarantool net.box.call in C
diff --git a/src/box/lua/net_box.c b/src/box/lua/net_box.c
index 3f43872ca2e4..edd7ea90b4c7 100644
--- a/src/box/lua/net_box.c
+++ b/src/box/lua/net_box.c
@@ -38,13 +38,16 @@
#include "box/iproto_constants.h"
#include "box/lua/tuple.h" /* luamp_convert_tuple() / luamp_convert_key() */
#include "box/xrow.h"
+#include "box/xrow_io.h"
#include "box/tuple.h"
@locker
locker / tnt-bench-fiber.lua
Created July 8, 2021 14:08
Tarantool net.box connector microbenchmark implemented using fibers
clock = require('clock')
fiber = require('fiber')
net_box = require('net.box')
function test(method)
print('==== TEST(' .. method .. ') ====')
local conn = net_box.connect('127.0.0.1:3301')
local n_iters = 500
local n_reqs_per_iter = 2000
local n_reqs = n_iters * n_reqs_per_iter
@locker
locker / tnt-bench-call.lua
Created July 9, 2021 09:48
Tarantool net.box.call microbenchmark
clock = require('clock')
fiber = require('fiber')
net_box = require('net.box')
function test(n_args)
print('==== TEST(' .. n_args .. ' ARGS) ====')
local call_args = {}
for i = 1, n_args do
table.insert(call_args, {i, 123, {i, "abc", "def"}})
end
@locker
locker / tarantool-net-box-do-not-use-fiber-cond.patch
Created July 9, 2021 16:11
POC: do not use fiber.cond in Tarantool net.box
diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
index 3878abf21914..04e3f6c6b5a2 100644
--- a/src/box/lua/net_box.lua
+++ b/src/box/lua/net_box.lua
@@ -367,7 +367,7 @@ local function create_transport(host, port, user, password, callback,
local timeout = iterator.timeout
repeat
local ts = fiber_clock()
- request.cond:wait(timeout)
+ fiber.sleep(timeout)