Sarge Sr. Technical Support Engineer Adobe Systems

Slides:



Advertisements
Similar presentations
Threads, SMP, and Microkernels
Advertisements

Web Applications Development Using Coldbox Platform Eddie Johnston.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
70-293: MCSE Guide to Planning a Microsoft Windows Server 2003 Network, Enhanced Chapter 7: Planning a DNS Strategy.
SERVICE BROKER. SQL Server Service Broker SQL Server Service Broker provides the SQL Server Database Engine native support for messaging and queuing applications.
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
Exploring Real-time apps with ColdFusion and Blaze DS / Live Cycle Data Services ES Dan Blackman
ColdFusion Performance Tuning Keen Haynes Certified ColdFusion Developer.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
Copyright ®xSpring Pte Ltd, All rights reserved Versions DateVersionDescriptionAuthor May First version. Modified from Enterprise edition.NBL.
Software Architecture for ColdFusion Developers Unit 4: Application Events and Global Variables.
What’s New in CF 8 Admin MDCFUG 8/14/2007 Ajay Sathuluri Sr. Web and Database Engineer TeraTech Inc.
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Using Event Gateways with CFMX7 By Jeff Tapper Tapper.net Consulting.
Introduction to ColdFusion Yu Fu 2003 MEC Candidate.
March 12 & 13, 2007 IIS 7.0 for CFML Developers Deploying on IIS 7.0 with Adobe ColdFusion and New.
Chapter 6 Server-side Programming: Java Servlets
What’s new in Kentico CMS 5.0 Michal Neuwirth Product Manager Kentico Software.
Page 1 © 2001, Epicentric - All Rights Reserved Epicentric Modular Web Services Alan Kropp Web Services Architect WSRP Technical Committee – March 18,
CF101: Welcome to ColdFusion Simon Horwith CTO, Etrilogy Ltd.
37 Copyright © 2007, Oracle. All rights reserved. Module 37: Executing Workflow Processes Siebel 8.0 Essentials.
CFUNITED – The premier ColdFusion conference ColdFusion Components Ajay Sathuluri Based on presentation.
Theo Rushin, Jr. Senior Web Application Developer World Singles and DoubleBlack Technologies 12/26/
ClearQuest XML Server with ClearCase Integration Northwest Rational User’s Group February 22, 2007 Frank Scholz Casey Stewart
Mach II at Macromedia Sean Corfield Director, Architecture An introduction to Mach II and its use on macromedia.com.
Spring RabbitMQ Martin Toshev.
Advance Caching Techniques Keen Haynes MKAD SCCFUG Winter 2002 Conference.
Mach-II Primer Ben Edwards An Introduction to Mach-II: An event-based, implicit invocation web-application framework.
CFUNITED – The premier ColdFusion conference Using Event Gateways with CFMX7 By Jeff Tapper Tapper.net Consulting.
Leveraging ColdSpring to build a robust Flex applications Chris Scott, Cynergy Systems.
CFUNITED – The premier ColdFusion conference CFMX7 Admin API Nate Nelson
Thomas Burleson. Using MVC with Flex & Coldfusion Projects June 27, 2007 See how Coldfusion MVC is similar to Flex MVC…
Event Sources and Realtime Actions
ArcGIS for Server Security: Advanced
Everything you've ever wanted to know about using Control-M to integrate any application workload September 9, 2016 David Fernandez Senior Presales Consultant.
Last Class: Introduction
Chapter 3: Process Concept
Credits: 3 CIE: 50 Marks SEE:100 Marks Lab: Embedded and IOT Lab
z/Ware 2.0 Technical Overview
CF101: Welcome to ColdFusion
LOCO Extract – Transform - Load
CS399 New Beginnings Jonathan Walpole.
Operating System (013022) Dr. H. Iwidat
Lecture 21 Concurrency Introduction
The Client/Server Database Environment
PHP / MySQL Introduction
#01 Client/Server Computing
Client-Server Interaction
Software Testing and Maintenance Designing for Change
April Webinar: Advanced Configuration of Order Forms in Workflow
Chapter 4 Multithreading programming
Building a CF Administrator Interface in Flex
Oracle Architecture Overview
Lecture 1: Multi-tier Architecture Overview
ColdFusion Performance Troubleshooting and Tuning
Nate Nelson I*LEVEL, Inc.
Time Gathering Systems Secure Data Collection for IBM System i Server
Issues in Client/Server Programming
Multithreaded Programming
Understanding and Designing with EJB
AIMS Equipment & Automation monitoring solution
Leveraging ColdSpring To Make Better Applications
Database System Architectures
New Technologies for Storage and Display of Meteorological Data
TN19-TCI: Integration and API management using TIBCO Cloud™ Integration
Tom Link CTO, Universal Mind
#01 Client/Server Computing
Presentation transcript:

