Skip to content

Commit

Permalink
Enable TCP keep alive for redox (#717)
Browse files Browse the repository at this point in the history
* helps keep connections between clipper and redis for a long idle time on k8s
  • Loading branch information
taohammer authored and simon-mo committed Jun 4, 2019
1 parent f76dd94 commit 19facc1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dockerfiles/ClipperPy35TestsDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ COPY ./ /clipper

# Patch Clipper
RUN cd /clipper/src/libs/spdlog \
&& git apply ../patches/make_spdlog_compile_linux.patch
&& git apply ../patches/make_spdlog_compile_linux.patch \
&& cd /clipper/src/libs/redox \
&& git apply ../patches/redis_keepalive.patch

# Set version as git hash
RUN cd /clipper && echo ${CODE_VERSION} > VERSION
Expand Down
2 changes: 2 additions & 0 deletions dockerfiles/ClipperTestsDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ RUN pip install -q -e /clipper/clipper_admin

RUN cd /clipper/src/libs/spdlog \
&& git apply ../patches/make_spdlog_compile_linux.patch \
&& cd /clipper/src/libs/redox \
&& git apply ../patches/redis_keepalive.patch \
&& cd /clipper \
&& ./configure \
&& cd debug \
Expand Down
2 changes: 2 additions & 0 deletions dockerfiles/ManagementFrontendDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ COPY ./ /clipper

RUN cd /clipper/src/libs/spdlog \
&& git apply ../patches/make_spdlog_compile_linux.patch \
&& cd /clipper/src/libs/redox \
&& git apply ../patches/redis_keepalive.patch \
&& cd /clipper \
&& ./configure --cleanup-quiet \
&& ./configure --release \
Expand Down
4 changes: 3 additions & 1 deletion dockerfiles/QueryFrontendDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ COPY ./ /clipper

RUN cd /clipper/src/libs/spdlog \
&& git apply ../patches/make_spdlog_compile_linux.patch \
&& cd /clipper/src/libs/redox \
&& git apply ../patches/redis_keepalive.patch \
&& cd /clipper \
&& ./configure --cleanup-quiet \
&& ./configure --release \
Expand All @@ -20,4 +22,4 @@ WORKDIR /clipper/

ENTRYPOINT ["/clipper/query_frontend_entry.sh"]

# vim: set filetype=dockerfile:
# vim: set filetype=dockerfile:
11 changes: 11 additions & 0 deletions src/libs/patches/redis_keepalive.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff -urN redox.org/src/client.cpp redox/src/client.cpp
--- redox.org/src/client.cpp 2019-05-31 18:58:11.104997558 +0900
+++ redox/src/client.cpp 2019-05-31 20:34:21.826154449 +0900
@@ -57,6 +57,7 @@

// Connect over TCP
ctx_ = redisAsyncConnect(host.c_str(), port);
+ redisEnableKeepAlive(&(ctx_->c));

if (!initHiredis())
return false;

0 comments on commit 19facc1

Please sign in to comment.