Skip to content

Commit 875d339

Browse files
committed
Added memory and CPU limit for CH container
1 parent aff8536 commit 875d339

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

performance/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<slf4j.version>2.0.17</slf4j.version>
1818
<ch.jdbc.revision>0.9.8-SNAPSHOT</ch.jdbc.revision>
1919
<jmh.version>1.37</jmh.version>
20-
<testcontainers.version>2.0.2</testcontainers.version>
20+
<testcontainers.version>2.0.5</testcontainers.version>
2121

2222
<antrun-plugin.version>3.1.0</antrun-plugin.version>
2323
<assembly-plugin.version>3.6.0</assembly-plugin.version>

performance/src/main/java/com/clickhouse/benchmark/TestEnvironment.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public static ClickHouseNode getServer() {
7474
return serverNode;
7575
}
7676

77+
private static final long MEM_LIMIT = (long) (24 * Math.pow(1024.0D, 3.0D));
7778

7879
//Initialization and Teardown methods
7980
public static void setupEnvironment() {
@@ -88,6 +89,13 @@ public static void setupEnvironment() {
8889
.withPassword("testing_password")
8990
.withEnv("CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT", "1")
9091
.withExposedPorts(8123, 8443)
92+
.withCreateContainerCmdModifier(cmd -> {
93+
cmd.getHostConfig()
94+
.withMemorySwap(0L)
95+
.withMemory(MEM_LIMIT)
96+
.withCpuCount(2L);
97+
})
98+
.withUrlParam("max_threads", "2")
9199
.waitingFor(Wait.forHttp("/ping").forPort(8123).forStatusCode(200).withStartupTimeout(Duration.of(600, SECONDS)));
92100
container.start();
93101
}

0 commit comments

Comments
 (0)