Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
49eff5f
Asio custom handler allocation
mabrarov Feb 18, 2019
6bda46f
Fixed build errors and makefile
mabrarov Feb 18, 2019
bf8db6e
Fixed build errors and migrated Makefile to CMake
mabrarov Feb 18, 2019
1367153
Fixed formatting to make code looks more production like
mabrarov Feb 18, 2019
06b8643
Removed unused stuff from CMake project
mabrarov Feb 19, 2019
efdc636
Migrated test client to CMake
mabrarov Feb 19, 2019
8a982f8
Migrated test client to CMake
mabrarov Feb 19, 2019
ec0e84b
Migrated test client to CMake
mabrarov Feb 19, 2019
216f1ba
Fixed build errors of test client
mabrarov Feb 19, 2019
a5af621
Docker images for test client and c++-virtan server
mabrarov Feb 19, 2019
7979097
Docker images for test client and c++-virtan server
mabrarov Feb 19, 2019
39ada51
Fixed CMake project for client-c++-virtan and c++-virtan, added .giti…
mabrarov Feb 19, 2019
ca0baf5
Fixed building ot test client on Windows - switched from pthread slee…
mabrarov Feb 19, 2019
8c811f6
More standard C++ in test client
mabrarov Feb 21, 2019
49334b9
More standard C++ in test client and c++-virtan
mabrarov Feb 21, 2019
8a2e9da
std::steady::clock in test client
mabrarov Feb 21, 2019
e5aee09
std::steady::clock in test client
mabrarov Feb 21, 2019
f35684e
Fixed stop of test client
mabrarov Feb 21, 2019
001625d
Reverted changes in formatting
mabrarov Feb 21, 2019
b0b23f1
Minor formatting of test client
mabrarov Feb 21, 2019
31baa24
Switched test client to std::shared_from_this in order to keep memory…
mabrarov Feb 21, 2019
143ba8b
Replaced C rand with C++11 random device and distribution
mabrarov Feb 23, 2019
f348d66
Replaced C rand with C++11 random device and distribution
mabrarov Feb 24, 2019
5017c26
Replaced C rand with C++11 random device and distribution, replaced r…
mabrarov Feb 24, 2019
2532047
Fixed usage of boost::asio::async_write composed operation
mabrarov Feb 24, 2019
633ecc4
Re-worked work with timer to support custom handler allocation in tes…
mabrarov Feb 24, 2019
65c4224
Asio custom handler allocation in test client
mabrarov Feb 24, 2019
2108da2
Re-worked stopping of test client to terminate stats immideately when…
mabrarov Feb 24, 2019
0903971
Changed output of test client to make it easier to find final stats line
mabrarov Feb 24, 2019
e4ee868
Redirected usage output of test client to stderr
mabrarov Feb 24, 2019
2bf091d
Reverted final stats output and added test script to run test multipl…
mabrarov Feb 24, 2019
267285a
Pre-allocation of client sessions and Asio concurrency hint in test c…
mabrarov Feb 24, 2019
e8c3c6a
Asio concurrency hint and std::array for buffer in c++-virtan
mabrarov Feb 24, 2019
b161d1d
Fixed missing include in test client
mabrarov Feb 24, 2019
6889629
Merge pull request #1 from mabrarov/feature/test_client_tuned
mabrarov Feb 25, 2019
46a3176
Minor fix of error handling in test script
mabrarov Feb 25, 2019
73c1832
Reduced heap usage and global state in test client
mabrarov Mar 2, 2019
261c149
Code style fixes in c++-virtan, removed usage of ref counting in test…
mabrarov Mar 2, 2019
d698b90
Fixed lifetime of read / write buffers in test client (should live ti…
mabrarov Mar 2, 2019
0aa4e9a
README for c++-virtan implementation and renaming docker images for c…
mabrarov Mar 22, 2019
129fe7a
README for test client and renamed docker image for test client to ma…
mabrarov Mar 22, 2019
98f5884
Configurable duration of test in test client
mabrarov Mar 24, 2019
c2559e3
Renamed default docker image with test client in test script to match…
mabrarov Mar 26, 2019
2a5ef8b
Windows support in test client and initial Windows support in c++-vir…
mabrarov Sep 27, 2020
644bdc4
Implemented stop in c++-virtan
mabrarov Sep 27, 2020
da7899d
Reformatting
mabrarov Sep 27, 2020
6102bdb
Refactoring and renaming
mabrarov Sep 27, 2020
51b8ee7
Enhanced README
mabrarov Sep 27, 2020
e993dc5
Optimization of docker images
mabrarov Nov 2, 2020
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
2 changes: 2 additions & 0 deletions c++-virtan/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build/
/.idea/
40 changes: 40 additions & 0 deletions c++-virtan/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
cmake_minimum_required(VERSION 3.0)
project(server)

set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost REQUIRED COMPONENTS system date_time chrono regex program_options)
find_package(Threads REQUIRED)

