THttpServer for ROOT Bertrand Bellenot, CERN Sergey Linev, GSI Darmstadt
B.Bellenot, S.Linev, THttpServer for ROOT2 JSRootIO Written on JavaScript, works in all major browsers IE, Firefox, Opera, Safari, Android, … Allows to draw many kinds of ROOT objects TH1, TH2, TH3, TProfile, TGraph, THStack, TCanvas Demonstrator: Interactive graphics directly in the browser: changing of draw style, zooming, bins info update of statistic in stat box different context menu commands Main aim – display objects from ROOT files PRO - no need for special code on the web server CONTRA – not possible to update data dynamically
B.Bellenot, S.Linev, THttpServer for ROOT3 JSRootIO for online? JSRootIO is file-based difficult to use for online tasks not really scales for big systems Much more benefits if will run online one would see live results from running experiment from any place of the world One need special web application, which can provide online data to JSRootIO
Web server for ROOT THttpServer class provides web server for arbitrary ROOT application In any place of ROOT macro: root [0].x $ROOTSYS/tutorials/hsimple.C root [1] new THttpServer(); No any changes in ROOT framework are required No any changes in user code are required B.Bellenot, S.Linev, THttpServer for ROOT4
B.Bellenot, S.Linev, THttpServer for ROOT5 hsimple.C in web browser
Main classes TRootSniffer - `sniffer`for objects hierarchies in TFolder, TFile/TDirectory, TTree, TCollection THttpEngine – abstract class for implementing http protocol TMongoose – embeddable web server, based on TFastCgi – FastCGI protocol implementation supported by all major web servers like Apache, MS IIS, lighttpd,... THttpServer – central class receive http requests from engine(s) http requests processed by sniffer takes care about threads safety B.Bellenot, S.Linev, THttpServer for ROOT6
THttpServer Any object can be registered in TFolder structure: root [5] h1 = new TH1I(“h1”, “title”, 5, 0, 5); root [6] serv->Register(“folder”, h1); Following http requests are processed: xml file with objects hierarchy, used to build tree structures in browser binary zipped data, produced by object streaming binary zipped data of current streamer infos png image, produced from TCanvas returns generic (or user-defined) html page, shown before B.Bellenot, S.Linev, THttpServer for ROOT7
FastCGI support Protocol for interfacing interactive programs with web servers Supported by all major web servers Apache, lighttpd, MS IIS, Cherokee, Hiawatha, LiteSpeed, Kerio, Nginx, Resin, Roxen, Zeus... One benefits from common infrastructure user access, security, encryption, balancing,... Can run in parallel to HTTP server B.Bellenot, S.Linev, THttpServer for ROOT8 ROOT http FastCGI Apache http
Project state Developed since mid 2013 Works with ROOT 5.14 and 6.00 Tested on Linux and Windows No external dependencies mongoose is just two source files mongoose is GPL2, can be replaced by civetweb with MIT license FastCGI is optional, provided by all Linux distributions For the moment available on: B.Bellenot, S.Linev, THttpServer for ROOT9
Current applications Integrated into DABC DABC is DAQ framework, used in different experiments now also provides generic web interface for online software DAQ – DABC, MBS (GSI standard DAQ) slow control – FESA (CERN/GSI accelerator control), EPICS, DIM online analysis – Go4, ROOT Integrated with Go4 Go4 is analysis framework with QtRoot online monitoring interface now also web interface without changing user-code Evaluated by different groups in GSI: HADES, SuperFRS, R3B Could be used in AMORE framework of ALICE B.Bellenot, S.Linev, THttpServer for ROOT10
Possible developments Replace mongoose by ROOT TThread/TSocket classes many parts of original mongoose code can be reused, ~1 month of work Implement caching on the server preventing application from overload, ~1 week of work Implement more http requests convert object into xml with TBufferXML, ~1 hour of work stream object into JSON representation directly no need for ROOT I/O in JavaScript one need TBufferJSON class, ~2 weeks of work access to object members in simple text form mostly implemented, ~3 days of work provide command interface via http protocol any user-defined commands with extra parameters user authentication with standard http methods B.Bellenot, S.Linev, THttpServer for ROOT11
More than web interface One can use http protocol to communicate with any running ROOT application From any script: wget wget For many cases no need for extra sockets and special protocols B.Bellenot, S.Linev, THttpServer for ROOT12
Backup slides B.Bellenot, S.Linev, THttpServer for ROOT13
Use case – HADES B.Bellenot, S.Linev, THttpServer for ROOT14 TRB Event builder hld files hld DABC stream HYDRA2 web browser go4 gui EvBld
Use case – HADES DABC as DAQ system collects data from TRBs store HLD files deliver data to online analysis Stream event source to connect DAQ HYDRA2 analysis gets data directly via socket instead of temporary hld files THttpServer for analysis monitoring no any change in HYDRA2 itself Monitor DAQ and analysis via same interface B.Bellenot, S.Linev, THttpServer for ROOT15
Use case – HADES Online analysis Many processes in parallel doing same events or different events Histograms collector (to be done) B.Bellenot, S.Linev, THttpServer for ROOT16 Event builder DABC stream EvBld hld files HYDRA2 Histograms collector
B.Bellenot, S.Linev, THttpServer for ROOT17 Go4ExampleSimple in web browser
B.Bellenot, S.Linev, THttpServer for ROOT18 Use case – DAQ and slow-control middleware DABC MBS EPICS slow-control variables ROOT online analysis http go4 online analysis FESA beam profiles DABC DAQ status and log information
Use case – several DABC nodes B.Bellenot, S.Linev, THttpServer for ROOT19 MBS FESA MBS go4 online analysis EPICS ROOT analysis DABC http DABC Master http socket http socket FastCGI Apache http Preferable Optional
B.Bellenot, S.Linev, THttpServer for ROOT20 Alternatives to web browser DABC http socket web browser go4 gui with native ROOT graphics SOAP, JSON console-based tools DABC API
B.Bellenot, S.Linev, THttpServer for ROOT21 How it works – hierarchy request wget
B.Bellenot, S.Linev, THttpServer for ROOT22 How it works – item request wget serveritemrequest
B.Bellenot, S.Linev, THttpServer for ROOT23 How it works – history request wget