Reprint Address: http://www.ibm.com/developerworks/cn/rational/r-cn-clearmakebuild/
Building management is an important module of ibm®rational®clearcase products, it integrates software PRODUCT construction and software development configuration management seamlessly, facilitates unified management, and also provides parallel and distributed construction, which provides convenience for building an efficient and stable environment. There are two building applications Clearmake and Omake in ClearCase build management. Clearmake can be used for makefile-based build customers on Unix, Linux, and Windows platforms, Omake primarily for customers who need to be compatible with build programs on Windows. This article revolves around Clearmake to show how to achieve a high-performance enterprise-level build environment.
0 Reviews:
Wang Weimin, software engineer, IBM
Li Xuepeng, software engineer, IBM
September 28, 2010
Develop and deploy your next application on the IBM Bluemix cloud platform.
Start your free trial now
With the popularity of agile development and continuous integration, software products basically require daily construction, which is a big challenge for the building environment of software enterprises. An efficient and stable construction environment plays a more and more important role in improving the efficiency of software development. For many software development teams, building efficiency is their most important aspect, this article discusses how to improve the efficiency of construction, and gives some concrete solutions.
Building management is an important module of ibm®rational®clearcase products, it integrates software PRODUCT construction and software development configuration management seamlessly, facilitates unified management, and also provides parallel and distributed construction, which provides convenience for building an efficient and stable environment. There are two building applications Clearmake and Omake in ClearCase build management. Clearmake can be used for makefile-based build customers on Unix, Linux, and Windows platforms, Omake primarily for customers who need to be compatible with build programs on Windows. This article revolves around Clearmake to show how to achieve a high-performance enterprise-level build environment.
Build is the key to continuous integration
Continuous integration (continuous integration) can effectively improve the frequency of the release of software products, it is also an important way to achieve agile development, continuous integration is the construction of software products, installation configuration and deployment, automated testing, test results Analysis report, Build results packaged and distributed this series of processes creates an automated process that does not require human intervention. This automated process is usually performed nightly, the next morning you can see the latest development features of the test results, if no test errors appear, you can also get the latest product installation package, which can effectively improve the SOFTWARE product development and testing efficiency.
The following diagram depicts a typical continuous integration platform:
Figure 1. A typical continuous integration platform
The platform is composed of the following parts:
- Build a server to build your product
- Deploy servers, install, configure, and deploy build results to prepare for automated testing
- Automate test environments, trigger and execute automated test scripts
- Test Results Analysis Report Server
- Product installation package distribution server, development and testers, customers can obtain the installation package from this server
All of these servers are connected through ibm®rational buildforge products and how they communicate with each other please refer to the Buildforge article for details.
It can be seen that the construction of software products is the key to the platform, other processes rely on the results of software construction, software component efficiency and stability directly determine the availability of the continuous integration platform.
Back to top of page
Introduction to the construction management of ClearCase
Building management is an important module of ClearCase, there are two building applications Clearmake and Omake in ClearCase, both of which are standalone executables, not Cleartool subcommands, and the makefile files they use are compatible with other constructs The makefile used by the building tools.
Terminology and concepts
The following terminology is the basis for in-depth understanding and use of clearmake and is a concept that must be mastered.
Derived object do (Derived object): Build the produced target file, such as obj file, library file
Configure records CR (configuration record): Records the build process about do, including building environment information, building scripts, code versions, build time, inputs and outputs, and much more, it can also help locate some build errors.
Audit (Audit): Applies only to dynamic views, is monitored by MVFS during the build process, creates a CR for the newly generated do, and associates the do with the CR.
Build avoid (build avoidance): Use existing do as much as possible to avoid the ability to create new do.
Configure query (configuration Lookup): Compare candidate Do's CR in the current view and other views to determine whether you can use the current view and other views of do to determine whether a rebuild is required to generate a new do. Configuration queries There is also a very image of the name called Shopping (shopping), if the dynamic view analogy to the shop, then in many shops to find the desired do commodity process is the same as the shopping process.
Wink-in and Promotion: Describes the whole process of wink-in and Promotion. In view 1, the build generated do util.obj, when the CR and util.obj are stored in view 1. When the user initiates the build in view 2, the configuration query (shopping) occurs, and the build will query for available do in view 2 and view 1, and if found it will not be rebuilt to generate a new do, but rather to reference the existing do, which is the ability to build avoidance. Build once the desired do is found in view 1, it causes the Do and CR in view 1 to be copied into the VOB, which is called promotion, when the Do state in view 1 is changed from unshared to shared. View 2 Creates a connection to do in the VOB to refer to util.obj in view 1, a process called wink-in.
Figure 2. Wink-in and Promotion The entire process clearmake the benefits of building
Clearmake has the following advantages over other building products:
- You can seamlessly connect with ClearCase's configuration management, get the desired code version from the VOB and build the build results (do and CR) into (check in) VOB, providing multiple versioning for build results.
- Builds have auditing capabilities (for dynamic views only), which not only generates CR for do, but also associates them.
- Create a shared DOs that allows multiple dynamic view shares on the same or different build machines to build the target file, avoiding duplication of builds and improving build efficiency.
- CR provides a lot of building information, you can use the
catcr command to view a do CR information, in this information, you can see the build version of the source code, build statements, build the environment and other information, you can use this information to build tracking, error analysis.
- Support for parallel and distributed building, which is not available in many other component products, can greatly improve the efficiency of construction.
Because Clearmake has these advantages, it offers more choices for building an enterprise-class, high-performance build environment. Not only does it significantly improve build efficiency, it provides a more flexible way to build, but it also provides the ability to build tracking and build error analysis.
Back to top of page
How to achieve a high-performance build environment
For many software development teams, building efficiency is their most important aspect, which directly affects the development efficiency of software products, and here are 5 ways to improve build performance, in which both parallel and distributed builds are unique to clearmake.
1) Build and Audit (Audit) the correct selection of Express (Express)
Typically, the build operation is performed in ClearCase's dynamic view, where the build is audit-capable, that is, in addition to generating do, the CR is created and do-related, and the build is monitored by MVFS. And the created do includes two parts: the do file itself and the Catalog entry in the VOB. This means that when you create do, you lock the VOB first and then write the VOB, which is slower. And because lock VOB, so affect the normal use of VOB.
Express build also creates do and CR but does not create Catalog entry in VOB, there is no lock VOB and write VOB action, this effectively improves the build speed, but the build generated do state is non-shareable, which means this Do cannot be shared by other views because it cannot be found from the VOB Catalog entry when making configuration queries. You can also use winkin and view_scrubber –p transfer non-shareable do to shared do. Please note the difference between unshared,shared and non-shareable.
When creating a dynamic view with the command line, you can specify –sha/reable_dos or –nsh/areable_dos parameters to determine whether the build in this view is Express or audit build.
When you use the GUI to manipulate ClearCase, you can specify that type of build in the view's properties interface:
Figure 3. Specify that build in the view's Properties Interface 2) using the remote do pool
In an enterprise-level build environment, the frequency of construction is quite high, that is, do is generated and deleted very frequently, which is a high throughput requirement for the I/O of the build server, which is likely to become an efficiency bottleneck. By default, do is stored under the D directory in the VOB physical storage root directory, that is, do pool, in order to resolve the I/O throughput performance bottleneck, you can transfer the do pool to a separate server, you can use the Chpool command to implement this transfer, and then when creating do Use the new do pool. This scrubber task for do pool also occurs on this standalone server, which also reduces the load on VOB servers.
3) Use multiple build session
A build session is launched when the Clearmake command is executed in the view context, and the build session can have some sub-session,clearmake support for nested build functions, each of which has its own independent audit function 。 When performing a larger build task, you can start several build sessions, each of which takes part of the task and finally merges the build results to improve the efficiency of the build. For example: to build a larger directory \lib, there are three subdirectories in this directory \lib\vob, \lib\view, \lib\db, in this case you can start 3 build session, a build VOB directory, a Build view directory, a third build DB directory 。 When the three subdirectories are built, the Lib directory build is complete.
4) using parallel builds
Clearmake also supports parallel builds, so-called parallel build is when the Clearmake command is executed, the system will automatically start a specified number of processes to work together to complete this build task, you can use ClearMake –J parameters to specify the number of processes. The determination of this number should be based on the load of the building machine, too much or too little is not conducive to performance improvement. All processes are created by Clearmake to initiate, how these processes divide tasks and collaborate without human intervention, and are controlled entirely by Clearmake.
5) Using distributed builds
The so-called distributed build, on the basis of parallel building, will automatically start the process distributed on different building servers, so as to improve the throughput of each build process, because different build server computing power is different, you can also configure the following files and environment variables to achieve load balancing:
/var/adm/atria/config/bldserver.control $HOME/.bldhost $CCASE _host_type
Back to top of page
Application examples
Here we assume that the reader is already an advanced user of ClearCase and is familiar with ClearCase's network topology and deployment. But the current build environment uses the traditional way of building the entire project with its own Makefile files. Here's a detailed description of how to use Clearmake to build a high-performance enterprise build environment.
1) Typical ClearCase network topology Figure 4. A typical ClearCase network topology
is a typical ClearCase network topology. The source code is placed on the VOB server, and all development machines point to the Register server. With traditional builds, each developer builds on his or her own machine, which is inefficient and some common binaries cannot be shared. Especially in the agile development model, the goal of building once a day can not be achieved.
2) Build an environment topology using Clearmake
To take advantage of clearmake, we also need an additional two servers, a Do VOB server, to store the built-in do files. These files are not stored according to the version increment, so the amount of space growth will be very fast, need to prepare a large disk space server, and need to delete some unnecessary do files, in the next section will detail the use and role of this server. The other is the build server, which is used to build the individual developers, and allows the product publisher to build the entire product at night, so that testers can keep track of the progress. This service requires a good performance, preferably a multi-core configuration of the server, so that you can start multiple processes to build the entire product.
After the two servers are ready, install the same version of ClearCase as the register server above and point to the register server. Dynamic views are required on the build server to maximize the benefits of Clearmake.
Figure 5. Clearmake-based build environment with two additional servers added
Is the Clearmake-based build environment that was added after two servers. The Do VOB server will be used to store the do files that are shared by each developer during the build process. Developers can build on their own development machine, or build on a build server
3) Do VOB server
First, make a portion of the space in the Do VOB server as a remote do pool for the source-code VOB server. Developer-built do files are stored on this remote do server through promotion/wink-in operations to achieve the purpose of shared do and better I/O throughput for improved build efficiency. Because this repository expands rapidly, administrators need regular scrubber.
In a large project, builds typically rely on a large number of shared libraries and third-party libraries, including dynamic-link libraries, static libraries, and executables, which generally do not change, but each build relies on them and they are used very often, so they need to be placed in the Do VOB server. Developers can use these existing do files directly to improve the efficiency of their builds when building the entire product or a component. Do VOB try not to and source code VOB on a server, because this VOB is growing very fast and needs to be cleaned up frequently. And this VOB is best to use the ClearCase base mode to manage, so it will be easy to clean up. Do VOB should have strict permissions control can not let developers arbitrarily put their own do, because these do are some binary files, CC can not be saved in an incremental way, must be all copied to save. If you randomly upload your own built-in do, you will soon be full of disk space. On the other hand, some of the tests that have not been tested may affect the normal build process of others. It is generally managed by the person responsible for the entire product build, controlling this do VOB.
4) Configuring the Parallel Build environment
Clearmake supports parallel builds, allowing multiple processes to be built simultaneously on a single machine, which can greatly save build time. Here is a detailed description of how to do parallel construction and some considerations:
Clearmake controls the number of parallel build processes in two ways, one environment variable CCASE_CONC and one specifying parameters from the command line -J . The maximum number of parallel builds that Clearmake initiates will not exceed the number specified here. Set the number of parallel builds according to the load of the system.
When using parallel builds, be aware of the fact that, while building some files, there is no dependency, but for some reason it is not possible to build them in parallel. For example, some files will be built at the time of the creation of some intermediate files, then immediately deleted, in the non-parallel build without problems, can produce the same name of the intermediate file, will not affect the subsequent build process. But in parallel builds, these intermediate files of the same name will affect each other. You can stop using parallel builds for some special files. Join in the build file. Notparallel, the specified file can not be built in parallel. such as the following:
. Notparallel:%.a. NOTPARALLEL:X.C y.c
The first sentence indicates that all. A files are not built in parallel. The second sentence indicates that the X.C and y.c files are not built in parallel. However, the. a file and x.c or y.c can be built in parallel.
5) Use Clearmake to build your product
When the above configuration is completed, the developer can use the original Makefile file to build it. Clearmake itself does not compile, build the function, it will build the product according to the Makefile file, call the GCC and other compilers to build the product. Developers can build their own views in their own development streams and then call Clearmake to construct them:
. clearmake–f Makefile–j 5
This command invokes the Makefile file in the current directory, starting 5 processes to build the entire product at the same time. Clearmake can also use the build options file to define some macro variables. We recommend that you write some temporary macro variables (for example CFLAGS=–g , options with debug parameters on UNIX) to a build options file, and then specify the file when you build it.
. clearmake–f Makefile–a/var/tmp/option
Back to top of page
Summarize
To sum up, ClearCase's building blocks provide a unique set of concepts and mechanisms for achieving a high-performance enterprise-class build environment, many of which are fundamental to mastering clearmake or omake, such as DO,CR, auditing, building avoidance, configuration queries, shopping, Promotion and Wink-in. In addition we understand the difference between the three states of Do: Unshared,shared and non-shareable. On this basis to master the 5 ways to improve the Clearmake build performance: The correct choice of express or audit building, using the remote do pool, using multiple build sessions, using parallel and distributed building. At last, the typical network extension structure is given, and some detailed problems and precautions are discussed in practical use. All of these concepts, mechanisms and methods provide convenience for building a high-performance enterprise-class build environment, laying the foundation for continuous integration, ultimately improving the efficiency of software development and testing, increasing the frequency of software releases, and shortening the cycle of software development.
Build high-performance enterprise-class build environments with Rational ClearCase Clearmake