Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lib/cloud_controller/benchmark/blobstore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,29 @@ def perform
big_droplet_guid, resource_timing = upload_droplet(big_droplet_file.path)
puts("big droplet upload timing: #{resource_timing * 1000}ms")

[
['0.005MB', (0.005 * 1024 * 1024).to_i],
['10MB', 10 * 1024 * 1024],
['200MB', 200 * 1024 * 1024],
['500MB', 500 * 1024 * 1024]
].each do |label, size|
tempfile = Tempfile.new("big-droplet-#{label}", resource_dir)
File.open(tempfile.path, 'wb') do |f|
chunk = '0' * (1024 * 1024) # 1MB chunk
written = 0
while written < size
to_write = [chunk.bytesize, size - written].min
f.write(chunk.byteslice(0, to_write))
written += to_write
end
end

big_droplet_guid, resource_timing = upload_droplet(tempfile.path)
puts("big droplet #{label} upload timing: #{resource_timing * 1000}ms")

tempfile.close!
end

resource_timing = download_droplet(big_droplet_guid, resource_dir)
puts("big droplet download timing: #{resource_timing * 1000}ms")
ensure
Expand Down
1 change: 1 addition & 0 deletions lib/cloud_controller/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
require 'cloud_controller/config_schemas/worker_schema'
require 'cloud_controller/config_schemas/deployment_updater_schema'
require 'cloud_controller/config_schemas/rotate_database_key_schema'
require 'cloud_controller/config_schemas/blobstore_benchmarks_schema'
require 'utils/hash_utils'

module VCAP::CloudController
Expand Down
81 changes: 81 additions & 0 deletions lib/cloud_controller/config_schemas/blobstore_benchmarks_schema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
require 'vcap/config'

module VCAP::CloudController
module ConfigSchemas
class BlobstoreBenchmarksSchema < VCAP::Config
# rubocop:disable Metrics/BlockLength
define_schema do
blobstore_section = {
blobstore_type: String,
blobstore_provider: String,

optional(:connection_config) => Hash,
optional(:fog_connection) => Hash,

fog_aws_storage_options: Hash,
fog_gcp_storage_options: Hash,

optional(:resource_directory_key) => String,
optional(:buildpack_directory_key) => String,
optional(:app_package_directory_key) => String,
optional(:droplet_directory_key) => String,

optional(:maximum_size) => Integer,
optional(:minimum_size) => Integer,
optional(:max_package_size) => Integer,
optional(:max_valid_packages_stored) => Integer,
optional(:max_staged_droplets_stored) => Integer
}

{
optional(:logging) => {
optional(:level) => String,
optional(:file) => String,
optional(:syslog) => String,
optional(:stdout_sink_enabled) => bool
},

db: {
optional(:database) => Hash, # db connection hash for sequel\
max_connections: Integer, # max connections in the connection pool
pool_timeout: Integer, # timeout before raising an error when connection can't be established to the db
log_level: String, # debug, info, etc.
log_db_queries: bool,
ssl_verify_hostname: bool,
connection_validation_timeout: Integer,
optional(:ca_cert_path) => String
},
storage_cli_config_file_resource_pool: String,
storage_cli_config_file_buildpacks: String,
storage_cli_config_file_packages: String,
storage_cli_config_file_droplets: String,

db_encryption_key: enum(String, NilClass),

optional(:database_encryption) => {
keys: Hash,
current_key_label: String,
optional(:pbkdf2_hmac_iterations) => Integer
},

resource_pool: blobstore_section,
buildpacks: blobstore_section,
packages: blobstore_section,
droplets: blobstore_section,

pid_filename: String,
index: Integer, # Component index (cc-0, cc-1, etc)
name: String, # Component name (api_z1, api_z2)
default_app_ssh_access: bool
}
end
# rubocop:enable Metrics/BlockLength

class << self
def configure_components(config)
ResourcePool.instance = ResourcePool.new(config)
end
end
end
end
end
3 changes: 2 additions & 1 deletion lib/tasks/blobstore_benchmarks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ require 'cloud_controller/benchmark/blobstore'
namespace :benchmarks do
desc 'Perform blobstore benchmark'
task perform_blobstore_benchmark: :environment do
BackgroundJobEnvironment.new(RakeConfig.config).setup_environment do
RakeConfig.context = :blobstore_benchmarks
BoshErrandEnvironment.new(RakeConfig.config).setup_environment do
VCAP::CloudController::Benchmark::Blobstore.new.perform
end
end
Expand Down
Loading