Skip to content

Commit 358f051

Browse files
committed
fix: constrain polars threads to match allocated cpu to prevent memory spikes and SIGKILL
1 parent 9043a8b commit 358f051

10 files changed

Lines changed: 13 additions & 47 deletions

.gcp/lifecycle/archival-lifecycle.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

.gcp/lifecycle/staging-lifecycle.json

Lines changed: 0 additions & 15 deletions
This file was deleted.
-233 KB
Binary file not shown.

.gcp/terraforms/jobs.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ resource "google_cloud_run_v2_job" "pipeline" {
1717
resources {
1818
limits = {
1919
cpu = "2"
20-
memory = "4Gi"
20+
memory = "8Gi"
2121
}
2222
}
23+
env {
24+
name = "POLARS_MAX_THREADS"
25+
value = "2"
26+
}
2327
}
2428
}
2529
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ __pycache__/
55

66
# Runtime Directory
77
runtime/
8+
/data/raw
89
data/published/
910
data/run_artifact
1011
data/contracted/
1112
assets/benchmarks/benchmark.py
1213

1314
# local editor configs
1415
pyrightconfig.json
16+
troubleshoot/
1517

1618
# C extensions
1719
*.so
-9.53 KB
Binary file not shown.
-8.22 KB
Binary file not shown.
-3.1 KB
Binary file not shown.
-91.4 KB
Binary file not shown.

docker-compose.benchmark.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ services:
99
volumes:
1010
- ./data:/app/data
1111

12-
deploy:
13-
resources:
14-
limits:
15-
# Provision Specs Test
16-
memory: 4G
17-
cpus: '2.0'
18-
# Simulate 2 virtual cpus
12+
# Provision Specs: Memory 8 Gb/ 2cpu/2 threads
13+
# Memory tax = Sandbox Tax + Import Tax + I/O Buffer Tax
14+
# Max Data Size = (Total RAM- 8GB) - (Memory Tax - 1.5GB) = 6.5GB
15+
mem_limit: 6.5G
16+
memswap_limit: 6.5G
17+
cpus: '2.0'
1918
environment:
2019
- POLARS_MAX_THREADS=2

0 commit comments

Comments
 (0)