mirror of
				https://github.com/containers/podman.git
				synced 2025-11-01 02:42:11 +08:00 
			
		
		
		
	 4ed46c9847
			
		
	
	4ed46c9847
	
	
	
		
			
			Add a set of scripts using hyperfine for comparing two container engines. I am currently using the scripts for comparing Podman and Docker, and with older versions of Podman. These scripts are not meant for production usage but to aid in tracking down performance regressions and bottlenecks. Run the scripts via `sudo sh $script.sh`. Use the following environment variables to change the default behavior: * `ENGINE_A` to set container engine A (default `/usr/bin/podman`) * `ENGINE_B` to set container engine B (default `/usr/bin/docker`) * `RUNS` to change the runs/repetitions of each benchmarks (default `100`) * `NUM_CONTAINERS` to change the number of created containers for some benchmarks (e.g., `ps`) (default `100`) * `IMAGE` to change the default container image (default `docker.io/library/alpine:latest`) Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
		
			
				
	
	
		
			37 lines
		
	
	
		
			913 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			913 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
| ENGINE_A=${ENGINE_A:-podman}
 | |
| ENGINE_B=${ENGINE_B:-docker}
 | |
| RUNS=${RUNS:-100}
 | |
| NUM_CONTAINERS=${NUM_CONTAINERS:-100}
 | |
| IMAGE=${IMAGE:-docker.io/library/alpine:latest}
 | |
| 
 | |
| BOLD="$(tput bold)"
 | |
| RESET="$(tput sgr0)"
 | |
| 
 | |
| function echo_bold() {
 | |
|     echo "${BOLD}$1${RESET}"
 | |
| }
 | |
| 
 | |
| function pull_image() {
 | |
| 	echo_bold "... pulling $IMAGE"
 | |
| 	$ENGINE_A pull $IMAGE -q > /dev/null
 | |
| 	$ENGINE_B pull $IMAGE -q > /dev/null
 | |
| }
 | |
| 
 | |
| function setup() {
 | |
| 	echo_bold "---------------------------------------------------"
 | |
| 	echo_bold "... comparing $ENGINE_A with $ENGINE_B"
 | |
| 	echo_bold "... cleaning up previous containers and images"
 | |
| 	$ENGINE_A system prune -f > /dev/null
 | |
| 	$ENGINE_B system prune -f > /dev/null
 | |
| 	pull_image
 | |
| 	echo ""
 | |
| }
 | |
| 
 | |
| function create_containers() {
 | |
| 	echo_bold "... creating $NUM_CONTAINERS containers"
 | |
| 	for i in $(eval echo "{0..$NUM_CONTAINERS}"); do
 | |
| 		$ENGINE_A create $IMAGE >> /dev/null
 | |
| 		$ENGINE_B create $IMAGE >> /dev/null
 | |
| 	done
 | |
| }
 |