5.41 Designing for High Performance

 

Web NMS has different modules, such as Topology, Fault, Performance. Each module has different base objects which are software representation of real world entities. For example, a network element is represented as a Managed Object (software representation), a failure in the network is represented as an Alert, and so on.

 

Being a framework, Web NMS provides some default properties to deal with these software representations. But in the case of domain specific customization, it is required to have more properties in those objects. The following section explains the approaches through which you can add more properties based on your requirement.

 

The following are three ways in which you can add your own custom properties:



Dynamic Schema Extension

 

This option allows you to extend the schema of the table and add additional properties to it. Web NMS takes care of data storage and retrieval for the additional properties. Objects that support Dynamic Schema Extension are Event, Alert, PolledData, MapContainer, MapGroup, MapLink, MapSymbol, and all Topology tables.

 

For the modules whose objects are modeled with Hibernate like Topology, Fault Management, Map and Performance Management, in the object's mapping file for which the property is to be added dynamically, add a property tag with access attribute as in below sample tag.
For example if you need to add a new property to ManagedObject through Dynamic Schema Extension, then add a below tag to ManagedObject.hbm.xml file.
 

<property name="LOCATION" type="string" column="LOCATION" length="100" access="com.adventnet.nms.store.relational.hbn.DynamicPropertyAccessor"/>

 

where location is the property of string data type with column name LOCATION and length 100.

  1.  

    Note:  For properties of type String and Integer, the access classes are DynamicPropertyAccessor, and IntegerDynamicPropertyAccessor respectively. The implementation for Integer datatype is available in the <Web NMS Home>/default_impl/dynamic_schema_extension folder as IntegerDynamicPropertyAccessor.java. For other datatypes, refer to the README.html to write your own implementation for the accessor class.
     

When to choose this option

 

Choose this option to add your own properties when

Procedure

    1. Decide on the additional properties to be created.

    2. Add the new property to ManagedObject through Dynamic Schema Extension by adding a new tag to ManagedObject.hbm.xml file.

    3. Add the additional properties to the object using its setProperties() method. To retrieve the properties of an object (including additional properties), use the getProperties() method.

Example

 

Further, while adding alert objects in the database, set the value for EVENTCOUNT as shown below:

 

Alert a = new Alert();

Properties prop = new Properties();

prop.setProperty("eventCount","1");

a.setProperties(prop);

 

Web NMS takes care of adding the value of eventCount into the column EVENTCOUNT of Alert table.

 

Impact

 

To add/modify/delete/retrieve an object's details, only one data manipulation command will be required as the base properties and additional properties are stored in the same table. Hence this option is advantageous as no extra query is required for object persistence into the database.

 

Extending the Object

 

This option allows you to create user defined objects extending the base class or its derived class and thus in turn add additional properties. The properties of the base class will be stored in the table already available for it. For storing additional properties, you need to create another table. Objects that can be extended to store additional properties are Event, Alert, PolledData, ManagedObject and its derived classes.

When to choose this option

 

Choose this option to add your own properties when

Assume, you need to define three objects, ATypeNode, BTypeNode, and CTypeNode, derivatives of  Node, and you need to add properties X and Y for ATypeNode, M and N for BTypeNode, and D and E for CTypeNode. In such a case, extending the object Node and adding the additional properties would be the right choice when compared to other approaches.

 

Procedure

 

For complete information, refer Extended Alert topic.

 

Impact

 

To add/modify/delete an object's details, two data manipulation commands are required - one query for the base table and another for the extended table.

 

Adding as 'User Properties'

 

Hereafter, in Web NMS the module specific user properties tables like TOPOUSERPROPS, EVENTUSERPROPS, etc are commented. For example, ALERTUSERPROPS can be used to store the additional properties of the Alert object. EVENTUSERPROPS can be used to store the additional properties of the Event object. Each additional property will be stored in a separate row in the table.

All these tables will not be created, by default. If there is requirement to add any new property to the object, the same can be achieved using  the dynamic schema extension. For every entry for an object in these tables will require a query and processing the ResultSet will all affect the performance. You are recommended not to use the user properties table hereafter.

However the user properties table can be enabled before server start up by following the below steps.

Steps to enable user properties:

  1. In the object mapping file say ManagedObject.hbm.xml or Event.hbm.xml or Alert.hbm.xml file, un-comment the map tag available at the end of the file.

For Topology module, ManagedObject.hbm.xml needs to be modified. Similarly, for events and alerts, Event.hbm.xml and Alert.hbm.xml file respectively.
where
ManagedObject.hbm.xml file will be available under <Web NMS HOME>/classes/hbnlib/com/adventnet/nms/topodb directory.
Event.hbm.xml file will be available under <Web NMS HOME>/classes/hbnlib/com/adventnet/nms/eventdb directory.
Alert.hbm.xml file will be available under <Web NMS HOME>/classes/hbnlib/com/adventnet/nms/alertdb directory.

A sample map tag in ManagedObject.hbm.xml file which needs to be un-commented is as below.
 

<map name="mappedProperties" table="TOPOUSERPROPS">
    <key column="MOID"/>
    <map-key column="PROPNAME" type="string"/>
    <element column="PROPVAL" type="string"/>
</map>

 

  1. In the DatabaseSchema.conf file, search for the alter queries of the table say TOPOUSERPROPS, EVENTUSERPROPS or ALERTUSERPROPS and un-comment the 2 alter queries available for that table.

  2. In the NmsProcessFE.conf file available under <Web NMS HOME>/conf directory, search for IGNORE_ALERTUSERPROPS and IGNORE_EVENTUSERPROPS and set them to false. Note that this need not be done for topology module.

 

When to choose this option

 

Choose this option to add your own properties when

Procedure

 

Additional properties can be added to the object using the setUserProperty() method, for example, setUserProperty of alert object. The property name and value has to be provided as arguments. Additional properties added using this method are stored in the associated predefined table.

 

Impact

 

To add/modify/delete/retrieve an object's details, n + 1 data manipulation commands will be required. One for the base table and n for the User properties table depending on the number of user properties (i.e., n).

 

See Also



 

 


Copyright © 2013, ZOHO Corp. All Rights Reserved.