Created attachment 970320 [details]
Production logs for navigating to vm_infra explorer and expanding archived and orphaned vms
Description of problem:
On a Global VMDB appliance which is receiving replicated records from 4 other environments now has over 15,000 VM Records mostly due to archived VMs the rendering time for vm_infra/explorer is too slow.
A large amount of time is spent rendering the page
Version-Release number of selected component (if applicable):
Always with this environment/database
Steps to Reproduce:
1. Observe page rendering time while navigating to Infrastructure->Virtual Machines
2. Can duplicate similar issue by expanding archived instances on the VM & Templates Accordion.
INFO -- : Completed 200 OK in 87072.7ms (Views: 259.9ms | ActiveRecord: 903.4ms)
>80s page rendering time with less than 1s in active record
<5s page rendering time
$ grep "select" -i production.* -c
$ grep "cache" -i production.* -c
When expanding the archived VMs, a large portion of time is spent immediately after this query:
CACHE (0.0ms) SELECT COUNT(*) FROM "vms" WHERE ((vms.id IN (1000000002911,1000000000580, .....
N+1 queries when expanding orphaned vms portion of tree:
$ grep 'SELECT "storages".* FROM "storages" WHERE "storages"."id" =' production.expand_orphaned.log -c
In my CFME scale environment with two 10k VM VMware providers attached, 20k vms total in the regional vmdb + some archived VMs (~200), I am seeing apache timeouts due to the rendering time of vm_infra page exceeding 2 minutes.
[----] I, [2015-05-21T12:30:19.560097 #10611:552080] INFO -- : Completed 200 OK in 148212.3ms (Views: 625.1ms | ActiveRecord: 2951.2ms)
This BZ is now over a year old, because of this, we are closing it. If you feel like this is a mistake and it is still a issue, please reproduce it in the latest release and create a new BZ.