Created
March 20, 2018 16:25
-
-
Save Ladas/6995329c5948794bd760bd130b324ed2 to your computer and use it in GitHub Desktop.
azure_refresh
This file contains hidden or 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
equire 'manageiq_performance' | |
manager_name = ARGV[0] || "azure bigger" | |
ems = ExtManagementSystem.find_by(:name => manager_name) | |
unless ems | |
password = 'pswd'.freeze | |
userid = "user" | |
ems = ManageIQ::Providers::Azure::CloudManager.create( | |
:subscription => "subscription", | |
:uid_ems => "tenant_id", | |
:name => manager_name, | |
:provider_region => "eastus", | |
:zone => Zone.first) | |
ems.update_authentication(:default => {:password => password, :userid => userid, :save => true}) | |
end | |
def rss | |
`ps -eo pid,rss | grep #{Process.pid} | awk '{print $2}'`.to_i | |
end | |
time_now = Time.now.utc | |
puts "rss: #{rss} live objects #{GC.stat[:heap_live_slots]} gc: #{GC.stat[:major_gc_count]} pg: #{GC.stat[:heap_allocated_pages]} fpg: #{GC.stat[:total_freed_pages]} ep #{GC.stat[:heap_eden_pages]} tp #{GC.stat[:heap_tomb_pages]}---- #{time_now} #{0} " | |
options_array = [ | |
{ | |
:get_unmanaged_disk_space => false, | |
:get_private_images => true, | |
:inventory_object_refresh => false, | |
:inventory_collections => {:saver_strategy => :default}} | |
# }, { | |
# :inventory_object_refresh => true, | |
# :inventory_collections => {:saver_strategy => :default} | |
# }, { | |
# :inventory_object_refresh => false, | |
# :inventory_collections => {:saver_strategy => nil} | |
# } | |
] | |
settings = YAML.load(VMDB::Config.get_file) | |
settings[:ems_refresh][:azure].merge!(options_array.first) | |
settings[:log][:level] = "debug" | |
VMDB::Config.save_file(YAML.dump(settings)) | |
30000000.times do |i| | |
# ManageIQPerformance.profile do | |
ems.reload | |
EmsRefresh.refresh(ems) | |
time_previous = time_now | |
time_now = Time.now.utc | |
time_diff = time_now - time_previous | |
# puts "rss: #{rss} live objects #{GC.stat[:heap_live_slots]} ---- #{i}" | |
puts "rss: #{rss}, time diff: #{time_diff} live objects #{GC.stat[:heap_live_slots]} gc: #{GC.stat[:major_gc_count]} pg: #{GC.stat[:heap_allocated_pages]} fpg: #{GC.stat[:total_freed_pages]} ep #{GC.stat[:heap_eden_pages]} tp #{GC.stat[:heap_tomb_pages]}---- #{time_now} #{time_diff} #{i} " | |
# end | |
end | |
puts "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment