forked from ungleich-public/cdist
		
	Add timing hack / test1
This commit is contained in:
		
					parent
					
						
							
								9f1ec6f89e
							
						
					
				
			
			
				commit
				
					
						ecc77e55ed
					
				
			
		
					 1 changed files with 79 additions and 0 deletions
				
			
		
							
								
								
									
										79
									
								
								hacking/timing-tests/benchmark-files.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								hacking/timing-tests/benchmark-files.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,79 @@ | |||
| #!/bin/sh | ||||
| 
 | ||||
| num=50000 | ||||
| dsthost=localhost | ||||
| 
 | ||||
| tmp=$(mktemp -d) | ||||
| remote_tmp=${tmp}-remote | ||||
| 
 | ||||
| cd "$tmp" | ||||
| 
 | ||||
| create_files() { | ||||
|     i=0 | ||||
|     while [ $i -lt $num ]; do | ||||
|         echo $i > file-${i} | ||||
|         i=$((i+1)) | ||||
|     done | ||||
| } | ||||
| 
 | ||||
| delete_remote() { | ||||
|     ssh "${dsthost}" "rm -rf ${remote_tmp}" | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| tar_remote() { | ||||
|     cd "${tmp}" | ||||
|     tar c . | ssh "${dsthost}" "mkdir ${remote_tmp}; cd ${remote_tmp}; tar x" | ||||
| } | ||||
| 
 | ||||
| cdist_remote() | ||||
| { | ||||
|     ( | ||||
|         while [ $i -lt $num ]; do | ||||
|             echo __file ${remote_tmp}/file-${i} --source "${tmp}/file-${i}" | ||||
|             i=$((i+1)) | ||||
|         done | ||||
|     ) | cdist config -i - -vv "${dsthost}" | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| cdist_remote_parallel() | ||||
| { | ||||
|     ( | ||||
|         while [ $i -lt $num ]; do | ||||
|             echo __file ${remote_tmp}/file-${i} --source "${tmp}/file-${i}" | ||||
|             i=$((i+1)) | ||||
|         done | ||||
|     ) | cdist config -j10 -i - -vv "${dsthost}" | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| echo "Creating ${num} files" | ||||
| time create_files | ||||
| 
 | ||||
| echo "scping files" | ||||
| time scp -r "${tmp}" "${dsthost}:$remote_tmp" >/dev/null | ||||
| 
 | ||||
| echo "delete remote" | ||||
| time delete_remote | ||||
| 
 | ||||
| echo "taring files" | ||||
| time tar_remote | ||||
| 
 | ||||
| echo "delete remote" | ||||
| time delete_remote | ||||
| 
 | ||||
| echo "cdisting files" | ||||
| time cdist_remote | ||||
| 
 | ||||
| echo "delete remote" | ||||
| time delete_remote | ||||
| 
 | ||||
| echo "cdisting files (parallel)!" | ||||
| time cdist_remote | ||||
| 
 | ||||
| echo "delete remote" | ||||
| time delete_remote | ||||
| 
 | ||||
| echo "delete local" | ||||
| rm -rf "$tmp" | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue