Bug 1383491

Summary: Optimize memory usage by making object in hash reference small
Product: Red Hat CloudForms Management Engine Reporter: Satoe Imaishi <simaishi>
Component: PerformanceAssignee: Ladislav Smola <lsmola>
Status: CLOSED CURRENTRELEASE QA Contact: Oleksii Tsuman <otsuman>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.7.0CC: cpelland, jhardy, obarenbo
Target Milestone: GAKeywords: TestOnly
Target Release: 5.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.8.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1383496 1383497 (view as bug list) Environment:
Last Closed: 2017-06-12 17:19:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1383496, 1383497    

Description Satoe Imaishi 2016-10-10 18:45:43 UTC
From PR: https://github.com/ManageIQ/manageiq/pull/11678

The object in the hash reference should be as small as possible,
so we don't need to store that many data in memory.

An object having :id and :type is usable for relation assignment,
which is the only reason we keep this reference.

so now the object stored looks like
h[:_object]

#<ManageIQ::Providers::Amazon::CloudManager::Flavor id: 505, type: "ManageIQ::Providers::Amazon::CloudManager::Flavor">

but with the reload, we are storing

h[:_object].reload
#<ManageIQ::Providers::Amazon::CloudManager::Flavor id: 505, ems_id: 35, name: "t2.nano", description: "T2 Nano", cpus: 1, cpu_cores: 1, memory: 536870912, ems_ref: "t2.nano", type: "ManageIQ::Providers::Amazon::CloudManager::Flavor", supports_32_bit: true, supports_64_bit: true, enabled: true, supports_hvm: true, supports_paravirtual: false, block_storage_based_only: true, cloud_subnet_required: true, ephemeral_disk_size: 0, ephemeral_disk_count: 0, root_disk_size: nil, swap_disk_size: nil, publicly_available: nil>

Comment 4 Oleksii Tsuman 2017-05-05 10:30:06 UTC
verified in 5.8.0.13-rc2.20170502165848_0f98658