Skip to content

Commit 61a0833

Browse files
authored
UBERF-7312: Memory improvements (#5849)
Signed-off-by: Andrey Sobolev <[email protected]>
1 parent b3db302 commit 61a0833

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

Diff for: pods/account/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@ WORKDIR /usr/src/app
55
COPY bundle/bundle.js ./
66
RUN npm install --ignore-scripts=false --verbose bufferutil utf-8-validate @mongodb-js/zstd --unsafe-perm
77

8+
RUN apt-get update
9+
RUN apt-get install libjemalloc2
10+
11+
ENV LD_PRELOAD=libjemalloc.so.2
12+
ENV MALLOC_CONF=dirty_decay_ms:1000,narenas:2,background_thread:true
13+
814
EXPOSE 3000
915
CMD [ "node", "bundle.js" ]

Diff for: pods/collaborator/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ FROM node:20
44
WORKDIR /usr/src/app
55
RUN npm install --ignore-scripts=false --verbose bufferutil utf-8-validate @mongodb-js/zstd --unsafe-perm
66

7+
RUN apt-get update
8+
RUN apt-get install libjemalloc2
9+
10+
ENV LD_PRELOAD=libjemalloc.so.2
11+
ENV MALLOC_CONF=dirty_decay_ms:1000,narenas:2,background_thread:true
12+
713
COPY bundle/bundle.js ./
814

915
EXPOSE 3078

Diff for: pods/front/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ ENV NODE_ENV production
55
WORKDIR /app
66
RUN npm install --ignore-scripts=false --verbose [email protected] bufferutil utf-8-validate @mongodb-js/zstd --unsafe-perm
77

8+
RUN apt-get update
9+
RUN apt-get install libjemalloc2
10+
11+
ENV LD_PRELOAD=libjemalloc.so.2
12+
ENV MALLOC_CONF=dirty_decay_ms:1000,narenas:2,background_thread:true
13+
814
COPY bundle/bundle.js ./
915
COPY dist/ ./dist/
1016

Diff for: pods/server/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ WORKDIR /app
66
RUN npm install --ignore-scripts=false --verbose bufferutil utf-8-validate @mongodb-js/zstd --unsafe-perm
77
RUN npm install --ignore-scripts=false --verbose uNetworking/uWebSockets.js#v20.43.0
88

9+
RUN apt-get update
10+
RUN apt-get install libjemalloc2
11+
12+
ENV LD_PRELOAD=libjemalloc.so.2
13+
ENV MALLOC_CONF=dirty_decay_ms:1000,narenas:2,background_thread:true
14+
915
COPY bundle/bundle.js ./
1016
RUN mv node_modules/uWebSockets.js/*.node .
1117

Diff for: server/front/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,8 @@ async function getGeneratePreview (
728728

729729
let pipeline = sharp(data)
730730

731+
sharp.cache(false)
732+
731733
// const metadata = await pipeline.metadata()
732734

733735
if (size !== -1) {
@@ -767,6 +769,7 @@ async function getGeneratePreview (
767769
}
768770

769771
const dataBuff = await pipeline.toBuffer()
772+
pipeline.destroy()
770773

771774
// Add support of avif as well.
772775
await config.storageAdapter.put(ctx, payload.workspace, sizeId, dataBuff, contentType, dataBuff.length)

0 commit comments

Comments
 (0)