Condividi tramite


Writing WMI providers FAQ series - 3 - Is it better to use embedded objects or association in a CIM model?

It happens that some CIM models need to link various entities together. The recommended approach for doing this is to use Associations and References. By default WMI is capable to handle associations based on the relations defined in the CIM schema. However, this mechanism involves an enumeration of both ends represented by the associations. Once completed, WMI core makes the required filtering to provide the expected results to the WMI client. Obviously, although this default mechanism works for all instance providers, it is not optimal for situations where complex relationships or large amount of information is involved. In such a case, it is recommended to implement the query capabilities in the providers to ensure the best performance. Indeed, who knows better than the provider developer or designer to query the manageable entity to retrieve the relevant information?

Some implementations make use of embedded objects to link manageable entities together. Those embedded objects are constructed from an existing WMI class (or the properties that return them are using a CIM class type). Although technically feasible, the implementation of embedded objects has some payloads and side effects.

· When a WMI client requests a collection of properties that are actually populated by one or several embedded objects, the CIM schema definition sent over the wire to the WMI client is also encapsulated in every WMI object. In case of an array of embedded objects, this will create an inevitable overhead of information on the network.

· Next, if the WMI client enumerates all instances, where these instances expose properties containing embedded objects, each embedded object needs to be resolved to populate the properties before the actual requested instance is returned to the WMI client. This may create a serious overhead for the performance. Of course, everything depends on the number of instances are returned, the number of embedded objects contained in the properties of the instances.

· Because objects are embedded in properties, there is no way for WMI to query them. However, using association instead gives the ability to WMI clients to query about the relationships that are in place.

Despite a possible implementation of embedded objects and due to the various side effects of such a model, it highly is recommended to consider the use of Association.

 

Kapil Mathur [MSFT]