From 1171ecf6662b149da1e0670438e57b5402c231b2 Mon Sep 17 00:00:00 2001 From: Sumit Jamgade Date: Mon, 2 Oct 2017 15:34:02 +0200 Subject: [PATCH] Combine batches of successive roles for same nodes, we can speed-up the application of (n+1)th role if both(n,n+1) roles are being applied on the same node. This speedup of deployment of ceilometer by atleast 1m20s (measured: 90sec) and swift by ~20s. eg. In our 2node deployment ceilometer{server,central} are always applied on the same node, given that they have different priorities, they are to be applied, one after the other. This does not violate any order constraints as the application procedure of (n+1)th role is transparent to the nth role --- crowbar_framework/app/models/service_object.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crowbar_framework/app/models/service_object.rb b/crowbar_framework/app/models/service_object.rb index ae1dcdca05..159aa7ef07 100644 --- a/crowbar_framework/app/models/service_object.rb +++ b/crowbar_framework/app/models/service_object.rb @@ -1069,6 +1069,8 @@ def apply_role(role, inst, in_queue, bootstrap = false) proposal = Proposal.where(barclamp: @bc_name, name: inst).first save_proposal = false + nodes_previousbatch = nil + roles_previousbatch = nil # element_order is an Array where each item represents a batch of roles and # the batches must be applied sequentially in this order. element_order.each do |roles| @@ -1169,7 +1171,14 @@ def apply_role(role, inst, in_queue, bootstrap = false) end end # roles.each - batches << [roles, nodes_in_batch] unless nodes_in_batch.empty? + if nodes_previousbatch == nodes_in_batch && !roles_previousbatch.nil? + # roles_previousbatch is same as batches[-1][0] + roles_previousbatch << roles + else + roles_previousbatch = roles + nodes_previousbatch = nodes_in_batch + batches << [roles, nodes_in_batch] unless nodes_in_batch.empty? + end end Rails.logger.debug "batches: #{batches.inspect}"