From 17d4ec53be77e2852dd666c3057181ea792611b2 Mon Sep 17 00:00:00 2001 From: "robert.schie" Date: Fri, 7 Feb 2025 10:07:03 -0800 Subject: [PATCH] Updated Startup Script to include command line arguments for smp and memory Command Line argument Values are now consitent with python, go, java, node and ruby implementations: - https://github.com/testcontainers/testcontainers-python/blob/main/modules/kafka/testcontainers/kafka/_redpanda.py - https://github.com/testcontainers/testcontainers-go/blob/main/modules/redpanda/redpanda.go - https://github.com/testcontainers/testcontainers-java/blob/main/modules/redpanda/src/main/java/org/testcontainers/redpanda/RedpandaContainer.java - https://github.com/testcontainers/testcontainers-node/blob/main/packages/modules/redpanda/src/redpanda-container.ts - https://github.com/testcontainers/testcontainers-ruby/blob/main/redpanda/lib/testcontainers/redpanda.rb These updated values adresses the scenario where multiple redpanda test containers instances are wired up and that some containers stop / fail due to resource exhaustion. The following error is captured from the container which has failed: 2025-02-07 09:45:20 WARN 2025-02-07 17:45:20,613 seastar - Requested AIO slots too large, please increase request capacity in /proc/sys/fs/aio-max-nr. available:6559 requested:110260 2025-02-07 09:45:20 Could not initialize seastar: std::runtime_error (Could not setup Async I/O: Not enough request capacity in /proc/sys/fs/aio-max-nr. Try increasing that number or reducing the amount of logical CPUs available for your application) --- src/Testcontainers.Redpanda/RedpandaBuilder.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Testcontainers.Redpanda/RedpandaBuilder.cs b/src/Testcontainers.Redpanda/RedpandaBuilder.cs index 2a9d38260..d3116d614 100644 --- a/src/Testcontainers.Redpanda/RedpandaBuilder.cs +++ b/src/Testcontainers.Redpanda/RedpandaBuilder.cs @@ -59,6 +59,8 @@ protected override RedpandaBuilder Init() startupScript.Append(lf); startupScript.Append("/usr/bin/rpk redpanda start "); startupScript.Append("--mode dev-container "); + startupScript.Append("--smp 1 "); + startupScript.Append("--memory 1G "); startupScript.Append("--kafka-addr PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092 "); startupScript.Append("--advertise-kafka-addr PLAINTEXT://127.0.0.1:29092,OUTSIDE://" + container.Hostname + ":" + container.GetMappedPublicPort(RedpandaPort)); return container.CopyAsync(Encoding.Default.GetBytes(startupScript.ToString()), StartupScriptFilePath, Unix.FileMode755, ct);