Have doubled workers for keystone service

Since we have merged 2 keystone services(public and admin) into one,
we need to double keystone workers so that we have the same number of
workers, which is necessory to avoid performance degradation.

This patch introduced new facter, os_workers_keystone, which returns
2 x os_workers .

Change-Id: I737fb14739a69ac12c39c7faf6dd2be1f772daa6
This commit is contained in:
Takashi Kajinami 2020-01-31 00:27:07 +09:00
parent 0dcd58e2ee
commit 74e0f5a317
2 changed files with 49 additions and 0 deletions

View File

@ -61,3 +61,16 @@ Facter.add(:os_workers_heat_engine) do
[ [ (processors.to_i / 2), 4 ].max, 24 ].min
end
end
#
# Since we have merged keystone admin and keystone public into a single
# keystone instance, we need doubled workers to have the same number
# of workers in total to avoid performance degradation.
#
Facter.add(:os_workers_keystone) do
has_weight 100
setcode do
processors = Facter.value('processorcount')
[ [ processors.to_i, 4 ].max, 24 ].min
end
end

View File

@ -0,0 +1,36 @@
require 'spec_helper'
describe 'os_workers_keystone' do
before { Facter.flush }
context 'with processorcount=1' do
before do
Facter.fact(:processorcount).stubs(:value).returns(1)
end
it 'returns a minimum of 4' do
expect(Facter.fact(:os_workers_keystone).value).to eq(4)
end
end
context 'with processorcount=8' do
before do
Facter.fact(:processorcount).stubs(:value).returns(8)
end
it 'returns processorcount' do
expect(Facter.fact(:os_workers_keystone).value).to eq(8)
end
end
context 'with processorcount=32' do
before do
Facter.fact(:processorcount).stubs(:value).returns(32)
end
it 'returns a maximum of 24' do
expect(Facter.fact(:os_workers_keystone).value).to eq(24)
end
end
end