Sarge Sr. Technical Support Engineer Adobe Systems Building High-performing Applications using Asynchronous Gateways - 201 Sarge Sr. Technical Support Engineer Adobe Systems CFUNITED – The premier ColdFusion conference www.cfunited.com

Introduction Sarge (sarge@adobe.com) “The Man, The Myth, The Legend” Native Son www.sargeway.com/blog www.adobe.com/go/sarge_blog Started with Allaire in March 2000 Allaire Consulting Macromedia Product Support Currently Adobe Gold Support CF Experience Started with 2.0 Build global CF site for integration with DOD PKI Contributed to a couple books and magazines June 28th – July 1st 2006

Agenda What’s covered (and what’s not) What is Asynchrony? Event Gateway Primer CF Asynchronous Gateway Examples Damon Cooper’s Threading Case Studies June 28th – July 1st 2006

What’s Covered (and what’s not) Asynchronous programming in CF CF Event Gateway Primer CF Asynchronous gateway Not Covered Ajax, CFAjax, etc. Flex, Flash Remoting, etc. .NET Asynchronous Programming Models June 28th – July 1st 2006

What is Asynchrony? State of being unsynchronized Non-blocking, parallel requests Requests run simultaneously “Concurrent multi-tasking” June 28th – July 1st 2006

What is Asynchrony? (cont’d) Benefits: Increased application response Does not always mean “no refresh” Performing multiple tasks within the same interface Better scaling applications Drawback: Programming shift Gets away from traditional request/response paradigm Requires additional threads Not suitable for all occasions/circumstances June 28th – July 1st 2006

Asynchronous Programming Most applications are synchronous Procedural and object oriented designs Multiple tasks are performed sequentially Each task has to wait for running task to complete Easier to maintain state/connection Tasks can provide feedback within the request Asynchronous applications can perform multiple tasks within a single request, concurrently Tasks are performed in parallel Tasks are autonomous Asynchronous tasks may provide feedback to originating requests June 28th – July 1st 2006

Synchronous Example: threadsynch_serial.cfm Damon Cooper’s code that creates 100 copies of a file Loops over <cffile> Includes 200ms sleep time Demonstrates typical synchronous application logic Multiple tasks in single template request Tasks execute/complete sequentially ~26 sec execution time June 28th – July 1st 2006

Sandals.com: Asynchronous Lookups Travel site featuring Sandals resort + travel booking Internal web service (CF) for air and land travel availability Synchronous Model User submits form CF calls land web service (~4 secs) then calls air web service (~12-20 secs) Typically +30 secs avg response time Simultaneous Request hog! Asynchronous Model User submits form Java polling services (5 secs) queries both land and air web services and saves results as WDDX in single DB row ~15 sec total response time Separating functionality increases stability and responsiveness http://obe.sandals.com June 28th – July 1st 2006

