Introduction to Web Development with R



Similar documents
Web Development with R

Web Development with R

Sisense. Product Highlights.

Survey Public Visualization Services

Syllabus INFO-UB Design and Development of Web and Mobile Applications (Especially for Start Ups)

Introduction Simple Web Application Advanced Web Application IRT tool Screenshots. IRTTool.com. Building web applications with R.

Analytics Software for a World of Smart Devices. Find What Matters in the Data from Equipment Systems and Smart Devices

4/25/2016 C. M. Boyd, Practical Data Visualization with JavaScript Talk Handout

Syllabus INFO-GB Design and Development of Web and Mobile Applications (Especially for Start Ups)

Feature Overview Signavio products. Version 9.3

Revolution R Enterprise DeployR 7.1 Installation Guide for Windows

Drupal Performance Tuning

Executive Summary On IronWASP

Oracle Application Express MS Access on Steroids

Source Code Review Using Static Analysis Tools

App Central: Developer's Guide. For APKG 2.0

SOA, case Google. Faculty of technology management Information Technology Service Oriented Communications CT30A8901.

DiskPulse DISK CHANGE MONITOR

Team Members: Christopher Copper Philip Eittreim Jeremiah Jekich Andrew Reisdorph. Client: Brian Krzys

OpenText Information Hub (ihub) 3.1 and 3.1.1

PROJECT MANAGEMENT SYSTEM

Developing and deploying mobile apps

CS 558 Internet Systems and Technologies

CAREER OPPORTUNITIES

FileMaker Server 14. Custom Web Publishing Guide

SDK Code Examples Version 2.4.2

Embedded BI made easy

PHP on IBM i: What s New with Zend Server 5 for IBM i

Background on Elastic Compute Cloud (EC2) AMI s to choose from including servers hosted on different Linux distros

Load and Performance Load Testing. RadView Software October

Xerox DocuShare Security Features. Security White Paper

Last Updated: July STATISTICA Enterprise Server Security

COROUTER SOLUTIONS PVT. LTD.

Dataworks System Services Guide

Getting Started with the Ed-Fi ODS and Ed-Fi ODS API

Week Overview. Installing Linux Linux on your Desktop Virtualization Basic Linux system administration

Getting Started Guide for Developing tibbr Apps

Preface. Motivation for this Book

Creating Library Website Using Open Source Content Management System

Develop PHP mobile apps with Zend Framework

Web application security

Cloud Computing And Equal Access

IGW+ Certificate. I d e a l G r o u p i n W e b. International professional web design,

Selenium WebDriver. Gianluca Carbone. Selenium WebDriver 1

Section 1: Requirements ( Beta Release on Phase 5)

Measured Performance of an Information System

<Insert Picture Here> Michael Hichwa VP Database Development Tools Stuttgart September 18, 2007 Hamburg September 20, 2007

FileMaker Server 15. Custom Web Publishing Guide

IBM Watson Ecosystem. Getting Started Guide

Pro<DOC/> e-commerce Technology An Introduction

Open Source Project from China. Northeast Asia Open Source SoftwareCompetition Nov. 2012

Web Security Testing Cookbook*

Python and Google App Engine

Introduction to BlackBerry Smartphone Web Development Widgets

Framework as a master tool in modern web development

CPE111 COMPUTER EXPLORATION

MEGA Web Application Architecture Overview MEGA 2009 SP4

Jozef Matula. Visualisation Team Leader IBL Software Engineering. 13 th ECMWF MetOps Workshop, 31 th Oct - 4 th Nov 2011, Reading, United Kingdom

How To Install Linux Titan

Presents. WITSML Solutions For Your Business

How To Set Up Wiremock In Anhtml.Com On A Testnet On A Linux Server On A Microsoft Powerbook 2.5 (Powerbook) On A Powerbook 1.5 On A Macbook 2 (Powerbooks)

Wind River. Intelligent Device Platform XT EMS Profile EMS DEVICE MANAGEMENT USER'S GUIDE WIND RIVER 1.0

RED HAT SOFTWARE COLLECTIONS BRIDGING DEVELOPMENT AGILITY AND PRODUCTION STABILITY

PRIVACY AWARE ACCESS CONTROL FOR CLOUD-BASED DATA PLATFORMS

This document is for informational purposes only. PowerMapper Software makes no warranties, express or implied in this document.

3DHOP Local Setup. Lezione 14 Maggio 2015

Beyond The Web Drupal Meets The Desktop (And Mobile) Justin Miller Code Sorcery Workshop, LLC

Easy configuration of NETCONF devices

UH CMS Basics. Cascade CMS Basics Class. UH CMS Basics Updated: June,2011! Page 1

Cloud computing - Architecting in the cloud

Customer Control Panel Manual

REDCap Technical Overview

YouTrack MPS case study

Quick Reference Guide: Shared Hosting

Platform Independent Mobile Application Development

