Optimizations to instance list (OC-2122)
Created by: bradenmacdonald
This implements OC-2122 to improve the usability of the instance manager UI and API.
Major changes:
- Before this PR, the
/api/v1/instances/
endpoint would require (5 + 10*n) SQL queries to return the instance list when there were n instances. After this PR, that has been reduced to 9 queries regardless of the number of instances. See the newtest_instance_list_efficiency()
test for how that is verified. - As discussed in the OC-2122 ticket, I have converted the
is_shut_down
method (which was fairly expensive) to a database field calledis_archived
. The meaning of archived is meant to be more clear as well: an archived instance is no longer meant to be online, and all associated resources should be freed, but its data and history should be preserved. - When clicking on an AppServer in the UI, the logs will now not be loaded unless you open the panel that contains the AppServer logs. In addition, the "Status" panel is now expanded by default.
Minor changes:
- I had an AppServer on my vagrant instance where the VM was
terminated
but the AppServer was stuck inConfiguringServer
. When I calledterminate_vm()
on it, I was surprised that nothing happened - so I fixed that method to update the AppServer status appropriately. - The UI did not show whether or not RabbitMQ was provisioned for an instance, as it does for MySQL, MongoDB, and Swift. Now it shows the RabbitMQ provisioning status too.
Notes:
Since is_archived
is now a database field and is_shut_down()
has been deleted, the data migration uses a heuristic technique to fill in is_archived
values which may not perfectly match the old behavior of is_shut_down()
. As a result, it's possible there are some corner cases where instances that were previously shown as shut down do not appear as archived or vice versa. I do not anticipate that being a significant problem though.