Skip to content

Commit

Permalink
Add tcmalloc for amd64 platform
Browse files Browse the repository at this point in the history
Longhorn 4136

Signed-off-by: Derek Su <derek.su@suse.com>
  • Loading branch information
derekbit authored and innobead committed Jul 20, 2022
1 parent 1633ac1 commit 6ff6113
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 12 deletions.
38 changes: 34 additions & 4 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ RUN zypper refresh && \
zypper -n --gpg-auto-import-keys ref

# Install packages
RUN if [ ${ARCH} == "amd64" ]; then \
zypper -n install autoconf libtool libunwind-devel; \
fi

RUN zypper -n install cmake wget curl git less file \
libglib-2_0-0 libkmod-devel libnl3-devel linux-glibc-devel pkg-config \
psmisc tox qemu-tools fuse python3-devel git zlib-devel zlib-devel-static \
Expand All @@ -41,20 +45,46 @@ ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm64=arm64 GOLANG_ARCH_s390x=s390x GOLA
RUN wget -O - https://storage.googleapis.com/golang/go1.14.15.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \
go get github.com/rancher/trash && go get -u golang.org/x/lint/golint

# Build gperftools
# 1. Just use tcmalloc lib from gperftools installation
# 2. tcmalloc also supports arm64 platform, but we only focus on amd64 first currently.
# arm64 will be supported after more testing.
RUN if [ ${ARCH} == "amd64" ]; then \
cd /usr/src && \
git clone https://github.com/gperftools/gperftools.git&& \
cd gperftools && \
git checkout db6d94d9893fdd8c74028b5113cd9185be1e3111 && \
./autogen.sh && \
./configure && \
make && \
make install; \
zypper -n remove autoconf libtool libunwind-devel; \
rm -rf /usr/src/gperftools; \
ldconfig; \
fi

# Build liblonghorn
RUN cd /usr/src && \
git clone https://github.com/rancher/liblonghorn.git && \
cd liblonghorn && \
git checkout 6544c2432d543137a198e4a779f676369dbd9e82 && \
make && \
git checkout fe86d7f1c6780904760f2832d8055c7ca7f0d92a && \
if [ ${ARCH} == "amd64" ]; then \
make EXTRA_LIBS=/usr/local/lib/libtcmalloc.a; \
else \
make; \
fi; \
make install

# Build TGT
RUN cd /usr/src && \
git clone https://github.com/rancher/tgt.git && \
cd tgt && \
git checkout e042fdd3616ca90619637b5826695a3de9b5dd8e && \
make && \
git checkout 64a3443ad6ab829343167e744a757d8ec044185a && \
if [ ${ARCH} == "amd64" ]; then \
make EXTRA_LIBS=-ltcmalloc; \
else \
make; \
fi; \
make install

# Install libqcow to resolve error:
Expand Down
44 changes: 36 additions & 8 deletions package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ RUN zypper -n install cmake kmod curl nfs-client nfs4-acl-tools fuse git gcc \
iputils telnet iperf qemu-tools wget iproute2 xsltproc docbook-xsl-stylesheets \
e2fsprogs e2fsprogs-devel xfsprogs xfsprogs-devel

RUN if [ ${ARCH} == "amd64" ]; then \
zypper -n install autoconf libtool libunwind-devel gcc-c++; \
fi

# Install grpc_health_probe
RUN wget https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.3.2/grpc_health_probe-linux-${ARCH} -O /usr/local/bin/grpc_health_probe && \
chmod +x /usr/local/bin/grpc_health_probe
Expand All @@ -20,23 +24,47 @@ COPY bin/longhorn-instance-manager /usr/local/bin/

COPY package/engine-manager /usr/local/bin/

# Build gperftools
# 1. Just use tcmalloc lib from gperftools installation
# 2. tcmalloc also supports arm64 platform, but we only focus on amd64 first currently.
# arm64 will be supported after more testing.
RUN if [ ${ARCH} == "amd64" ]; then \
cd /usr/src && \
git clone https://github.com/gperftools/gperftools.git&& \
cd gperftools && \
git checkout db6d94d9893fdd8c74028b5113cd9185be1e3111 && \
./autogen.sh && \
./configure && \
make && \
make install; \
zypper -n remove autoconf libtool libunwind-devel gcc-c++; \
rm -rf /usr/src/gperftools; \
ldconfig; \
fi

# Build liblonghorn
RUN cd /usr/src && \
git clone https://github.com/rancher/liblonghorn.git && \
cd liblonghorn && \
git checkout 74f14b50895ac6b0faebc715c025a8a46a4333a1 && \
make && \
make install && \
rm -rf /usr/src/liblonghorn
git checkout fe86d7f1c6780904760f2832d8055c7ca7f0d92a && \
if [ ${ARCH} == "amd64" ]; then \
make EXTRA_LIBS=/usr/local/lib/libtcmalloc.a; \
else \
make; \
fi; \
make install

# Build TGT
RUN cd /usr/src && \
git clone https://github.com/rancher/tgt.git && \
cd tgt && \
git checkout e042fdd3616ca90619637b5826695a3de9b5dd8e && \
make && \
make install && \
rm -rf /usr/src/tgt
git checkout 64a3443ad6ab829343167e744a757d8ec044185a && \
if [ ${ARCH} == "amd64" ]; then \
make EXTRA_LIBS=-ltcmalloc; \
else \
make; \
fi; \
make install

VOLUME /usr/local/bin

Expand Down

0 comments on commit 6ff6113

Please sign in to comment.