INTRODUCTION TO ATRIUM... 2 SYSTEM REQUIREMENTS... 2 TECHNICAL DETAILS... 2 LOGGING INTO ATRIUM... 3 SETTINGS... 4 NAVIGATION PANEL...

Building native mobile apps for Digital Factory

Simbirsk Technologies Ltd.

Adding Web 2.0 features to a Fleet Monitoring Dashboard

FileMaker Server 13. Custom Web Publishing with XML

A Tool for Evaluation and Optimization of Web Application Performance

Connection Broker Managing User Connections to Workstations and Blades, OpenStack Clouds, VDI, and more. Security Review

SQUEEZE SERVER. Operation Guide Version 3.0

Evaluation of Load/Stress tools for Web Applications testing

Introduction to Cloud Computing on Amazon Web Services (AWS) with focus on EC2 and S3. Horst Lueck

Using WebLOAD to Monitor Your Production Environment

Oracle Communications WebRTC Session Controller: Basic Admin. Student Guide

FileMaker Server 12. Custom Web Publishing with XML

Zend Server 4.0 Beta 2 Release Announcement What s new in Zend Server 4.0 Beta 2 Updates and Improvements Resolved Issues Installation Issues

Feature Overview Signavio products. Version 9.8.1

Monitoring Infrastructure (MIS) Software Architecture Document. Version 1.1

BUILDING WEB JOURNAL DIRECTORY AND ITS ARTICLES WITH DRUPAL

Introduction to IBM Worklight Mobile Platform

NoSQL and Agility. Why Document and Graph Stores Rock November 12th, 2015 COPYRIGHT 2015 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED

Connecting with Computer Science, 2e. Chapter 5 The Internet

ATLAS job monitoring in the Dashboard Framework

Enter Here --->> Directory Submitter Software For One > Get it Here <

An introduction to creating JSF applications in Rational Application Developer Version 8.0

DEVELOPMENT OF A WEB GEOSERVICES PLATFORM FOR SCHOOL OF ENVIRONMENTAL SCIENCES, MAHATMA GANDHI UNIVERSITY, KERALA, INDIA

How To Manage Your Digital Assets On A Computer Or Tablet Device

Transcription:

Introduction to Web Development with R moving to the cloud... Jeroen Ooms http://www.stat.ucla.edu/~jeroen UCLA Dept. of Statistics Revolution Analytics user 2010, Gaithersburg, Maryland, USA

An example: stockplot Plots live data from Yahoo Finance. Uses a local MySQL database, some PHP. Intuitive Drag-n-drop interface.

What is a client? A Browser

What is a client? Desktop software

What is a client? Your production process

Why Web Applications? Convenient for the user: Making new tools available to a wide audience. Make applications that only require a browser. Cross-platform. Server-based by design: Efficient use of resources. Easier to maintain. Integration with existing services/databases/etc.

Web application Setup Server Client Request/Response Workstation Calling R Interface

Stateful or Stateless Stateful R session: Efficient for multiple operations on the same workspace. Essential for big data. What to do with parallel requests? When to timeout sessions? Stateless R sessions: Every request gets a new empty R session. Session is killed after operation finishes. Parallel requests no problem. Simulate statefulness by saving/loading workspaces.

Resources and Scalability How to prevent overloading your servers? Limit memory per R session? Limit CPU time per R session? Limits per user or per request? Prevent DoS (1000 requests/sec). Load balancing, CPU distribution.

Security How to prevent users from abusing your servers? R interacts freely with the system shell, which can be abused. What is the trust relationship with the user? Allow free code execution or only run predefined parameterized scripts? If only scripts, still watch out for code injection. Public (anonymous) privileges vs authorized privileges. Sandboxing users?

What to do with R errors? Error Catching It is often useful to feed errors back to the client. Catch the errors in your R scripts. Always return a success property in your response. <response> <success> true </success> <results> // here the results </results> </response> OR: <response> <success> false </success> <error> line 1 did not have 8 elements </error> </response>

Graphics rendering At the server use R s graphics device plot to PNG, PDF, SVG, etc Easy, fast, pretty plots Limited by R s graphics, no interaction, etc [example: sales] At the client use R only for numbercrunching return just data, no figure. render a plot on the client. more work, more eye candy. [example: BA]

General Advice Use R for calculations and plots. Do not generate HTML in R. Separate statistical/r layer from data layer, presentation layer, etc. Use a CMS or Web Development framework for UI stuff. Use R semantically. Think about Input/Output of your R scripts in terms of the statistical model. Standardize your R services. They should be client-independent. Make XML or JSON interfaces to your R services.

Connecting R Low level tools: RScript - execute R scripts from the shell (stateless) RApache - execute R scripts from Apache httpd (stateless) Rserve - stateful R session with socket access. py2r - call R locally from python. JRI - call R locally from Java. Problems: You need to be both web developer and R programmer to use any of these. A lot of work is required to get some simple functionality. Little control over resources, security, scalability.

