A SonarQube instance includes a Web Server, a Compute Engine and an Elastic Search node. Out of the box, a Compute Engine can only consume one project report at a time.
The Governance plugin should provide a property to allow configuration of the number of Compute Engine workers to launch. This property must always (MMF-955) be visible and documented on the global Background Tasks page. It must be active only when the Governance plugin is installed. (If the Governance plugin is installed but not licensed, analysis will fail so checking license state is not necessary.)
- name: CE Workers Per Node
- description: If your queue backs up behind analysis reports from large projects, increasing the number of Compute Engine workers will allow you to take full advantage of having configured increased Compute Engine memory on a multi-core server (vertical scaling).
- type: internal property
This property must be stored in the database and not settable via sonar.conf or any other configuration file.
This feature may or may not be handled differently with the High Availability module. The functionality described here assumes a single node.
Because this property is provided by the Governance Pack, it will not be settable without the plugin and should continue to default to 1 when Governance is unavailable.
Any new configuration value that evaluates to an integer < 1 must return an error to the user. If such a value somehow slips through all the guards and is stored in the database, worker count must automatically reset (in use/memory if not in the DB) to 1. Such a reset must be reflected in ce.log with a message like "Configured worker count 'xxx' is invalid. 1 will be used instead."
It seems prudent (although slightly paranoid) to set a maximum possible worker count of 10. Any new configuration value that evaluates to an integer >10 should be reset to 10 and return a warning to the user. If a value >10 is somehow stored in the database, worker count must be automatically reset to 10. Such a reset must be reflected in ce.log with a message like "Configured worker count 'xxx' is higher than allowed. 10 will be used instead."
Active worker count will be managed dynamically.
sonar.ce.workerCount will no longer be valid and should be removed from sonar.properties. If this value is present, a warning will be logged that the property is no longer valid, and will be ignored. This warning can be removed in the 7.0 version of SonarQube.
It is out of scope to try to give the user any advice on optimal worker count, such as
- "You have n cores but only m workers configured,"
- "Warning: n workers may bog down your m-core server."
It is also out of scope to calculate any numbers, such as "average queue time/ last 24hrs" which might prompt a user to update her worker count.
In Administration > Projects > Background tasks the user will find the default number of workers clearly stated in the top right corner.
When the Governance Pack is installed, an edit icon will be available next to it
When the Governance Pack is not installed, a highly noticeable button will appear to promote it. It wiil link to https://redirect.sonarsource.com/plugins/governance.html