Summary
This article discusses a possible cause for slow Cluster Manager queries and how to correct the issue.
Solution
Cluster Manager queries that are slower than expected (through both the web interface and the command line tool) may indicate that the Cluster Manager database needs to be trimmed. The need to trim the database is highly dependent upon the database being used, the server hardware, as well as the server load. As a starting point, Electric Cloud has observed that the default MySQL installation can begin slowing down as it tracks over 500,000 builds. You can locate the number of current known builds in the Cluster Manager web interface under the Builds tab, with the Filter (on the left) set to None. At the bottom of the list of builds, there is a line that displays the number of builds (for example: "1 thru 20 of 2195", indicating that this database tracks 2,195 builds).
Web Interface
The cleanest way to delete records from the database is to use the Cluster Manager interface. Under the Builds tab, select or create a filter such as "Builds Older Than A Year", and then click Delete Filtered Builds. However, do not delete too many builds at one time, because this can stall the database, which can cause problems for in-progress builds if they are then unable to contact the database. The number of builds to delete is a balance between keeping build history versus needing to perform build cleanup maintenance. For most companies, keeping a year’s worth of build history is generally sufficient.
Command Line Interface
If you desire automation, you can use the command line interface (cmtool
) to delete builds as well. Using the above filter of "Builds Older Than A Year" (which must already exist), the equivalent command line would be:
cmtool deleteBuilds --filter "Builds Older Than A Year"
Alternatively, if there were no predefined filter, it would be possible to run this command instead (this uses the MySQL-specific datesub
function, which you may need to substitute with one specific to your database):
cmtool deleteBuilds --filter "start_time < date_sub(curdate(), interval 1 year)"
WARNING: Use caution when running the cmtool deleteBuilds
command. If you do not provide a filter, it will delete ++all build logs++.