set(libraries )
list(APPEND libraries ${Boost_LIBRARIES})
list(APPEND libraries ${Boost_LIBRARIES} Threads::Threads)
if(WIN32)
list(APPEND libraries "ws2_32" "mswsock")
endif()

if(NOT Boost_USE_STATIC_LIBS)
list(APPEND compile_definitions "BOOST_ALL_DYN_LINK")
endif()
if(WIN32)
list(APPEND compile_definitions
WIN32
WIN32_LEAN_AND_MEAN
WINVER=0x0501
_WIN32_WINNT=0x0501
_WIN32_WINDOWS=0x0501
_WIN32_IE=0x0600
_UNICODE
UNICODE
_WINSOCK_DEPRECATED_NO_WARNINGS)
endif()

if(MINGW)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -municode")
endif()

add_executable(server "server.cc")
target_compile_features(server PRIVATE cxx_std_11 cxx_auto_type)
target_compile_definitions(server PRIVATE ${compile_definitions})
target_include_directories(server PRIVATE ${Boost_INCLUDE_DIRS})
target_link_libraries(server PRIVATE ${libraries})
60 changes: 60 additions & 0 deletions c++-virtan/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM ubuntu:20.04 AS build

RUN apt-get update && \
apt-get install -y --no-install-suggests --no-install-recommends \
ca-certificates \
curl \
git \
g++ \
make \
libstdc++-9-dev && \
rm -rf /var/lib/apt/lists/*

ENV CMAKE_HOME="/opt/cmake"

ARG CMAKE_VERSION="3.18.4"

RUN mkdir -p "${CMAKE_HOME}" && \
cmake_url="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" && \
echo "Downloading CMake ${CMAKE_VERSION} from ${cmake_url} to ${CMAKE_HOME}" && \
curl -jksSL "${cmake_url}" | tar -xzf - -C "${CMAKE_HOME}" --strip-components 1

ENV PATH="${CMAKE_HOME}/bin:${PATH}" \
BOOST_HOME="/usr/lib/boost"

ARG BOOST_VERSION="1.74.0"
ARG BOOST_URL="https://dl.bintray.com/mabrarov/generic/boost"

RUN mkdir -p "${BOOST_HOME}" && \
boost_archive_url="${BOOST_URL}/${BOOST_VERSION}/boost-${BOOST_VERSION}-x64-gcc$(gcc -dumpversion | sed -r 's/^([[:digit:]]+)(\..*)?$/\1/;t;d').tar.gz" && \
echo "Downloading Boost from ${boost_archive_url} to ${BOOST_HOME}" && \
curl --connect-timeout 300 --max-time 1800 --retry 10 --retry-delay 10 \
-jksSL "${boost_archive_url}" \
| tar -xz -C "${BOOST_HOME}" --strip-components 1

ADD ["CMakeLists.txt", "server.cc", "/usr/src/cpp-virtan/"]

RUN source_dir="/usr/src/cpp-virtan" && \
build_dir="${source_dir}/build" && \
mkdir -p "${build_dir}" && \
cmake \
-D CMAKE_SKIP_BUILD_RPATH=ON \
-D CMAKE_BUILD_TYPE=Release \
-D Boost_USE_MULTITHREADED=ON \
-D Boost_USE_STATIC_LIBS=ON \
-D Boost_NO_SYSTEM_PATHS=ON \
-D BOOST_INCLUDEDIR="${BOOST_HOME}/include" \
-D BOOST_LIBRARYDIR="${BOOST_HOME}/lib" \
-S "${source_dir}" \
-B "${build_dir}" && \
cmake --build "${build_dir}"

FROM gcr.io/distroless/cc-debian10

COPY --from=build ["/usr/src/cpp-virtan/build/server", "/opt/cpp-virtan/server"]

ENTRYPOINT ["/opt/cpp-virtan/server"]

CMD ["--help"]

LABEL name="cpp-virtan"
16 changes: 0 additions & 16 deletions c++-virtan/Makefile

This file was deleted.

40 changes: 40 additions & 0 deletions c++-virtan/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Building

## Requirements

1. C++ toolchain (compiler, linker, standard C++ library)
1. Make
1. [CMake](https://cmake.org/)
1. [Boost](https://www.boost.org/)

## Steps to build

Assuming current directory is directory where this file is located

```bash
cmake -D CMAKE_SKIP_BUILD_RPATH=ON -D CMAKE_BUILD_TYPE=Release .
cmake --build .
```

# Docker image

## Building

### Requirements

1. Docker 17.06+ for building
1. Current directory is directory where this repository is cloned

### Steps to build

```bash
docker build -t cpp-virtan c++-virtan
```

## Running with Docker

```bash
docker run --rm cpp-virtan $params
```

where `$params` are parameters passed to application
Loading