ROOT Data bases access1 ROOT Data Bases access LCG Data Bases deployment workshop 19 October Ren é Brun CERN.

Slides:



Advertisements
Similar presentations
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Advertisements

Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Status GridKa & ALICE T2 in Germany Kilian Schwarz GSI Darmstadt.
© Copyright 2012 STI INNSBRUCK Apache Lucene Ioan Toma based on slides from Aaron Bannert
1 Databases in ALICE L.Betev LCG Database Deployment and Persistency Workshop Geneva, October 17, 2005.
1 PROOF & GRID Update Fons Rademakers. 2 Parallel ROOT Facility The PROOF system allows: parallel execution of scripts parallel analysis of trees in a.
Objectivity Data Migration Marcin Nowak, CERN Database Group, CHEP 2003 March , La Jolla, California.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
© 2009 IBM Corporation Statements of IBM future plans and directions are provided for information purposes only. Plans and direction are subject to change.
Searching Technology For a Large Number Of Objects Kurt Stockinger and John Wu Lawrence Berkeley National Laboratory.
6/1/2001 Supplementing Aleph Reports Using The Crystal Reports Web Component Server Presented by Bob Gerrity Head.
PROOF: the Parallel ROOT Facility Scheduling and Load-balancing ACAT 2007 Jan Iwaszkiewicz ¹ ² Gerardo Ganis ¹ Fons Rademakers ¹ ¹ CERN PH/SFT ² University.
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
Status of SQL and XML I/O Sergey Linev, GSI, Darmstadt, Germany.
10/28/2005Distributed Databases in HENPC Group Meeting (LBNL)1 Distributed Databases in HEP Igor A. Gaponenko (LBNL/NERSC)
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
July, 2001 High-dimensional indexing techniques Kesheng John Wu Ekow Otoo Arie Shoshani.
STEALTH Content Store for SharePoint using Caringo CAStor  Boosting your SharePoint to the MAX! "Optimizing your Business behind the scenes"
Alice off-line meeting Alberto Colla Cern, October 3, 2005 AliEn How-To Alice off-line meeting Cern, October 3, 2005 Alberto Colla (Alice off-line Calibration.
Master Thesis Defense Jan Fiedler 04/17/98
Int. Workshop on Advanced Computing and Analysis Techniques in Physics Research (ACAT2005), Zeuthen, Germany, May 2005 Bitmap Indices for Fast End-User.
Java Root IO Part of the FreeHEP Java Library Tony Johnson Mark Dönszelmann
Academic Year 2014 Spring. MODULE CC3005NI: Advanced Database Systems “QUERY OPTIMIZATION” Academic Year 2014 Spring.
David N. Brown Lawrence Berkeley National Lab Representing the BaBar Collaboration The BaBar Mini  BaBar  BaBar’s Data Formats  Design of the Mini 
The STAR Grid Collector and TBitmapIndex John Wu Kurt Stockinger, Rene Brun, Philippe Canal – TBitmapIndex Junmin Gu, Jerome Lauret, Arthur M. Poskanzer,
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
D C a c h e Michael Ernst Patrick Fuhrmann Tigran Mkrtchyan d C a c h e M. Ernst, P. Fuhrmann, T. Mkrtchyan Chep 2003 Chep2003 UCSD, California.
Introduction to dCache Zhenping (Jane) Liu ATLAS Computing Facility, Physics Department Brookhaven National Lab 09/12 – 09/13, 2005 USATLAS Tier-1 & Tier-2.
1 Marek BiskupACAT2005PROO F Parallel Interactive and Batch HEP-Data Analysis with PROOF Maarten Ballintijn*, Marek Biskup**, Rene Brun**, Philippe Canal***,
MAGDA Roger Jones UCL 16 th December RWL Jones, Lancaster University MAGDA  Main authors: Wensheng Deng, Torre Wenaus Wensheng DengTorre WenausWensheng.
ALICE, ATLAS, CMS & LHCb joint workshop on
ATLAS Detector Description Database Vakho Tsulaia University of Pittsburgh 3D workshop, CERN 14-Dec-2004.
Using Bitmap Index to Speed up Analyses of High-Energy Physics Data John Wu, Arie Shoshani, Alex Sim, Junmin Gu, Art Poskanzer Lawrence Berkeley National.
ROOT for Data Analysis1 Intel discussion meeting CERN 5 Oct 2003 Ren é Brun CERN Distributed Data Analysis.
September, 2002 Efficient Bitmap Indexes for Very Large Datasets John Wu Ekow Otoo Arie Shoshani Lawrence Berkeley National Laboratory.
ROOT I/O for SQL databases Sergey Linev, GSI, Germany.
The Replica Location Service The Globus Project™ And The DataGrid Project Copyright (c) 2002 University of Chicago and The University of Southern California.
ROOT and Federated Data Stores What Features We Would Like Fons Rademakers CERN CC-IN2P3, Nov, 2011, Lyon, France.
ROOT-CORE Team 1 PROOF xrootd Fons Rademakers Maarten Ballantjin Marek Biskup Derek Feichtinger (ARDA) Gerri Ganis Guenter Kickinger Andreas Peters (ARDA)
CASTOR evolution Presentation to HEPiX 2003, Vancouver 20/10/2003 Jean-Damien Durand, CERN-IT.
PROOF and ALICE Analysis Facilities Arsen Hayrapetyan Yerevan Physics Institute, CERN.
ROOT Data bases access1 LCG Data base deployment workshop 11 October Ren é Brun CERN.
David Adams ATLAS ATLAS distributed data management David Adams BNL February 22, 2005 Database working group ATLAS software workshop.
ESG-CET Meeting, Boulder, CO, April 2008 Gateway Implementation 4/30/2008.
9/28/2005Philippe Canal, ROOT Workshop TTree / SQL Philippe Canal (FNAL) 2005 Root Workshop.
March, PROOF - Parallel ROOT Facility Maarten Ballintijn Bring the KB to the PB not the PB to the KB.
1 Status of PROOF G. Ganis / CERN Application Area meeting, 24 May 2006.
Andrea Valassi (CERN IT-DB)CHEP 2004 Poster Session (Thursday, 30 September 2004) 1 HARP DATA AND SOFTWARE MIGRATION FROM TO ORACLE Authors: A.Valassi,
M. Oldenburg GridPP Metadata Workshop — July 4–7 2006, Oxford University 1 Markus Oldenburg GridPP Metadata Workshop July 4–7 2006, Oxford University ALICE.
CORAL CORAL a software system for vendor-neutral access to relational databases Ioannis Papadopoulos, Radoval Chytracek, Dirk Düllmann, Giacomo Govi, Yulia.
1 A Scalable Distributed Data Management System for ATLAS David Cameron CERN CHEP 2006 Mumbai, India.
ROOT-CORE Team 1 Philippe Canal Markus Frank I/O Basic I/O, RDBMS interfaces, Trees.
Latest Improvements in the PROOF system Bleeding Edge Physics with Bleeding Edge Computing Fons Rademakers, Gerri Ganis, Jan Iwaszkiewicz CERN.
PROOF on multi-core machines G. GANIS CERN / PH-SFT for the ROOT team Workshop on Parallelization and MultiCore technologies for LHC, CERN, April 2008.
ROOT : Outlook and Developments WLCG Jamboree Amsterdam June 2010 René Brun/CERN.
HYDRA Framework. Setup of software environment Setup of software environment Using the documentation Using the documentation How to compile a program.
Database Replication and Monitoring
(on behalf of the POOL team)
Distributed Databases in HEP
PROOF – Parallel ROOT Facility
INFN-GRID Workshop Bari, October, 26, 2004
ALICE Physics Data Challenge 3
Dirk Düllmann CERN Openlab storage workshop 17th March 2003
Conditions Data access using FroNTier Squid cache Server
Software Architecture in Practice
Database Performance Tuning and Query Optimization
Grid Data Integration In the CMS Experiment
Support for ”interactive batch”
PROOF - Parallel ROOT Facility
Chapter 11 Database Performance Tuning and Query Optimization
Presentation transcript:

ROOT Data bases access1 ROOT Data Bases access LCG Data Bases deployment workshop 19 October Ren é Brun CERN

Rene BrunROOT Data bases access2 Plan Connections between ROOT and RDBMs Performance issues Utilities

Rene BrunROOT Data bases access3 ROOT File types & Access (SQL implemented in 1999) Local File X.xml RFIOChirp CastorDcache Local File X.root http rootd/xrootd Oracle SapDb PgSQL MySQL TFile TKey/TTree TStreamerInfo user TSQLServer TSQLRow TSQLResult

Rene BrunROOT Data bases access4 RDBC (from V.Onuchin) (implemented in 2000) The RDBC aims for JDBC 2.0 compliance. It contains the set of classes corresponding to JDBC 2.0 one TSQLDriverManager, TSQLConnection, TSQLStatement, TSQLPreparedStatement, TSQLCallableStatement, TSQLResultSet, TSQLResultSetMetadata, TSQLDatabaseMetadata The RDBC aims for ROOT SQL compliance, e.g. TSQLResult is subclass of TSQLResultSet RDBC implementation is based on libodbc++ library ( developedhttp://orcane.net/freeodbc by Manush Dodunekov Connection string can by either JDBC style i.e. :// [: ][/ ], or ODBC style (as DSN) e.g. "dsn=minos;uid=scott;pwd=tiger" Exceptions handling is implemented via ROOT signal-slot communication mechanism. RDBC has an interface which allows to store ROOT objects in relational database as BLOBs. For example, it is possible to store ROOT histograms, trees as a cells of SQL table. RDBC provides connection pooling, i.e. reusing opened connections during ROOT session. RDBC has an interface which allows to convert TSQLResultSets to ROOT TTrees RDBC with Carrot (ROOT Apache Module) allows to create three-tier architecture. used by Phenix and Minos

Rene BrunROOT Data bases access5 File types & Access in 5.04 Local File X.xml RFIOChirp CastorDcache Local File X.root http rootd/xrootd Oracle SapDb PgSQL MySQL TFile TKey/TTree TStreamerInfo user TSQLServer TSQLRow TSQLResult TTreeSQL

Rene BrunROOT Data bases access6 New RDBMS interface in v5 New class TTreeSQL support the TTree containing branches created using a leaf list (eg. hsimple.C). Access any RDBMS tables from TTree::Draw Create a TTree in split mode  creating a RDBMS table and filling it. The table can be processed by SQL directly. The interface uses the normal I/O engine including support for Automatic Schema Evolution.

Rene BrunROOT Data bases access7 TTreeSQL Syntax Currently: ROOT: MySQL: Coming: TFile *file = new TFile("simple.root","RECREATE"); TTree *tree; file->GetObject(“ntuple”,tree); TSQLServer*dbserver = TSQLServer::Connect("mysql://…”,db,user,passwd); TTree *tree = new TTreeSQL(dbserver,"rootDev","ntuple"); TTree *tree = TTree::Open(“root:/simple.root/ntuple”); TTree *tree = TTree::Open(“mysql://host../rootDev/ntuple”);

Rene BrunROOT Data bases access8 TTreeSQL Optimization On a simple test with a local MySQL database: Reading is 5x slower than with ROOT I/O Writing is functional but requires significant optimization of the code. Current implementation of the SQL communication (text oriented) could be greatly improved. Could use some expertise in MySQL and odbc (to reinvigorate RDBC) Following discussions at the ROOT workshop, this will become low priority.

Rene BrunROOT Data bases access9 ROOT Run Manager Virtual MC EVGEN Primary Generator Magnetic Field Module Detector Geometry Manager IO Manager Tasks DeltaTracking CBM Analysis at GSI digitizers GeoInterface RunTime DataBase Root files Configuration, Parameters, Geometry Oracle Configuration, Parameters, Geometry Root files MCPoints, Hits, Digits, Tracks

Rene BrunROOT Data bases access10 Reading Parameters: Oracle gSystem->Load ( "libOra" ); CbmRunAna * fRun = new CbmRunAna(); CbmRuntimeDb* rtdb=fRun->GetRuntimeDb(); CbmParOraIo* ora=new CbmParOraIo(); ora->open(); rtdb->setFirstInput(ora); CbmGenericParOraIo* genio= (CbmGenericParOraIo*)(ora- >getDetParIo("CbmGenericParIo")); CbmParTest* par=(CbmParTest*)(rtdb->getContainer("CbmParTest")); genio->readFromLoadingTable(par,RunId); par->print(); par->printParams();

Rene BrunROOT Data bases access11 ROOT & RDBMS go & nogo ROOT interface with RDBMS is minimal Because there are many different use cases, we see many users with their own interface that seems appropriate in most cases. Because of scalability issues, the move to read-only files in a distributed environment is becoming obvious. We prefer to invest in a direction that we believe is very important for data analysis: Optimize the use of read-only files in a distributed environment: size, read speed, read ahead & cache, selective reads (rows &columns) with Trees. Optimize the performance: xrootd, load balancing, authentication with caching for interaction, robustness.

Rene BrunROOT Data bases access12 Scalability issues It is not the same problem any more if the CONDB is 10 Terabytes instead of 10 Gigabytes. CDF(300 Gb), Compass (1Tb), Alice (nTb) 1000 jobs accessing simultaneously a central DB looks crazy. This does not fit well with distributed computing. Independent read only files with load balanced servers (a la xrootd) seems the way to go. Keep the info in larger and structured objects, eg a RUN data structure instead of an access per event. Keep the RDBMS for what they are good at.

ROOT Data bases access13 Performance Issues ROOT compared to RDBMs Making ROOT access faster

Rene BrunROOT Data bases access14 ROOT compared to RDBMs Several comparisons between ROOT and SQL Size Typically 3 to 10 times smaller Selectivity in rows or/and columns 2 to 30 times faster on local file Same speed as MySQL on remote file with no cache 10 times faster than mySQL when UseCache Next two examples are from Atlas

Rene BrunROOT Data bases access15 ROOT Collections: Query Time Vs. Acceptance Fraction Query time measured as a function of acceptance fraction. ROOT and Oracle query times still comparable at 75% but ROOT decreases linearly at faster rate. Oracle and MySQL reach minimum values ~27 sec. and ~34 sec. respectively at about 1% but ROOT continues to decrease linearly. Minimum values again refer to minimum amount of time needed for relational databases to scan the event sample.

Rene BrunROOT Data bases access16 ROOT Collections: Query Time Vs. Column Selection Query time measured as function of number of columns selected. ROOT and Oracle query times equivalent when all 335 columns selected but ROOT query time decreases more rapidly with decreasing column selection. Oracle and MySQL query times reach minimum values of ~ 15 sec. and ~ 30 sec., respectively near a selection of 10 columns. ROOT query times continue to decrease linearly with decreasing number of columns. For a selection of only one column ROOT is 7 times faster than Oracle and 15 times faster than MySQL.

ROOT Data bases access17 TBitmapIndex: An attempt to introduce FastBit to ROOT Kurt Stockinger 1, Kesheng Wu 1, Rene Brun 2, Philippe Canal 3 (1) Berkeley Lab, Berkeley, USA (2) CERN, Geneva, Switzerland (3) Fermi Lab, Batavia, USA See J.Wu talk at ROOT workshop

Rene BrunROOT Data bases access18 Bitmap Indices Bitmap indices are efficient data structures for accelerating multi-dimensional queries: E.g. pT > 195 AND nTracks 12.4 Supported by most commercial database management systems and data warehouses Optimized for read-only data However, because an efficient index may be a substantial fraction of the data, we think that it is only appropriate for things like event meta data catalogues However, because an efficient index may be a substantial fraction of the data, we think that it is only appropriate for things like event meta data catalogues

ROOT Data bases access19 FastBit: A compressed bitmap indexing technology for efficient searching of read-only data LBNL holds the copyright of the FastBit software and a US patent on the core compression technique used in FastBit. LBNL intends to seek opportunities to commercialize the searching technology and the compression technique. However, since the ROOT framework is essential to high-energy physics experiments funded by US Department of Energy, which also funded the development of FastBit and the related compression technique, LBNL has agreed to develop a license to grant ROOT users free use of the FastBit searching technology as long as FastBit is only accessed through ROOT framework. FastBit source code may also be distributed with ROOT so long as it is only used through ROOT.

Rene BrunROOT Data bases access20 Example - Build Index // open ROOT-file TFile f("data/root/data.root"); TTree *tree = (TTree*) f.Get("tree"); TBitmapIndex bitmapIndex; char indexLocation[1024] = “/data/index/"; // build indices for all leaves of a tree bitmapIndex.BuildIndex (tree, indexLocation); // build index for two attributes “a1”, “a2” of a tree bitmapIndex.BuildIndex(tree, "a1", indexLocation); bitmapIndex.BuildIndex(tree, "a2", indexLocation);

Rene BrunROOT Data bases access21 Example - Tree::Draw with Index // open ROOT-file TFile f("data/root/data.root"); TTree *tree = (TTree*) f.Get("tree"); TBitmapIndex bitmapIndex; bitmapIndex.Draw(tree, "a1:a2", "a1 700");

Rene BrunROOT Data bases access22 Experiments With BaBar Data Software/Hardware: Bitmap Index Software is implemented in C++ Tests carried out on: Linux CentOS 2.8 GHz Intel Pentium 4 with 1 GB RAM Hardware RAID with SCSI disk Data: 7.6 million records with ~100 attributes each Babar data set: Bitmap Indices (FastBit): 10 out of ~100 attributes 1000 equality-encoded bins 100 range-encoded bins

Rene BrunROOT Data bases access23 Query Performance - TTreeFormula vs. Bitmap Indices Bitmap indices 10X faster than TTreeFormula

Rene BrunROOT Data bases access24 Grid Collector Speeds up Analyses Legend Selectivity: fraction of events selected for an analysis Speedup = ratio of time to read events without GC and with GC Speedup = 1: speed of the existing system (without GC) Results When searching for rare events, say, selecting one event out of 1000 (selectivity = 0.001), using GC is 20 to 50 times faster Even using GC to read 1/2 of events, speedup > 1.5 less selective  more selective Used in STAR Grid Collector

Rene BrunROOT Data bases access25 Data analysis with bitmap indices Event catalogue Bitmap index query Event list Direct use by PROOF slaves to select events

ROOT Data bases access26 Some Utilities Interface with GRID stuff (eg FC) Grouping many small files

Rene BrunROOT Data bases access27 Class TGrid (abstract interface) //--- General GRID const char *GridUrl() const const char *GetGrid() const const char *GetHost() const const char *GetUser() const const char *GetPw() const const char *GetOptions() const Int_t GetPort() const //--- Catalogue Interface virtual TGridResult *Command(const char *command, Bool_t interactive = kFALSE, UInt_t stream = kFALSE) virtual TGridResult *Query(const char *path, const char *pattern, const char *conditions, const char *options) virtual TGridResult *LocateSites() virtual TGridResult *ls(const char*ldn ="", Option_t*options ="") virtual Bool_t cd(const char*ldn ="",Bool_t verbose =kFALSE) virtual Bool_t mkdir(const char*ldn ="", Option_t*options ="") virtual Bool_t rmdir(const char*ldn ="", Option_t*options ="") virtual Bool_t register(const char *lfn, const char *turl, Long_t size, const char *se, const char *guid) virtual Bool_t rm(const char*lfn, Option_t*option ="") //--- Job Submission Interface virtual TGridJob *Submit(const char *jdl) virtual TGridJDL *GetJDLGenerator() //--- Load desired plugin and setup conection to GRID static TGrid *Connect(const char *grid, const char *uid, const char *pw, const char *options)

Rene BrunROOT Data bases access28 Access to File Catalogues eg Alien FC Same style interface could be implemented for Other GRID File Catalogues

Rene BrunROOT Data bases access29 // Connect TGrid alien = TGrid::Connect(“alien://”); // Query TGridResult *res =alien.Query (“/alice/cern.ch/user/p/peters/analysis/miniesd/”, ”*.root“); // List of files TList *listf = res->GetFileInfoList(); // Create chain TChain chain(“Events", “session"); Chain.AddFileInfoList(listf); // Start PROOF TProof proof(“remote”); // Process your query Chain.Process(“selector.C”); TGrid example with Alien

Rene BrunROOT Data bases access30 Replica of a DB subset local TZipFile remote TZipFile T0 T1 http, xrootd, castor, dcache..

Rene BrunROOT Data bases access31 TArchiveFile and TZIPFile TArchiveFile is an abstract class that describes an archive file containing multiple sub-files, like a ZIP or TAR archive. The TZIPFile class describes a ZIP archive file containing multiple ROOT sub-files. Notice that the ROOT files should not be compressed when being added to the ZIP file, since ROOT files are normally already compressed. To create the file multi.zip do: The ROOT files in an archive can be simply accessed like this: A TBrowser and TChain interface will follow shortly. zip –n root multi file1.root file2.root TFile *f = TFile::Open("multi.zip#file2.root") or TFile *f = TFile::Open("root://mymachine/multi.zip#2")

Rene BrunROOT Data bases access32 TFileMerger This new class allows for easy copying of two or more files using the many TFile plugins (i.e. it can copy from Castor to dCache, or from xrootd to Chirp, etc.). The AddFile() and Merge() use the Cp() to copy the file locally before making the merge, and if the output file is remote the merged file will be copied back to the remote destination. TFileMerger m; m->Cp("srcUrl", "destUrl"); or m->AddFile("url1"); m->AddFile("url2"); m->Merge();

Rene BrunROOT Data bases access33 New TFile Feature Support for opening files in raw mode when the file url contains the option string "filetype=raw", like "anyfile.tgz?filetype=raw". This allows TFile and its many remote access plugins to be used to open and read any file. This is used by the TFileMerger::Cp() method to copy any file from and to Grid storage elements (e.g. from Castor to dCache, from xrootd to a local file, and all possible permutations).