Phoenix Server: a high level solution Phoenix (codename) server: Framework for R web development by Revolution Analytics. Commercial and Academic (free) licences. Can be hosted locally or in the cloud. Scalability {1..n] R Servers with load balancing. Runs on Linux and Windows. Our Goals: Keywords: Scalable, Standardized, Secure. Easily add R functionality to any application. Separates the R/statistical programming from the web development.

Phoenix Server: features RESTful API Management Console Standardized XML/JSON Interfaces. JSON/XML object encoding. Stateful and Stateless code execution. Deploy R scripts without any programming. Open source clients available for Java,.NET, PHP, Javascript, Excel, etc.

Management Console

RESTful API Every command is called from a http url E.g. http://calc.company.org/r/session/login /r/session/login /r/session/create /r/session/file/upload /r/session/execute/script /r/session/object/list /r/session/object/save /r/project/save /r/session/close etc

Example call: XML/JSON interfaces POST /r/session/save format=json& session=live-92d9c643-5620-40a1-8626-47ded19970cc& descr=my Workspace 1 Example response: "phoenix": { "response": { "success": true, "call": "/r/session/saveworkspace", "pobjects": { "My Workspace 1": { "value": "CBNRY-7f8fa254-cc5a-4f77-a9d9-3b873be1bad3" } }, "session": "LIVE-92d9c643-5620-40a1-8626-47ded19970cc" } }

XML/JSON Data-object Encoding "mydataframe" : { "type": "dataframe", "value": { "age": { "type": "vector", "value": [ 13, 15, 16 ] }, "gender": { "type": "factor", "value": [ "female", "male", "female" ] } } }

Stateful and Stateless code execution Execute an R script that exists on the server. Interfaces: /r/script/execute /r/session/execute/script Features: Execute an R script that exists on the server. Either stateless or stateful. Paramaterize by pushing R objects before execution. Retreive encoded objects or files after execution.

Privilege Roles Some built-in standard roles (customizable): Administrator: Deploy R-Scripts, Manage users, etc Unrestricted user: Use entire API. Restricted user: Use entire API, except for custom code execution. Public: permits the execution of stateless scripts anonymously.

Open Source Client Libraries jphoenix (Java) client Lib String phoenixurl = "http://www.thecloud.com/phoenix/"; PClient pclient = PClientFactory.createClient(phoenixUrl); pclient.login(new PBasicAuthentication("testuser", "password")); PSession psession = pclient.createsession(); psession.executecode("x <- rnorm(1000);"); psession.executescript("predict-stocks",...); psession.closesession(); pclient.release();

Open Source Client Libraries phpphoenix client lib: $websession = WebSession::getInstance(); $client = new PhoenixClient::createHttpClient(PHOENIX_URL, $websession); $client->login(new PhoenixBasicAuthentication(USERNAME, PASSWORD)); $session = $client->createsession( calculate_average_session ); $phoenixexecution = $session->executecode( myvar <- rnorm(100), myvar ); $robjects = $phoenixexecution->getrobjects();

Open Source Client Libraries phoenixjs client library (sales example) button.onclick = function(){ pexecutescript({ scriptname: plotsales-png, inputs: plotparams, files: [ salesplot.png ], mask: Ext.getCmp( plotpanel ).getlayouttarget(), success: function(robjects,files){ insertplot(files[ salesplot.png ].value); } }); }

Example: sales forecasting

Finally, dinner! Thank you for your attention. http://www.stat.ucla.edu/~jeroen http://www.revolutionanalytics.com

Object Encoding: XML <mymodel> <family>gaussian</family> <deviance>3569.23</deviance> <coefficients> <coef> <name>intercept</name> <value>5.69</value> </coef> <coef> <name>age</name> <value>0.36</value> </coef> <coef> <name>gender</name> <value>2.54</value> </coef> </coefficients> </mymodel>

Object Encoding: JSON {"mymodel": { "family": "Gaussian", "deviance": 3569.23, "coefficients": [ {"Intercept": 5.69}, {"Age": 0.36}, {"Gender": 2.54} ] } } Or for example a dataframe: {"mydata": { "Age":[9,8,12,6,7,8,9,8,10,11,9,6,8], "Gender":["M","F","F","M","F","M","F","F","M","F","M","F","F"], "Treatment":[1,0,0,1,1,1,0,0,0,1,1,1,0] } }

Examples: sales forecasting

Examples: yeroon.net/ggplot2 Exploratory graphical analysis and education of stats and R. Upload data or import spreadsheet from Google Docs. Add graphical layers and map/set any aesthetics. Export to PNG, PDF, SVG

Examples: yeroon.net/lme4 Online random effects / multilevel modeling. Upload data, maintain several models. Export PDF report (Latex)

Examples: stockplot Plots live data from Yahoo Finance. Uses a local MySQL database, some PHP. Intuitive Drag-n-drop interface.