Skip to content

Commit 3ea4cc8

Browse files
authored
change default memory allocator to jemalloc (#17)
* change default memory allocator to jemalloc * update github workflows * update github workflows
1 parent b6f3e6a commit 3ea4cc8

File tree

4 files changed

+33
-52
lines changed

4 files changed

+33
-52
lines changed

.github/workflows/pr-build.yml

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,42 @@ on:
44
branches:
55
- main
66
pull_request_target:
7-
branches:
7+
branches:
88
- main
99

1010
jobs:
1111
build:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313
steps:
1414
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
1515
- name: Check out code
16-
uses: actions/checkout@v2.3.4
16+
uses: actions/checkout@v3
1717
with:
18-
ref: ${{github.event.pull_request.head.ref}}
19-
repository: ${{github.event.pull_request.head.repo.full_name}}
2018
fetch-depth: 0
21-
22-
- name: create checksum file
23-
uses: hypertrace/github-actions/checksum@main
24-
25-
- name: Cache packages
26-
uses: actions/cache@v2
27-
with:
28-
path: ~/.gradle
29-
key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }}
30-
restore-keys: |
31-
gradle-packages-${{ runner.os }}-${{ github.job }}
32-
gradle-packages-${{ runner.os }}
3319

3420
- name: Login to Docker Hub
35-
uses: docker/login-action@v1
21+
uses: docker/login-action@v2
3622
with:
3723
username: ${{ secrets.DOCKERHUB_READ_USER }}
3824
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}
39-
25+
4026
- name: Build with Gradle
4127
uses: hypertrace/github-actions/gradle@main
42-
with:
28+
with:
4329
args: dockerBuildImages
4430

45-
- name: Scan docker image
46-
uses: azure/container-scan@v0.1
31+
- name: Scan java-11 image
32+
uses: hypertrace/github-actions/trivy-image-scan@main
4733
with:
48-
image-name: hypertrace/java:11
49-
env:
50-
DOCKLE_HOST: "unix:///var/run/docker.sock"
51-
continue-on-error: true
34+
image: hypertrace/java
35+
tag: 11
36+
category: java-11
37+
output-mode: github
5238

53-
- name: Scan docker image
54-
uses: azure/container-scan@v0.1
39+
- name: Scan java-14 image
40+
uses: hypertrace/github-actions/trivy-image-scan@main
5541
with:
56-
image-name: hypertrace/java:14
57-
env:
58-
DOCKLE_HOST: "unix:///var/run/docker.sock"
59-
continue-on-error: true
42+
image: hypertrace/java
43+
tag: 14
44+
category: java-14
45+
output-mode: github

.github/workflows/publish.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,31 @@
11
name: Publish artifacts
22
on:
3-
# Will only run when release is published.
3+
# Will only run when release is published.
44
release:
5-
types:
5+
types:
66
- created
77
workflow_dispatch:
88

99
jobs:
1010
publish-artifacts:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-22.04
1212
steps:
1313
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
1414
- name: Check out code
15-
uses: actions/checkout@v2.3.4
15+
uses: actions/checkout@v3
1616
with:
1717
fetch-depth: 0
1818

19-
- name: create checksum file
20-
uses: hypertrace/github-actions/checksum@main
21-
22-
- name: Cache packages
23-
uses: actions/cache@v2
24-
with:
25-
path: ~/.gradle
26-
key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }}
27-
restore-keys: |
28-
gradle-packages-${{ runner.os }}-${{ github.job }}
29-
gradle-packages-${{ runner.os }}
30-
3119
- name: Login to Docker Hub
32-
uses: docker/login-action@v1
20+
uses: docker/login-action@v2
3321
with:
3422
username: ${{ secrets.DOCKERHUB_READ_USER }}
3523
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}
3624

3725
- name: publish docker image
3826
uses: hypertrace/github-actions/gradle@main
39-
with:
27+
with:
4028
args: dockerPushImages
4129
env:
4230
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_PUBLISH_USER }}
4331
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }}
44-

java-11/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ jdk.zipfs\
4444
# We extract JRE's hard dependencies, libz and SSL certs, from the fat JRE image.
4545
FROM gcr.io/distroless/java:11-debug AS deps
4646

47+
FROM amd64/debian:bullseye-slim As builder
48+
RUN apt update && apt install -y libjemalloc-dev
49+
4750
# Debian-11 image
4851
FROM gcr.io/distroless/cc:debug
4952

@@ -61,6 +64,11 @@ RUN ln -s /lib/x86_64-linux-gnu/libz.so.1.2.11 /lib/x86_64-linux-gnu/libz.so.1
6164
COPY --from=jre /jre /usr/lib/jvm/zulu-11-amd64-slim
6265
RUN ln -s /usr/lib/jvm/zulu-11-amd64-slim/bin/java /usr/bin/java
6366

67+
# change rocksdb default memory allocator
68+
# https://docs.confluent.io/platform/current/streams/developer-guide/memory-mgmt.html#rocksdb
69+
COPY --from=builder /usr/lib/x86_64-linux-gnu/libjemalloc* /usr/lib/x86_64-linux-gnu/
70+
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so
71+
6472
# set JAVA_HOME
6573
ENV JAVA_HOME=/usr/lib/jvm/zulu-11-amd64-slim
6674

java-11/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id("org.hypertrace.docker-publish-plugin")
33
}
44

5-
var javaVersion = "11.0.16.1-11.58.23"
5+
var javaVersion = "11.0.19-11.64.19"
66

77
hypertraceDocker {
88
defaultImage {

0 commit comments

Comments
 (0)