Created
April 29, 2021 02:33
-
-
Save fzakaria/0ba14277bae76bade65a865a320def47 to your computer and use it in GitHub Desktop.
Simple CephFS FUSE benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'fileutils' | |
require 'thread' | |
lock = Mutex.new | |
NUMBER_OF_CLIENTS = 10 | |
# tear down any old directories | |
for i in 0..NUMBER_OF_CLIENTS do | |
directory = File.expand_path("cephfs-#{i}") | |
# Create the directories and mount them | |
FileUtils.mkdir_p "cephfs-#{i}" | |
puts "Attempting to tear down #{directory}" | |
`sudo fusermount -u #{directory}` | |
puts "Starting client #{directory}" | |
`sudo bin/ceph-fuse --id a #{directory}` | |
end | |
timings = [] | |
threads = (0..NUMBER_OF_CLIENTS).map do |i| | |
directory = File.expand_path("cephfs-#{i}") | |
Thread.new do | |
starting = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
`du -a #{directory}/linux-master > /dev/null` | |
ending = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
elapsed = ending - starting | |
lock.synchronize do | |
timings << elapsed | |
end | |
end | |
end | |
threads.each(&:join) | |
puts "Average: #{timings.sum(0.0) / timings.size}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment