Realization of Inventory Databases and Object-Relational Mapping ...
Transcript of Realization of Inventory Databases and Object-Relational Mapping ...
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Realization of Inventory Databases andObject-Relational Mapping for the Common
Information Model
Øystein S. Haaland
Department of Physics and Technology, University of Bergen.
November 8, 2011
Systems and Virtualization Management: Standards and the Cloud
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Outline1 Introduction
BackgroundHigh Level Trigger
2 CIM+ORM and inventory gatheringApplications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
3 Conclusion and outlook
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlookBackgroundHigh Level Trigger
Introduction
Øystein S. Haaland CIM, ORM and Inventory databases.
ALICE detector system
Figure: Illustration of the ALICE detector system from the ALICE webpages.
LHC/CERN
Figure: Illustration of LHC from CERN document server.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlookBackgroundHigh Level Trigger
High Level Trigger
What is triggering?Tell data acquisition systems when something interestinghappens so that it can be read-out.Done in several levels: lower levels in front-end electronics,while high level or event filtering typically is done in softwareon high-performance compute clusters.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlookBackgroundHigh Level Trigger
Motivation
ALICE can produce as much as ~25 GB/s, but bandwidth tostorage is limited to ~1.25 GB/s.Much of the data is not new physics and it can therefore bediscarded.
How is it done?Selection of interesting events: Event filtering or triggering.Selection of interesting parts of events: Region of Interest.Compression of events: Reconstruction and losslesscompression.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlookBackgroundHigh Level Trigger
ALICE HLT cluster
Online systemOnline system, not a batch farm. Cannot rerun whensomething goes wrong.Any faults have direct impact on the physics results.
Process placementHierarchical and distributed processing.Process placement important aspect.
ChallengeMust have reliable and stable operation.But using commodity hardware + complex softwareconfiguration => have to build in resilience for failure.
Øystein S. Haaland CIM, ORM and Inventory databases.
Cluster
Figure: Picture of cluster.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Usefulness of Inventory Databases
Inventory databaseTo know which part to order when something breaks.To keep track of systems when reorganizing.To have relevant and up to date information available whendebugging.
Former solutionTypical LAMP stack with a manually maintained database.Too much work to keep information up-to-date with theavailable man-power.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Advantages of automatic updating
Automatic process placement of the distributed physicsapplication.
Implementing fault-tolerance with fail-over procedures.
Increased consistency in inventory data. No room for humanmistakes.Reduced cost as the cluster administrator is relieved from atedious and laborious task.System management and monitoring.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Requirements
FunctionalProvide up to date information about the state of the clusterfor the physics applicaton.System management and monitoring applications needinventory information.
Non-functionalSupport the programming languages that are in use in HLT:Python, Java, C++.Scalability. HLT was designed for a maximum of around 1000nodes. Currently around 200.Reliability. Need to ensure availablility of inventory informationthrough use of redundancy or clustering.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Choosing an approach
OptionsUse existing CIM implementations (sblim, openpegasus,OpenWBEM).Use own model with ORM.Use CIM model with own implementatino in ORM.
Needed support for multiple programming languages.
Wanted tight integration with existing software.
Needed only information gathering, not completeinstrumentation.RDBS in the back-end would make it easier to implementhigh-availability and scalability.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Object-relational mapping
Object-relational mapping is a programming technique forpersisting data from object-oriented programming languages torelational databases.Software packages that implements this conversion in a genericway, so that it can be used for any object hierarchy, are calledobject relational mappers.
ExamplesHibernate for Java was one of the first of such mappers and ismaybe also the most well-known.Sqlalchemy for python is an ORM, that includes a declarativeway of defining objects, further simplifying the process ofmapping objects to databases.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Advantages of ORM
Relational Database Systems: transactionality and enhanceddata integrity.Object-Oriented programming: Reuse and Modularity.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Model hierarchies and level of mapping
Two options:Mapping at the level of CIM meta schema: flexible, but nointuitive mapping between CIM classes and programminglanguage classes. Lack of constraints.
Mapping at the level of CIM schema: less flexible, but morenatural mapping between CIM classes and OOP classes.
Decision: map at level of CIM schema, counter less flexibility byautomatic generation. Makes it as flexible as mapping at meta level.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Applying ORM to an existing model
The typical mappings one have to consider when applying an ORMto a model, are:
Model to relational database schema.
Model to class definitions in target programming language.
The actual ORM mapping between the relational databaseschema and the class definitions in the programming language.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Mapping details
Tree aspects to consider for ORM:Mapping of structure.
Classes and properties: Normally a straight-forward mappingfrom CIM model.
Datatypes: relatively easy to find corresponding data types inboth programming languages and relational databases.
Inheritance: This is where it gets harder. Has to decide forcommon type of mapping.
Mapping of constraints.Qualifiers: for instance maximum values for integers or lenghtof strings.
Mapping of behavior.Methods: This we do not consider as it is not needed in ourenvironment.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Major tasks
The effort of designing the inventory solution can be divided in twomajor tasks:
1 Creating a programming language representation of a CIMmodel instance as well as the corresponding object-relationalmapping.
2 Automatically keeping the data in the CIM model instance upto date.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Two implementations
Two implementations have been developed:For supporting more than one programming language: pythonand java.To be able in the future to test interoperability betweensolutions.
Øystein S. Haaland CIM, ORM and Inventory databases.
Mapper generation tools 1/2
!"#$%&'($#)$%$*$+",-+%".
,/0".$12$($3"."(%4''#
3"("5$%"
6$7$899#&/$%&'(
:(+%$(/"+1;6$7$1<*="/%+>
,?@
A&*"5($%" ,B#$#/0".-
C&.9-;D-%0'(18D:>
:(+%$(/"12$($3"5;6$7$18D:>
D-%0'(899#&/$%&'(
2<E1C'.9&#"5
,?@
3"("5$%"
:(+%$(/"+1;D-%0'(1<*="/%+>
C:21,/0".$
2<E
Figure: Overview of the tools developed.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Mapper generation tools 2/2
Mapper generation toolsFor Python, the mapper generation tool is implemented as asimple back-end to the SBLIM MOF compiler that outputsORM-enabled python code.
For Java this is a flexible framework with a lot of functionality(Chainreaction). For more information, see the references ofthe paper.
Inventory gathering systemsThe python inventory solution is a stand-alone inventorygathering system for compute clusters.The Java solution is a module that is integrated in SysMES,where the framework takes care of the client/servercommunication.Øystein S. Haaland CIM, ORM and Inventory databases.
Inventory gathering system
!"#$%&
'()$"*+%,&-%.$,-%)*/-&-
!"#$%&'()$"*+%,&-%.$,
-%)*/-&-
+%0$%&(12*3$10$1
'()$"*/4
,&(1$*5*67)-&$
,&(1$*5*67)-&$
'()$"
Figure: The two inventory gathering systems.
Data access 1/2
Figure: Four ways to use the CIM. Figure taken from “CommonInformation Model (CIM) Infrastructure” - DSP0004.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Data access 2/2
Exchange of inventory information at both SQL- andORM-level.
Provide XML-RPC (or similar) bindings created byintrospection of the generated CIM instance to extendcompatibility to languages without ORM.
The client/server transport of the inventory gathering solutionis a forth option for data access. The ways of access inventoryinformation is summarized in the table in the next slide:
Øystein S. Haaland CIM, ORM and Inventory databases.
Summary of access methods
Table: Comparison of the different access methods to the inventory data.
Accessmethod
Dataoperations
Interoperability OO-likeclient side
ORM CRUD andcomplexqueries
Limited tolanguageswith ORMsolutions
Yes
InventoryGatheringSystem
CRUD Depends onimplementa-tion
hwdiscover:YesSySMES: No
XML-RPC CRUD All commonlanguages
No
SQL CRUD andcomplexqueries
All commonlanguages
No
Web service CRUD All commonlanguages
No
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Scalability and reliability
Typically with ORMs, one can choose which RDBS should beused for persisting objects.This means that high-availability and scalability can beachieved by careful selection and configuration of databasesolution, mostly independently of the rest of the system.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Applications of Inventory databasesObject-relational mapping of the CIMThe CIM to ORM mappingDesign and solutionImplementation
Python implementation
Two differencesUsed together with the PerspectiveBroker of the twistedframework, to implement a “Remote Persistent Object”.Uses declarative module of sqlalchemy -> only needs toprovide the class definitions and the declarative mapper doesthe rest.
FutureMake use of inotify for updating information.Extend the inventory gathering system with resourcemanagement capabilities.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Conclusion
Normal relational databases can be used for storing aninstance of the CIM model.
Transactionality is handled by the database/ORM layer, don’tneed to think about this in code.
Makes it easier to code concurrent, distributed applications(with a central data storage).
Can use features already present in relational databaseproducts. Most important for us:
High-reliability: i.e. can choose database with clusteringsupportScalability: can go from convenient unittesting in sqlite tomysq/postgresql/oracle for deployment.
Native and intuitive language bindings due to automaticcreation of ORM-enabled code.
Also introduced “Remote persistent objects”.The concept successfully tested in two similar applications(inventory databases), using different languages.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Results
Only the functionality of the python implementation has beentested on the production cluster.
Works as expected. Information is gathered and the databasseis filled.No performance or interoperability tests have been done so faron the production cluster.
Limited performance testing has been done on smaller setups.sqlite in memory is twice as fast as on disk.
The java implementation has been tested in a test cluster inHeidelberg.
Øystein S. Haaland CIM, ORM and Inventory databases.
IntroductionCIM+ORM and inventory gathering
Conclusion and outlook
Outlook
The tasks for the near future will be extend the infrastructure thatcan be used to collaboratively work on increasing theinteroperability of the CIM+ORM frameworks through unificationof the mapping and its configuration.
Facilities that can be used to automate conformance testing,interoperability testing, unisttesting, package building andmore.If the goal of supporting many programming languagesworking on the same database at the same time (givengenerators are provided) is reached, it will dramaticallyimprove the interoperability on the data persistence layer.
Øystein S. Haaland CIM, ORM and Inventory databases.