-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for bytehound memory prfiling in MacOS
- Loading branch information
Showing
5 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
# Memory profiler output | ||
memory-profiling_* | ||
profile-* | ||
profile/memory-profiling_* | ||
|
||
# CLI history | ||
.history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Image that wraps Seafowl with a bytehound binary and records | ||
# memory allocations for profiling | ||
# | ||
# To build run just the bytehound layer run | ||
# docker build --target bytehound -f Dockerfile.profile -t splitgraph/bytehound . | ||
# | ||
# To build the full image run | ||
# docker build -f Dockerfile.profile -t splitgraph/seafowl:profile .. | ||
|
||
FROM rust:slim AS bytehound | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y git protobuf-compiler ca-certificates npm && \ | ||
npm install -g yarn | ||
|
||
# Fetch bytehound source and compile | ||
RUN git clone https://github.com/koute/bytehound.git && \ | ||
cd bytehound && \ | ||
cargo build --release -p bytehound-preload && \ | ||
cargo build --release -p bytehound-cli | ||
|
||
FROM bytehound AS profile | ||
|
||
RUN rustup default nightly-2024-10-30 | ||
|
||
# Compile an empty project, so as to cache the compiled deps and avoid unneeded re-compilation. | ||
# Adapted from https://gist.github.com/noelbundick/6922d26667616e2ba5c3aff59f0824cd | ||
RUN cargo new seafowl | ||
WORKDIR seafowl | ||
COPY Cargo.toml Cargo.lock build.rs . | ||
COPY clade clade | ||
COPY datafusion_remote_tables datafusion_remote_tables | ||
COPY migrations migrations | ||
COPY object_store_factory object_store_factory | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry cargo build --profile release-with-debug | ||
|
||
# Copy the rest of the code now and update timestamps to force a new build only for it | ||
COPY src src | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry set -e && \ | ||
touch src/lib.rs src/main.rs && \ | ||
cargo build --profile release-with-debug | ||
|
||
RUN cd .. && mkdir seafowl-data | ||
|
||
ENV MEMORY_PROFILER_OUTPUT=profiles/memory-profiling_%e_%t_%p.dat | ||
ENV LD_PRELOAD=/bytehound/target/release/libbytehound.so | ||
ENTRYPOINT [ "./target/release-with-debug/seafowl" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
build-bytehound: | ||
docker build --target bytehound -f Dockerfile.profile -t splitgraph/bytehound . | ||
|
||
build-profiler: | ||
docker build -f Dockerfile.profile -t splitgraph/seafowl:profile .. | ||
|
||
profile: | ||
docker run \ | ||
-p 8080:8080 -p 47470:47470 \ | ||
-v .:/seafowl/profiles \ | ||
-v `realpath ../seafowl.toml`:/seafowl.toml \ | ||
splitgraph/seafowl:profile -c /seafowl.toml | ||
|
||
view: | ||
docker run -p 8888:8888 -v .:/profiles -w /profiles splitgraph/bytehound \ | ||
/bytehound/target/release/bytehound server -i 0.0.0.0 -p 8888 memory-profiling_* | ||
|
||
clean: | ||
rm -rf memory-profiling_* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ bind_port = 6432 | |
bind_host = "0.0.0.0" | ||
|
||
[frontend.flight] | ||
bind_host = "127.0.0.1" | ||
bind_host = "0.0.0.0" |