Skip to content

Instantly share code, notes, and snippets.

@fzakaria
Created April 29, 2021 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fzakaria/0ba14277bae76bade65a865a320def47 to your computer and use it in GitHub Desktop.
Save fzakaria/0ba14277bae76bade65a865a320def47 to your computer and use it in GitHub Desktop.
Simple CephFS FUSE benchmark
#! /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