Event Gateway Primer Available with ColdFusion MX 7 Enterprise (and Developer*) Allows non-HTTP communication with CF Written in Java Extensible API Ships with several types Asynchronous CFML, SMS, SAMETIME, and XMPP Example types: Directory Watcher, JMS, TCP Sockets, etc. Third-party gateways available (e.g. https://sourceforge.net/projects/cfmximgateways) June 28th – July 1st 2006

Event Gateway Primer (cont’d) Configurable via CF Administrator Register gateway types Start and stop gateway instances Configure thread and queue sizes June 28th – July 1st 2006

Event Gateway Primer (cont’d) CF Event Gateway Architecture Event Gateway Subsystem Threads, queue, logging, etc. Configuration files Listener CFCs All the power of ColdFusion Components Specific methods for gateway types – e.g. onIncomingMessage, onAddBuddyRequest CFEvent structure Properties: gatewayID, data, originator, gatewayType Application types: Initiator/Generator Responder June 28th – July 1st 2006

Event Gateway Architecture Message Generator/Receiver SMSC Server IM Provider Etc. Listener CFC CF Event Gateway Services Event CFEvent CFEvent Listener CFC or CFM Page Event CFEvent Message <CFML> June 28th – July 1st 2006

CFUNITED: Event Gateway Sessions Event Gateways in CFMX 7 – Jeff Tapper June 28th – July 1st 2006

Asynchronous CFML Gateway CF Event Gateway type that provides asynchronous calls to CFC methods Allows your code to call CFC methods and continue processing without waiting for them to complete or return (data/error) Useful for tasks not requiring user interaction Batch processing (emailers, site maintenance, report generation, etc.) Logging Verity Indexing (be very careful) Can be combined with any other Gateway type Provides flexibility and fosters innovation Does not return feedback to calling thread sendGatewayMessage() actually returns a queued status message – True | False See Sean Corfield’s blog posting on Concurrency: http://corfield.org/blog/index.cfm?do=blog.entry&entry=4D121277-A559-411D-A0960C66A7E3BFCD June 28th – July 1st 2006

Calling the Asynch CFML Gateway Create CFC with onIncomingMessage method Required: CFEvent argument that accepts a struct Register CFC as a CFML gateway type Provide a unique ID, the path to the CFC, and a startup mode. Configuration file is not needed Start the gateway instance Remember to do this step! June 28th – July 1st 2006

Calling the Asynch CFML Gateway Code CFML to call the gateway instance Use sendGatewayMessage(gatewayID, data) to pass message structure to the CFC’s CFEvent argument gatewayID – Gateway ID registered in CF Admin data – structure containing the message Optional fields in data structure: cfcpath, method, originatorID, and timeout June 28th – July 1st 2006

Asynchronous Example: threadsynch.cfm Damon Cooper’s code that creates 100 copies of a file Loops over sendGatewayMessage() call doWork.cfc does the file copy Includes 200ms sleep time Demonstrates power of asynchronous programming Multiple tasks in single template request Tasks execute/complete in parallel Processing returns to requested template while tasks complete Tasks queue while waiting for available thread to run ~2sec execution time June 28th – July 1st 2006

Asynch CFML vs. Scheduled Tasks Asynchronous CFML Called via CF Event Gateway Utilizes CF Event Gateway thread pool Requires sendGatewayMessage() Does not provide user feedback Hard to debug Use <cflog> and eventgateway.log Truly asynchronous Returns processing to running template Scheduled Tasks Schedule in CF Admin or CFML Uses Simultaneous Requests Requires no user interaction Does not provide user feedback Easier to debug Can fire Asynch CFML calls Pseudo-asynchronous June 28th – July 1st 2006

Interactive Sites: Batch Processing Builds premier sites for hotel industry (e.g. The Golden Nugget) HotelBook.com Features advanced caching mechanism to increase responsiveness Custom API for generating/populating cache of 5000+ hotels Synchronous Model Loop over individual hotels adding properties to cache Single hotel per iteration Verifies hotel’s existence in cache Single request thread model typically taking +6 hours on live site Asynchronous Model Uses CF Asynch Gateway to simultaneously cache multiple hotels Typically takes 45 minutes on live site Decreased available Event Gateway Threads for stability June 28th – July 1st 2006

Sports MatchMaker: Logging SportsMatchmaker.org (in Beta) Premier sports match making site Converted from CF 5.0 to CFMX 7/Flex 2 Synchronous Model Error messages logged to file using cffile and to DB Uses custom IM and email system to notify admins Can quickly lock up site if underlying systems fail (file system, email, DB, etc.) Asynchronous Model Uses sendGatewayMessage() to send cfcatch struct Now uses structured error handling – including <cflog> Integrates with other Event Gateway types for admin notification (e.g. XMPP and emailer) June 28th – July 1st 2006

Asynchronous Programming: Advantages/Disadvantages Allows tasks to run concurrently within a single request Tasks run autonomously Long running requests no longer cause increased response times Disadvantages Not suitable for all applications High user interactivity Security models Hard to debug Overuse can cause server bottleneck June 28th – July 1st 2006

Resources Tom Jordahl Damon Cooper Taking Advantage of ColdFusion MX 7 Event Gateways http://www.adobe.com/devnet/coldfusion/articles/gateway_macrochat.html Writing and Using Event Gateways in ColdFusion MX 7 http://www.adobe.com/devnet/coldfusion/articles/gateway.html Damon Cooper http://www.dcooper.org/blog/client/index.cfm?mode=entry&entry=24BEF3D6-4E22-1671-55146EEC011D18D4 Matt Woodward (www.mattwoodward.com) “The Asynchronous CFML Gateway” http://coldfusion.sys-con.com/read/101326.htm LiveDocs: http://livedocs.macromedia.com/coldfusion/7/htmldocs/00001625.htm Thanks to Sandles, Interactive Sites, and SMM June 28th – July 1st 2006

June 28th – July 1st 2006