A METHOD AND SYSTEM FOR CONTINUOUS SOFTWARE MONITORING
This invention relates to a method of and system for continuously monitoring the performance of computer programs and software systems, and particularly throughout the life-cycle of the program or software system.
Computer hardware has become rapidly more sophisticated and powerful since its inception. The software which runs on this hardware has grown in size and complexity at an even more rapid rate. Systems which contain vast amounts of software (such as telecommunications systems) are difficult to comprehend, let alone monitor, accurately access and find faults within.
Established forms of engineering, particularly process engineering, have continuous monitoring processes built in throughout a system. Examples include monitors such as temperature gauges, flow meters and pressure gauges. Because of the rising level of complexity of computer software systems, it is important to be able to use these principles, established in other forms of engineering, and apply them to software engineering.
When a software system is required to meet a certain set of functional requirements it is important to have the software built so that it maximizes its ability to fulfill the requirements. This leads software to be built in a so-called 'optimal' manner which leaves little room for extraneous activities which do not directly contribute to the ability of the software to meet those functional requirements.
It is, however, desirable to monitor functional and non-functional attributes of a software system continuously without the intrusive overhead of inlining the monitoring code. Another important motivation for continuous monitoring is the increasing trend for software development contracts to contain specifications about the non-functional aspects of a system. Of particular interest in these contracts are the non-functional requirements of performance, reliability, usability and
maintainability. It is also desirable to provide a method and system which can continuously monitor attributes of a software system throughout the complete life- cycle of the system at all stages from development, through production to decommission.
According to one aspect of the invention there is provided a method of continuously monitoring the performance or attributes of computer software comprising the steps of: compiling a functional computer program for execution in a target computer environment; specifying the attributes of the functional computer program to be monitored at the time the functional computer program is compiled and simultaneously compiling a monitoring computer program for parallel execution in said target computer environment; said monitoring computer program being adapted to extract data continuously from said functional computer program when said programs are executed in parallel; and analyzing said data to obtain information about the performance or other attributes of said functional computer program.
The functional and monitoring computer programs may be recorded on any convenient memory or data storage means. According to another aspect of the invention there is provided data storage means including functional computer program and a monitoring computer program for monitoring the performance or other attributes of said functional computer program, said functional computer program being arranged to perform a functional application when executed in a target computer environment, wherein attributes of the functional computer program to be monitored are specified when the functional computer program is compiled, said monitoring computer program being compiled at the same time the functional computer program is compiled, and said monitoring computer program is adapted to extract data continuously from said functional computer program when the
computer programs are executed simultaneously in parallel.
Whilst the functional and monitoring computer programs may be executed in a common processor unit, it is preferred that a separate monitoring processor be provided for executing the monitoring program in parallel to the functional computer program.
This is desirable so that execution and performance of the functional computer program is not adversely affected to a significant extent by execution of the monitoring program and by the processing and analysis of data for monitoring the functional program.
The functional computer program and the monitoring program are preferably compiled so that each process which is spawned in the functional computer program has its own monitoring process which is spawned in the monitoring program. Each process of the functional computer program preferably has its own address space in order to minimize intrusion by the monitoring program. However some intrusive code, automatically supplied during compilation may be necessary to ensure that all monitored information is passed transparently between the functional and monitoring processes.
Preferably, the functional computer program and the monitoring computer program are compiled to include links between the monitoring program and the functional computer program to enable data to be extracted from the functional computer program by the monitoring program. A wide variety of aspects of performance or attributes of functional computer programs may be monitored by the method of the present invention. These include: current execution costs; exceptions in the functional program; the actual time spent in a function; and the use of external resources.
The monitoring process executed by the monitoring program is preferably arranged
to rendezvous with the functional computer program on termination of a functional process performed by the functional computer program. This is particularly desirable if the monitoring process is collecting timing information, e.g. the actual time spent in a function.
The monitoring computer program may also be arranged to terminate a process of the functional computer program upon detection of a fatal error in said process by the monitoring computer program.
According to another aspect of the invention there is provided a system for continuously monitoring the performance or attributes of a functional computer program comprising: compilation means arranged to compile the functional computer program and a monitoring computer program from a source language into a computer code, the monitoring computer program being arranged to monitor attributes of the functional computer program specified at the time the functional computer program is compiled; execution means arranged to execute the monitoring computer program simultaneously in parallel with the functional computer program, wherein the monitoring program is arranged to interact with the functional computer program to extract data continuously from the functional computer program when said programs are executed simultaneously; and analyzing means for analyzing the data extracted from the functional computer program to continuously monitor the specified attributes of the functional computer program.
The execution means may comprise a common processor unit for executing the functional and monitoring computer programs simultaneously in parallel. However, the execution means preferably includes an application processor for executing the functional computer program (the "main application") and a monitoring processor for simultaneously executing the monitoring program in parallel.
A communications link, preferably a high speed communications bus, is conveniently provided between the main application processor and the monitoring processor to enable data to be extracted from the main application by the monitoring program.
The compilation means for compiling the functional and monitoring computer programs may comprise a single compiler. Alternatively, separate compilers may be used to compile the functional and monitoring computer programs. Where separate processors are used, a multiprocessor loader may be used to load the functional and monitoring programs into the main application processor and the monitoring processor respectively.
When the monitoring processor is loaded with the monitoring program, it preferably includes a monitoring means for receiving and processing data from the main application. The monitoring processor may also include memory means for storing statistical data about the main application which is monitored, and the analyzing means may comprise a log module which is adapted to process the data received from the main application by the monitoring means and statistical data from the memory means to produce information about the performance and attributes of the main application.
The system may conveniently also include display means, preferably one or more graphic displays, for displaying the information about the performance and attributes of the functional computer program produced by the analyzing means.
The system of the present invention is thus able to monitor the performance, quality and attributes of a functional computer program while it is being executed. The system is built around the ability to provide continuous process monitors when compiling the computer code, with the process monitors being written in the same source language. The source language chosen should be able to support multiple processes and process monitoring. There are a large number of suitable languages
available, one of which is Erlang, a source language developed by Telefonaktiebolaget L M Ericsson. Erlang is particularly suitable for use in the present invention because its features include timing support, multiple process support, dynamic module loading, a built in error handling mechanism and real- time garbage collection.
A preferred system in accordance with the invention will now be described, by way of example only, with reference to the accompanying drawing in which:
Figure 1 is a block diagram of a continuous monitoring computer system in accordance with the invention.
Referring to Figure 1, there is shown a continuous monitoring computer system comprising first and second compilers 10 and 20, a main application processor 30, a monitoring processor 40 and a multiprocessor loader 50 for the main application processor 30 and the monitoring processor 40.
Each compiler 10, 20 is a modified Erlang compiler which is arranged to compile a computer program in computer code (C code) from a source code written in Erlang, a programming language developed by Telefonaktiebolaget L.M. Ericsson. It will, however, be appreciated that other programming languages may be used instead of Erlang in the present invention.
The first compiler 10 is arranged to compile a functional computer program, the "main application" from a standard application process 12. The second compiler 20 is arranged to compile a monitoring program from an auto build monitoring process 22 using predetermined monitoring attributes or parameters 21 specified at the time the functional computer program is compiled. The main application and the monitoring program are arranged to be run in parallel simultaneously by the main application processor 30 and by the monitoring processor 40.
The main application processor 30 and the monitoring processor 40 communicate
with each other by a high speed communications link or bus 25 which enables the monitoring processor 40 to extract data continuously from the main application processor 30 as the functional computer program is executed by the main application processor 30. In an alternative embodiment, the main application processor 30 and the monitoring processor 40 may utilize a shared memory to simulate the communications link between the processors.
The main application processor 30 executes the main application 32 which is programmed during compilation by compiler 10 to contain links 14 to the monitoring program. The monitoring program is also programmed during compilation by the compiler 20 to contain links 24 to the main application program to be monitored. The application processor 30 loaded with the main application 32 includes at least one spawn monitor 34 which, when the main application process is being run, passes data about the main application via the high speed bus 25 to the monitoring processor 40.
The monitoring processor 40 loaded with the monitoring program includes a monitoring module 42 for receiving and processing data from the spawn monitor 34 of the main application 32, a log processor 44, and a statistics processor 46 which includes memory means for storing statistical data about the main application process which is monitored.
The log processor 44 of the monitoring processor 40 is adapted to process data about the main application received by the monitoring module 42 and statistical data received from the statistics processor 46. In this manner, the log processor 44 can continuously examine and analyze data extracted from the main application process while it is being run by the main application processor 30 to produce information about the performance and attributes of the functional computer process representing the main application. The log processor 44 is also able to communicate via the high speed bus 25 with a rendezvous section 36 of the main application 32 when a process in the main application is terminated so that the time
taken to run the process in the main application can be monitored, and that any error information can be passed to the main application. If a fatal error in a process of the main application is detected by the monitoring processor 40, the process being monitored can be terminated by the log processor 44 without any change to the system state, and recovery initiated as if the process had not commenced.
The log processor 44 is in communication with one or more display means 60, preferably in the form of a graphical display which can display a graphical analysis about the performance or attributes of the main application process.
The monitoring processor 40 may be programmed to include a wide variety of different continuous process monitors for continuously monitoring different aspects of the performance or attributes of the main application process. Examples of continuous process monitors which may be included in the monitoring processor are: a real-time profiler which functions as a statistical sampler of a program counter of the main application processor to keep a decaying record of current execution costs; an exception monitor which monitors exceptions throughout the system (down to the process level); an actual time monitor which measures the actual time spent in a process (it may also keep a record of other system activity); and an external resource access monitor 44 which can monitor the use of external resources such as disk channel, of each process.
Various other continuous process monitors may be provided, such as system specific monitors which can present data collected against the system specifications over a variety of time frames enabling the user to examine trends in the system. These include reliability and maintainability monitors.
The manner in which the main application and the monitoring processes are compiled by the compilers 10 and 20 using Erlang as the source code language will now be described.
The system of the present invention for providing continuous process monitors is built around the ability to provide system monitors automatically when compiling code. This provides a system similar to the provision of profiling in existing compilers except that the monitors will be written in the same source language.
In conjunction with choosing this approach it is necessary to select a language with a philosophy which will comfortably support multiple processes and process monitoring. There are a large range of languages available, but Erlang has been chosen as a preferred language for a number of reasons:
- its concurrent programming philosophy;
- the language provision of process support mechanisms;
- its inherent simplicity (based upon a functional language); and - built in language mechanisms to handle failure.
A primary feature of Erlang is its management of multiple processes as a fundamental part of the system. The feature is critical to the construction of a monitoring Erlang compiler and to plan for this capability in the construction phase .
The monitor is designed for a multiple processor environment although in a prototype system Unix process support (sockets and Unix communications between machines: internet sockets) is utilized to support multiple processes. To do this each process is linked into an Erlang runtime library which provides this communication support. Processes communicate via sockets in (or internet ports) with their Unix pid as the socket identifier. This (with the machine id) is the identifier that gets created when a process is spawned. The Erlang runtime library also contains other support code for Erlang internals such as list and tuple
management. The actual compilation takes place in a number of phases:
1. Lexing/parsing - this phase will produce an abstract syntax tree.
2. Optimization - break the tree into basic blocks for local expression optimization. Try 'global' (within a module) optimization; also do (importantly) last call optimization.
3. Code production - this is essentially the transformation of the tree into C code.
4. The C compiler then performs other optimizations.
Since the target language is Erlang the monitoring processes are also written in Erlang. The compiler includes code in the functional process to spawn the hand coded monitoring process automatically using the existing Erlang system for process creation and control. Monitors are intended to be processes that simply collect information. These monitoring processes can then pass data along to other processes responsible for the analysis and presentation of that data. Since monitors are written in the source language (Erlang) the process communication mechanisms in Erlang can be exploited to forward this information to other processes which are responsible for displaying and analyzing the collected information. The compiler which compiles from Erlang to C-code can support the following features: dynamic loading, run-time garbage collection and multiple process support (over multiple machines).
Depending on what information the monitoring process is collecting it may be necessary for the monitoring process and the functional process to rendezvous on the termination of the functional process. This is particularly the case if the monitoring process is collecting timing information. This rendezvous can create a performance overhead in cases where the execution of the monitoring process is held up for some reason. It is intended that the monitoring processes be small and straight forward processes which contain little functionality other than data gathering mechanisms. By virtue of the monitoring process being simple and small it is predicted that these processes will generally be ready to rendezvous with the
functional process when the functional process is ready to terminate.
The present invention therefore provides an effective method and system for continuously monitoring the performance or other attributes of a functional computer program which does not adversely affect the execution of the functional computer program to a significant extent.
In the method and system of the present invention, specifying the attributes to be monitored and compiling the monitoring program at the time the functional computer program is compiled allows the specified attributes to be monitored throughout the life-cycle of the functional computer program.
It will be appreciated that various modifications may be made to the embodiment described above without departing from the scope and spirit of the present invention. For instance, whilst the present invention has been described above with reference to Erlang as the source language, other source languages having similar properties and functions may be used.