ROOT Tutorials - Session 41 ROOT Tutorials – Session 4 Remote File Access, Networking SQL & Threads Fons Rademakers.

Slides:



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

MPI Message Passing Interface
June, 20013rd ROOT Workshop1 PROOF and ROOT Grid Features Fons Rademakers.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
1 PROOF & GRID Update Fons Rademakers. 2 Parallel ROOT Facility The PROOF system allows: parallel execution of scripts parallel analysis of trees in a.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
DT228/3 Web Development Databases. Database Almost all web application on the net access a database e.g. shopping sites, message boards, search engines.
70-270, MCSE/MCSA Guide to Installing and Managing Microsoft Windows XP Professional and Windows Server 2003 Chapter Nine Managing File System Access.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
AGENDA Tools used in SQL Server 2000 Graphical BOL Enterprise Manager Service Manager CLI Query Analyzer OSQL BCP.
10 Oct. 2001CMS/ROOT Workshop1 Networking, Remote Access, SQL, PROOF and GRID Fons Rademakers René Brun.
Chapter 31 File Transfer & Remote File Access (NFS)
Server Design Discuss Design issues for Servers Review Server Creation in Linux.
CS252: Systems Programming Ninghui Li Final Exam Review.
Status of SQL and XML I/O Sergey Linev, GSI, Darmstadt, Germany.
June 2001ROOT 2001 FNAL1 What Else is New Since ROOT 2000? Fons Rademakers.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Copyright ®xSpring Pte Ltd, All rights reserved Versions DateVersionDescriptionAuthor May First version. Modified from Enterprise edition.NBL.
Data Management Kelly Clynes Caitlin Minteer. Agenda Globus Toolkit Basic Data Management Systems Overview of Data Management Data Movement Grid FTP Reliable.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
June 6 th – 8 th 2005 Deployment Tool Set Synergy 2005.
MySQL. Dept. of Computing Science, University of Aberdeen2 In this lecture you will learn The main subsystems in MySQL architecture The different storage.
Java Root IO Part of the FreeHEP Java Library Tony Johnson Mark Dönszelmann
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Oracle 10g Database Administrator: Implementation and Administration Chapter 2 Tools and Architecture.
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***,
4/5/2007Data handling and transfer in the LHCb experiment1 Data handling and transfer in the LHCb experiment RT NPSS Real Time 2007 FNAL - 4 th May 2007.
Java Database Connectivity (JDBC). Topics 1. The Vendor Variation Problem 2. SQL and Versions of JDBC 3. Creating an ODBC Data Source 4. Simple Database.
Oracle's Distributed Database Bora Yasa. Definition A Distributed Database is a set of databases stored on multiple computers at different locations and.
ROOT I/O for SQL databases Sergey Linev, GSI, Germany.
ROOT and Federated Data Stores What Features We Would Like Fons Rademakers CERN CC-IN2P3, Nov, 2011, Lyon, France.
1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file.
CE Operating Systems Lecture 13 Linux/Unix interprocess communication.
The Problems HTTP is disconnected So many database vendors Create a simple consistent versatile interface on the data Look at ADO.NET classes OleDb SQL.
FTP File Transfer Protocol Graeme Strachan. Agenda  An Overview  A Demonstration  An Activity.
13 June 2001M.Al-Turany/Root20011 Mohammad Al-Turany Go4 GSI Darmstadt 13 June 2001.
16 October 2002ROOT 2002, CERN1 Progress with Carrot Valeriy Onuchin.
ROOT Data bases access1 LCG Data base deployment workshop 11 October Ren é Brun CERN.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Slide 1/29 Informed Prefetching in ROOT Leandro Franco 23 June 2006 ROOT Team Meeting CERN.
9/28/2005Philippe Canal, ROOT Workshop TTree / SQL Philippe Canal (FNAL) 2005 Root Workshop.
Linux Operations and Administration
Data Transfer Service Challenge Infrastructure Ian Bird GDB 12 th January 2005.
Databases Kevin Wright Ben Bruckner Group 40. Outline Background Vulnerabilities Log File Cleaning This Lab.
Oct 20024th Intl. ROOT Workshop1 New Infrastructure Features Since ROOT 2001 Fons Rademakers.
S.Linev: Go4 - J.Adamczewski, H.G.Essel, S.Linev ROOT 2005 New development in Go4.
Multimedia Retrieval Architecture Electrical Communication Engineering, Indian Institute of Science, Bangalore – , India Multimedia Retrieval Architecture.
Sept. 2000CERN School of Computing1 PROOF and ROOT Grid Features Fons Rademakers.
Go4 Workshop J.Adamczewski-Musch, S.Linev Go4 advanced features.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
1 Copyright © 2008, Oracle. All rights reserved. Repository Basics.
ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: Week 8 – Review Reference:
3 A Guide to MySQL.
Current Generation Hypervisor Type 1 Type 2.
Chapter 3: Process Concept
Distributed object monitoring for ROOT analyses with Go4 v.3
PHP / MySQL Introduction
File Transfer and access
Go4 CHEP 2001 Multithreaded Inter-Task Communication with ROOT -
CGS 3763 Operating Systems Concepts Spring 2013
Support for ”interactive batch”
Fundamentals of Databases
Chapter 6 – Distributed Processing and File Systems
Presentation transcript:

