Memory allocation and access pattern microbenchmarks for performance evaluation.
Memory microbenchmarks test memory subsystem performance through:
- Memory allocation: Dynamic memory allocation/deallocation patterns
- Memory access: Different access patterns (sequential, random)
- Memory pressure: Multi-container memory contention scenarios
docker build -t mem_micro .# Run memory benchmark directly
docker run -itd --name="worker" --runtime=runc --cpuset-cpus=0 --memory=512m mem_micro
# Execute memory test inside container
docker exec -itd worker /usr/local/bin/memory.sh --log 21 13 3 2 300
# Copy results
docker exec worker cat /app/mem_out.log > memory_results.logThe memory binary accepts these parameters:
./memory <total> <mmap_size> <option> <touch_option> <duration>
Common configurations:
21 13 3 2- Allocate/unmap 1GB in 8KB chunks, touch each page20 14 3 2- Allocate/unmap 1GB in 16KB chunks, touch each page
Parameter meanings:
- total: Total memory size (power of 2, e.g., 21 = 2^21 = 2MB)
- mmap_size: Chunk size (power of 2, e.g., 13 = 2^13 = 8KB)
- option: 1=alloc only, 2=alloc+unmap, 3=alloc+unmap+touch
- touch_option: 0=no touch, 1=touch first page, 2=touch all pages
- duration: Test duration in seconds
memory.sh- Wrapper script for memory binary with loggingsetup.sh- Setup and build memory binary