Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ jobs:
run: pip install -r test-run/requirements.txt

- run: make test-memcached

- run: make test-memcached-capable

- name: Run benchmarks
run: make test-memcached-bench
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<a href="http://tarantool.org">
<img src="https://avatars2.githubusercontent.com/u/2344919?v=2&s=250" align="right">
</a>

[![Static analysis](https://github.com/tarantool/memcached/actions/workflows/check.yaml/badge.svg)](https://github.com/tarantool/memcached/actions/workflows/check.yaml)
[![Testing](https://github.com/tarantool/memcached/actions/workflows/testing.yaml/badge.svg)](https://github.com/tarantool/memcached/actions/workflows/testing.yaml)

Expand Down
2 changes: 1 addition & 1 deletion memcached/internal/proto_bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ memcached_bin_process(struct memcached_connection *con)

/**
* return -1 on error (forced closing of connection)
* return 0 in everything ok
* return 0 if everything ok
* - if con->noprocess == 1 then skip execution
* return >1 if we need more data
*/
Expand Down
4 changes: 4 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ add_dependencies(test-memcached internalso)
add_custom_target(test-memcached-capable
COMMAND ${CMAKE_SOURCE_DIR}/test/test-run.py --suite capable)
add_dependencies(test-memcached-capable libmemcached)

add_custom_target(test-memcached-bench
COMMAND ${CMAKE_SOURCE_DIR}/test/test-run.py --force --long --suite bench)
add_dependencies(test-memcached-bench internalso memtier)
10 changes: 10 additions & 0 deletions test/bench/bench.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env tarantool

box.cfg{
wal_mode = 'none',
memtx_memory = 100 * 1024 * 1024,
}

require('console').listen(os.getenv('ADMIN'))

box.schema.user.grant('guest', 'read,write,execute', 'universe')
15 changes: 0 additions & 15 deletions test/bench/memcached.lua

This file was deleted.

68 changes: 68 additions & 0 deletions test/bench/memtier.test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env tarantool

local tap = require('tap')
local fio = require('fio')
local has_popen, popen = pcall(require, 'popen')
package.cpath = './?.so;' .. package.cpath
local memcached = require('memcached')
local test = tap.test('memcached benchmarks')

if not has_popen then
test:plan(0)
os.exit(0)
end

test:plan(3)

local is_test_run = os.getenv('LISTEN')

if type(box.cfg) == 'function' then
box.cfg{
wal_mode = 'none',
memtx_memory = 100 * 1024 * 1024,
}
box.schema.user.grant('guest', 'read,write,execute', 'universe')
end

local port = 11211
local mc = memcached.create('memcached', tostring(port), {})

local function run_memtier(instance, memtier_path, proto)
instance:cfg({
protocol = proto,
})
local memtier_proto = 'memcache_' .. proto
local memtier_argv = {
memtier_path,
'--server=127.0.0.1',
string.format('--port=%d', port),
string.format('--protocol=%s', memtier_proto),
'--threads=10',
'--test-time=2',
'--hide-histogram'
}

local stdout = is_test_run and popen.opts.PIPE or popen.opts.INHERIT
local stderr = is_test_run and popen.opts.PIPE or popen.opts.INHERIT
local ph = popen.new(memtier_argv, {
stdout = stdout,
stderr = stderr,
})
local res = ph:wait()
ph:close()

return res.exit_code
end

-- path to memtier_benchmark in case of tarantool that run in project root dir
local memtier_path = 'test/bench/memtier_benchmark'
if not fio.path.exists(memtier_path) then
-- path to memtier_benchmark in case of test-run
memtier_path = './memtier_benchmark'
end

test:is(fio.path.exists(memtier_path), true, 'memtier_benchmark binary is available')
test:is(run_memtier(mc, memtier_path, 'text'), 0, 'memtier with text protocol')
test:is(run_memtier(mc, memtier_path, 'binary'), 0, 'memtier with binary protocol')

os.exit(0)
7 changes: 7 additions & 0 deletions test/bench/suite.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[default]
core = app
description = memcached load tests with #! using TAP
script = bench.lua
is_parallel = False
long_run = memtier.test.lua
lua_libs = memtier_benchmark
2 changes: 1 addition & 1 deletion test/binary/binary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

box.cfg{
wal_mode = 'none',
slab_alloc_arena = 0.1,
memtx_memory = 100 * 1024 * 1024,
}

package.cpath = './?.so;' .. package.cpath
Expand Down
2 changes: 1 addition & 1 deletion test/capable/capable.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

box.cfg{
wal_mode = 'none',
slab_alloc_arena = 0.1,
memtx_memory = 100 * 1024 * 1024,
}

package.cpath = './?.so;' .. package.cpath
Expand Down
2 changes: 1 addition & 1 deletion test/sasl/sasl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ env['SASL_CONF_PATH'] = fio.pathjoin(fio.cwd(), '../sasl/config/')

box.cfg{
wal_mode = 'none',
slab_alloc_arena = 0.1,
memtx_memory = 100 * 1024 * 1024,
}

local memcached = require('memcached')
Expand Down
2 changes: 1 addition & 1 deletion test/text/text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

box.cfg{
wal_mode = 'none',
slab_alloc_arena = 0.1,
memtx_memory = 100 * 1024 * 1024,
}

package.cpath = './?.so;' .. package.cpath
Expand Down
2 changes: 1 addition & 1 deletion third_party/memtier
Submodule memtier updated 63 files
+115 −0 .github/workflows/ci.yml
+11 −1 .gitignore
+55 −0 CHANGES
+24 −0 Dockerfile
+137 −0 JSON_handler.cpp
+55 −0 JSON_handler.h
+25 −6 Makefile.am
+10 −0 README.import
+88 −8 README.md
+113 −0 bash-completion/memtier_benchmark
+215 −1,026 client.cpp
+92 −154 client.h
+482 −0 cluster_client.cpp
+62 −0 cluster_client.h
+319 −6 config_types.cpp
+133 −3 config_types.h
+31 −3 configure.ac
+45 −0 connections_manager.h
+5 −0 debian/changelog
+24 −0 debian/control
+41 −0 debian/copyright
+1 −0 debian/manpages
+8 −0 debian/rules
+5 −0 debian/watch
+121 −0 deps/hdr_histogram/COPYING.txt
+41 −0 deps/hdr_histogram/LICENSE.txt
+10 −0 deps/hdr_histogram/README.md
+101 −0 deps/hdr_histogram/byteorder.h
+146 −0 deps/hdr_histogram/hdr_atomic.h
+321 −0 deps/hdr_histogram/hdr_encoding.c
+79 −0 deps/hdr_histogram/hdr_encoding.h
+116 −0 deps/hdr_histogram/hdr_endian.h
+1,154 −0 deps/hdr_histogram/hdr_histogram.c
+512 −0 deps/hdr_histogram/hdr_histogram.h
+1,312 −0 deps/hdr_histogram/hdr_histogram_log.c
+253 −0 deps/hdr_histogram/hdr_histogram_log.h
+98 −0 deps/hdr_histogram/hdr_time.c
+49 −0 deps/hdr_histogram/hdr_time.h
+11 −0 docker-compose.memcached.yml
+11 −0 docker-compose.redis.yml
+ docs/sample_visual_histogram.png
+23 −23 file_io.cpp
+2 −2 file_io.h
+6 −6 item.cpp
+3 −3 item.h
+104 −39 memtier_benchmark.1
+623 −108 memtier_benchmark.cpp
+35 −5 memtier_benchmark.h
+120 −68 obj_gen.cpp
+25 −18 obj_gen.h
+436 −82 protocol.cpp
+117 −20 protocol.h
+1,342 −0 run_stats.cpp
+182 −0 run_stats.h
+283 −0 run_stats_types.cpp
+186 −0 run_stats_types.h
+634 −0 shard_connection.cpp
+188 −0 shard_connection.h
+1 −0 tests/.gitignore
+108 −0 tests/include.py
+39 −0 tests/regression.json
+4 −0 tests/test_requirements.txt
+146 −0 tests/tests_oss_simple_flow.py