ROOT Tutorials - Session 41 ROOT Tutorials – Session 4 Remote File Access, Networking SQL & Threads Fons Rademakers

ROOT Tutorials - Session 42 Introduction The following items will be covered: Remote ROOT file access Networking SQL interface Threads

ROOT Tutorials - Session 43 Remote File Access

ROOT Tutorials - Session 44 Remote Access Several classes deriving from TFile providing remote file access: TNetFile performs remote access via the special rootd daemon TWebFile performs remote read-only access via an Apache httpd daemon TRFIOFile performs remote access via the rfiod daemon (RFIO is part of the CERN SHIFT software). RFIO has an interface to the Castor mass storage system

ROOT Tutorials - Session 45 Remote Access (cont.) TDCacheFile performs remote access via the dcached daemon which provides access to the dCache mass storage system developed by DESY and Fermilab TChirpFile performs remote access via a Chirp server which is used in the Condor/VDT Grid software

ROOT Tutorials - Session 46 Access Transparency TFile *f1 = TFile::Open(“local.root”) TFile *f2 = TFile::Open(“root://cdfsga.fnal.gov/bigfile.root”) TFile *f3 = TFile::Open(“rfio:/castor.cern.ch/alice/aap.root”) TFile *f4 = TFile::Open(“dcache://main.desy.de/h1/run2001.root”) TFile *f5 = TFile::Open(“chirp://hep.wisc.edu/data1.root”) TFile *f5 = TFile::Open(“

ROOT Tutorials - Session 47 The rootd Daemon Daemon optimized for ROOT file access Performance typically better than NFS and AFS Easy to setup without superuser permissions: rootd –p 5151 Can also be started via (x)inetd By default listens on port 1094 (assigned by IANA) Supports anonymous mode Supports several authentication methods: Clear text passwd AFS SRP Kerberos Globus

ROOT Tutorials - Session 48 Networking

ROOT Tutorials - Session 49 Networking Classes Provide a simple but complete set of networking classes TSocket, TServerSocket, TMonitor, TInetAddress, TMessage Operating system independent Thanks to TSystem

ROOT Tutorials - Session 410 Setting Up a Connection // Open server socket waiting for connections on specified port TServerSocket *ss = new TServerSocket(9090, kTRUE); // Accept a connection and return a full-duplex communication socket TSocket *sock = ss->Accept(); // Close the server socket (unless we will use it later to wait for // another connection). ss->Close(); Server side // Open connection to server TSocket *sock = new TSocket("localhost", 9090); Client side

ROOT Tutorials - Session 411 Sending Objects TH1 *hpx = new TH1F("hpx","This is the px distribution",100,-4,4); TMessage mess(kMESS_OBJECT); mess.WriteObject(hpx); sock->Send(mess); Client Side TMessage *mess; while (sock->Recv(mess)) { if (mess->What() == kMESS_OBJECT) { if (mess->GetClass()->InheritsFrom(“TH1”)) { TH1 *h = (TH1 *)mess->ReadObject();... } } else if (mess->What() == kMESS_STRING)... delete mess; } Server Side

ROOT Tutorials - Session 412 Waiting for Objects To explicitly wait for a socket you can use a TMonitor object: See hclient.C, hserv.C and hserv2.C TMonitor *mon = new TMonitor; mon->Add(socket1); mon->Add(socket2); … while (1) { TMessage *mess; TSocket *s; s = mon->Select(); … }

ROOT Tutorials - Session 413 GRID Networking - Long Fat Pipes Long fat pipes are WAN links with a large bandwidth*delay product For optimal performance keep pipe full By default this is not the case maximum TCP buffer size is 64KB for a pipe with a 192KB bandwidth*delay product the pipe is empty 60% of the time SourceDestination ACK

ROOT Tutorials - Session 414 TCP Window Scaling (RFC 1323) A solution is to use a TCP buffer size equal to the bandwidth*delay product This support for large TCP buffers (window scaling) is described in RFC 1323 Problem: system administrators are needed to change maximum TCP buffer sizes on source and destination machines, e.g. for Linux: echo > /proc/sys/net/core/rmem_max SourceDestination ACK

ROOT Tutorials - Session 415 Parallel Sockets Buffer is striped over multiple sockets in equal parts Ideal number of parallel sockets depends on bandwidth*delay product (assuming default 64KB TCP buffer size). No system manager needed to tune network Same performance as with large buffers SourceDestination ACK

ROOT Tutorials - Session 416 Parallel Sockets in ROOT Parallel socket classes, TPSocket and TPServerSocket, that derive from TSocket and TServerSocket TNetFile and rootd daemon support parallel sockets // Open server socket waiting for connections on specified port TServerSocket *ss = new TPServerSocket(9090, kTRUE); // Accept a connection and return a full-duplex communication socket TSocket *sock = ss->Accept();

ROOT Tutorials - Session 417 Parallel FTP The TFTP class supports parallel sockets and rootd daemon for fast WAN file transfers (same performance as gridftp and bbftp) Supports all standard ftp commands Anonymous ftp Performance, CERN - GSI: wu-ftp: 1.4 MB/s TFTP: 2.8 MB/s

ROOT Tutorials - Session 418 Main Networking Features Objects can be passed by value over a network connection Easy multiplexing on multiple sockets via TMonitor or via the main event loop Support for non-blocking sockets Most important socket options settable via TSocket::SetOption() (buffer sizes, non- blocking, OOB, keep alive, etc.)

ROOT Tutorials - Session 419 SQL Interface

ROOT Tutorials - Session 420 SQL Interface RDBMS access via a set of abstract base classes TSQLServer, TSQLResult and TSQLRow Concrete implementations for MySQL and Oracle exist TMySQLServer, TMySQLResult and TMySQLRow TOracleServer, TOracleResult and TOracleRow

ROOT Tutorials - Session 421 SQL Interface for TTree’s Also TTree's can be queried via this interface TTreeResult and TTreeRow A TTreeResult is returned by the TTree::Query() method Via these classes it is trivial to access an RDBMS via the interpreter and scripts There is also available an ODBC interface (based on Java’s JDBC) to access databases

ROOT Tutorials - Session 422 SQL Interface Usage { TSQLServer *db = TSQLServer::Connect("mysql://localhost/test", "nobody", ""); TSQLResult *res = db->Query("select count(*) from runcatalog " "where tag&(1<<2)"); int nrows = res->GetRowCount(); int nfields = res->GetFieldCount(); for (int i = 0; i < nrows; i++) { TSQLRow *row = res->Next(); for (int j = 0; j < nfields; j++) { printf("%s\n", row->GetField(j)); } delete row; } delete res; delete db; }

ROOT Tutorials - Session 423 Performance Comparison CREATE TABLE runcatalog ( dataset VARCHAR(32) NOT NULL, run INT NOT NULL, firstevent INT, events INT, tag INT, energy FLOAT, runtype ENUM('physics' 'cosmics','test'), target VARCHAR(10), timef TIMESTAMP NOT NULL, timel TIMESTAMP NOT NULL, rawfilepath VARCHAR(128), comments VARCHAR(80) ) class RunCatalog : public TObject { public: enum ERunType { kPhysics, kCosmics, kTest }; char fDataSet[32]; Int_t fRun; Int_t fFirstEvent; Int_t fEvents; Int_t fTag; Float_t fEnergy; ERunType fRunType; char fTarget[10]; UInt_t fTimeFirst; UInt_t fTimeLast; char fRawFilePath[128]; char fComments[80]; }; SQL C++/ROOT

ROOT Tutorials - Session 424 Performance Comparison Filling Entries 177 s real-time 0.3 MB/s 54.6 MB DB file 42 s real-time (43 via rootd) 3.4 MB/s 11.5 MB DB file (compression level 1) All results on PII 366, 256 MB RAM, RH 6.1 MySQLTTree

ROOT Tutorials - Session 425 Performance Comparison Select of 2 Columns 4.5 s real-time 12.1 MB/s 2.8 s real-time (2.9 via rootd) 4.1 MB/s (19.5 MB/s) SELECT dataset,rawfilepath FROM runcatalog WHERE tag&7 AND (run= OR run=300122) MySQLTTree

ROOT Tutorials - Session 426 Performance Comparison ROOT TTree's are in this case a factor 4 smaller Filling time of TTree's is 4.2 times faster Query time of TTree's is 2 times faster However, MySQL and especially Oracle have the typical advantages of: locking, transactions, roll-back, SQL, etc.

ROOT Tutorials - Session 427 More RDBMS Interfaces In addition to original MySQL interface: Oracle by Michael Dahlinger of GSI PostgreSQL by Gian Paolo Ciceri SAPDB by Marc Hemberger RDBC, a version of JDBC on top of ODBC by Valeriy Onuchin

ROOT Tutorials - Session 428 Very Large Databases A VLDB can be made by using a combination of the ROOT object store and an RDBMS The RDBMS is typically used as catalog to keep track of the many ROOT object stores This is exactly what the POOL project tries to achieve

ROOT Tutorials - Session 429 Threads

ROOT Tutorials - Session 430 Threads Threads allow different tasks to run in a single process Threads share the processes address space Threads are much more convenient to program than asynchronous tasks On SMP systems threads can be scheduled to run on different CPU’s However, threads are fairly recent additions to most operating systems Many “legacy” libraries are not thread safe (C-lib, X11, etc.)

ROOT Tutorials - Session 431 Threads in ROOT The following thread classes are supported: TThread, TMutex, TCondition, TSemaphore, TRWLock, TLockGuard and TThreadPool Via a factory pattern most of these classes have a pointer to the actual machine dependent implementation (either for Posix or WinNT): TPosixThread, TPosixMutex, TPosixCondition

ROOT Tutorials - Session 432 Thread Creation Pattern

ROOT Tutorials - Session 433 ROOT and Thread Safety ROOT and CINT are not thread safe: Many globals in CINT Many globals in ROOT (gDirectory, etc) No locking in containers Solution: Put locks around CINT and container access: Central lock before calling into CINT Central lock before calling into X11 And Store special ROOT globals as thread specific data

ROOT Tutorials - Session 434 Thread Safety Implementation Introduction of TVirtualMutex and TLockGuard classes in libCore Introduction of two global mutexes: gCINTMutex and gContainerMutex After loading of libThread they will point to real TMutex objects, 0 otherwise Mutexes placed with TLockGuard via zero- cost macro (when not compiled with thread support)

ROOT Tutorials - Session 435 Thread Example – Go4 GSI object-oriented online-offline system X-Events() Go4 Prototype Mixture of tasks, threads and communications Data Status Logger 1 GUI Event Loop Exec Command Command Analysis task Display task X timer Graphics Objects Transport cancel/restart Draw DAQ Logger 2

ROOT Tutorials - Session 436 Thread and GUI Example – Go4 in Action Go4 Prototype lists with asynchronous information from analysis or daq objects in display task objects in analysis task Click here to start analysis Root prompt Graphics canvas