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
1 change: 0 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -21032,7 +21032,6 @@ $as_echo "#define HAVE_GCC__ATOMIC_INT64_CAS 1" >>confdefs.h

fi


# Check for x86 cpuid instruction
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __get_cpuid" >&5
$as_echo_n "checking for __get_cpuid... " >&6; }
Expand Down
69 changes: 69 additions & 0 deletions contrib/interconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,75 @@ SendChunk/RecvTupleChunk() {

```

# interconnect test && bench

In the path `contrib/interconnect/test`, the test of the interconnect and the benchmark are implemented, also need to be compiled separately.

For proxy type interconnect, user need to compile `cbdb` with `--enable-ic-proxy` to make the test take effect.

compile test and benchmark

```
cd contrib/interconnect/test
mkdir build && cd build
cmake ..
make -j
```

Notice that: for now, only `single client + single server` is supported in testing and benchmarking.

## bench result

test env

- system: CentOS Linux release 7.5.1804
- machine: qingcloud e2, x86, 8 cpu, 16G memory
- mtu: 1500
- buffer size: 200
- time: 100s


tcp result:

```
+----------------+------------+
| Total time(s) | 100.000 |
| Loop times | 48045111 |
| LPS(l/ms) | 480.451 |
| Recv mbs | 65430 |
| TPS(mb/s) | 654.301 |
| Recv counts | 336315777 |
| Items ops/ms | 3363.157 |
+----------------+------------+
```

proxy result:

```
+----------------+------------+
| Total time(s) | 100.118 |
| Loop times | 11447670 |
| LPS(l/ms) | 114.342 |
| Recv mbs | 15589 |
| TPS(mb/s) | 155.716 |
| Recv counts | 80133690 |
| Items ops/ms | 800.393 |
+----------------+------------+
```

udpifc result:

```
+----------------+------------+
| Total time(s) | 100.079 |
| Loop times | 369104 |
| LPS(l/ms) | 3.688 |
| Recv mbs | 502 |
| TPS(mb/s) | 5.023 |
| Recv counts | 2583728 |
| Items ops/ms | 25.817 |
+----------------+------------+
```

Notice that: Lower TPS does not mean the protocol is slower, might means that the cpu time taken by the protocol is low. For the udpifc, it satisfies the highest tps required by `cbdb`. at the same time it occupies a lower cpu than other types of interconnect.

90 changes: 90 additions & 0 deletions contrib/interconnect/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
project(interconnect_ext)

cmake_minimum_required (VERSION 3.11.0)
set(CMAKE_CXX_STANDARD 14)

find_program(
PG_CONFIG pg_config
HINTS ${PG_PATH}
PATH_SUFFIXES bin
DOC "The path to the pg_config of the CBDB version to compile against")

if(NOT PG_CONFIG)
message(FATAL_ERROR "Unable to find 'pg_config'")
endif()

function(GET_PG_CONFIG var)
set(_temp)

# Only call pg_config if the variable didn't already have a value.
if(NOT ${var})
execute_process(
COMMAND ${PG_CONFIG} ${ARGN}
OUTPUT_VARIABLE _temp
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

set(${var}
${_temp}
PARENT_SCOPE)
endfunction()

# Get CBDB configuration from pg_config
get_pg_config(PG_INCLUDEDIR --includedir)

set(TOP_DIR ../../..)
set(UNIT_TEST_DIR ${TOP_DIR}/src/test/unit/cmockery/)
set(UNIT_TEST_MOCK_DIR ${TOP_DIR}/src/test/unit/mock/)
set(IC_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../)
set(CBDB_INCLUDE_DIR ${PG_INCLUDEDIR}/postgresql/server)

add_definitions(-DENABLE_IC_PROXY)

set(interconnect_src
../ic_common.c
../ic_modules.c
../tcp/ic_tcp.c
../udp/ic_udpifc.c
../proxy/ic_proxy_main.c
../proxy/ic_proxy_client.c
../proxy/ic_proxy_peer.c
../proxy/ic_proxy_router.c
../proxy/ic_proxy_backend.c
../proxy/ic_proxy_addr.c
../proxy/ic_proxy_key.c
../proxy/ic_proxy_packet.c
../proxy/ic_proxy_pkt_cache.c
../proxy/ic_proxy_iobuf.c)

set(interconnect_ext_test_src
${UNIT_TEST_DIR}/cmockery.c
ic_test_env.c
elog_mock.c
ic_interface_test.c)

set(ic_bench_src
${UNIT_TEST_DIR}/cmockery.c
ic_test_env.c
elog_mock.c
ic_bench.c)

SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")

add_compile_definitions(ENABLE_IC_PROXY)
link_directories($ENV{GPHOME}/lib)
add_executable(interconnect_ext_test ${interconnect_src} ${interconnect_ext_test_src})
target_include_directories(interconnect_ext_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} "${CBDB_INCLUDE_DIR}" "${IC_MODULE_DIR}" "${UNIT_TEST_DIR}")

target_link_libraries(interconnect_ext_test PUBLIC
pthread
uv
postgres)

link_directories($ENV{GPHOME}/lib)
add_executable(ic_bench ${interconnect_src} ${ic_bench_src})
target_include_directories(ic_bench PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} "${CBDB_INCLUDE_DIR}" "${IC_MODULE_DIR}" "${UNIT_TEST_DIR}")
target_link_libraries(ic_bench PUBLIC
pthread
uv
postgres)
Loading