whitepaper Embedding Microsoft.NET Code in TIBCO StreamBase Event Processing Applications

Similar documents
SOLUTION BRIEF. TIBCO StreamBase for Algorithmic Trading

TIBCO StreamBase High Availability Deploy Mission-Critical TIBCO StreamBase Applications in a Fault Tolerant Configuration

Integration Maturity Model Capability #1: Connectivity How improving integration supplies greater agility, cost savings, and revenue opportunity

TIBCO Live Datamart: Push-Based Real-Time Analytics

TIBCO Cyber Security Platform. Atif Chaughtai

Integration Maturity Model Capability #5: Infrastructure and Operations

SOLUTION BRIEF. Granular Data Retention Policies

SOLUTION BRIEF. TIBCO StreamBase for Foreign Exchange

Service-Oriented Integration: Managed File Transfer within an SOA (Service- Oriented Architecture)

Empowering the Masses with Analytics

whitepaper Five Principles for Integrating Software as a Service Applications

Streaming Analytics and the Internet of Things: Transportation and Logistics

TIBCO StreamBase High Availability Deploy Mission-Critical TIBCO StreamBase Applications in a Fault Tolerant Configuration

Partner Collaboration Blueprint for ICD-10 Transition

WHITEPAPER. Beyond Infrastructure Virtualization Platform Virtualization, PaaS and DevOps

A Technical Review of TIBCO Patterns Search

SOLUTION BRIEF. TIBCO LogLogic A Splunk Management Solution

Resource Sizing: Spotfire for AWS

whitepaper The Evolutionary Steps to Master Data Management

Mobile App Integration - Seven Principles for ZDNet

InRule. The Premier BRMS for the Microsoft Platform. Benefits THE POWER OF INRULE. Key Capabilities

Demo: Controlling.NET Windows Forms from a Java Application. Version 7.3

Log Management Solution for IT Big Data

Predictive Straight- Through Processing

End-to-end Processing with TIBCO Managed File Transfer (MFT) Improving Performance and Security during Internet File Transfer

access convergence management performance security

Implementing TIBCO Nimbus with Microsoft SharePoint

V 6.1 Core Training Training Plan

Extending the Benefits of SOA beyond the Enterprise

Developing Algo Trading Applications with SmartQuant Framework The Getting Started Guide SmartQuant Ltd Dr. Anton B.

Integrated Virtual Debugger for Visual Studio Developer s Guide VMware Workstation 8.0

TIBCO ActiveSpaces Use Cases How in-memory computing supercharges your infrastructure

TIBCO Managed File Transfer Suite

Predictive Analytics with TIBCO Spotfire and TIBCO Enterprise Runtime for R

Service Mediation. The Role of an Enterprise Service Bus in an SOA

Extensibility. vcloud Automation Center 6.0 EN

SOLUTION BRIEF. An ArcSight Management Solution

Integration: Why Good Enough Doesn t Cut It 13 ways to mess with success

SOLUTION BRIEF. How to Centralize Your Logs with Logging as a Service: Solving Logging Challenges in the Face of Big Data

Deploying Microsoft Operations Manager with the BIG-IP system and icontrol

CRM Setup Factory Installer V 3.0 Developers Guide

What s new in TIBCO Spotfire 6.5

whitepaper Predictive Analytics with TIBCO Spotfire and TIBCO Enterprise Runtime for R

Open Source Business Rules Management System Enables Active Decisions

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

Data processing goes big

Custom Tasks for SAS. Enterprise Guide Using Microsoft.NET. Chris Hemedinger SAS. Press

Enterprise Service Bus

Getting Started with ESXi Embedded

Combating Fraud, Waste, and Abuse in Healthcare

Hypercosm. Studio.

Programmabilty. Programmability in Microsoft Dynamics AX Microsoft Dynamics AX White Paper

IBM WebSphere ILOG Rules for.net

PC-Duo Web Console Installation Guide

Installation guidance ProjectWise Explorer

WEBAPP PATTERN FOR APACHE TOMCAT - USER GUIDE

14.1. bs^ir^qfkd=obcib`qflk= Ñçê=emI=rkfuI=~åÇ=léÉåsjp=eçëíë

SOLUTION BRIEF. Simplifying FISMA and NIST Compliance with the TIBCO LogLogic Compliance Suite

Matisse Installation Guide for MS Windows

TIBCO ActiveMatrix BusinessWorks Plug-in for TIBCO Managed File Transfer Software Installation

Crystal Reports. For Visual Studio.NET. Reporting Off ADO.NET Datasets

Transaction Modernization Solutions for Healthcare

JBoss EntErprisE BrMs

a division of Technical Overview Xenos Enterprise Server 2.0

Practice Fusion API Client Installation Guide for Windows

How To Program With Adaptive Vision Studio

Pcounter Web Report 3.x Installation Guide - v Pcounter Web Report Installation Guide Version 3.4

Microsoft Dynamics GP. econnect Installation and Administration Guide Release 9.0

PCVITA Express Migrator for SharePoint(Exchange Public Folder) Table of Contents

Esri ArcGIS Server 10 for VMware Infrastructure

Creating Form Rendering ASP.NET Applications

Open source business rules management system

What s New in Ghost Solution Suite 3.0

FIGURE Selecting properties for the event log.

Keil Debugger Tutorial

Informatica Ultra Messaging SMX Shared-Memory Transport

Predictive Customer Interaction Management

Creating XML Report Web Services

SAML v1.1 for.net Developer Guide

Desktop Activity Intelligence

Comparing SQL Server 2005 and IBM DB2 v8.2 as a Database Platform for Visual Studio and.net Developers

About This Guide Signature Manager Outlook Edition Overview... 5

IBM Operational Decision Manager Version 8 Release 5. Getting Started with Business Rules

COSC 6397 Big Data Analytics. 2 nd homework assignment Pig and Hive. Edgar Gabriel Spring 2015

BPM Scheduling with Job Scheduler

A Guide Through the BPM Maze

TIBCO Nimbus Cloud Service

10 STEPS TO YOUR FIRST QNX PROGRAM. QUICKSTART GUIDE Second Edition

Preparing a SQL Server for EmpowerID installation

NETWRIX EVENT LOG MANAGER

Chapter 1. Introduction to ios Development. Objectives: Touch on the history of ios and the devices that support this operating system.

VirtualCenter Database Performance for Microsoft SQL Server 2005 VirtualCenter 2.5

BarTender s ActiveX Automation Interface. The World's Leading Software for Label, Barcode, RFID & Card Printing

Introducing the.net Framework 4.0

Symantec Indepth for. Technical Note

vtcommander Installing and Starting vtcommander

Release Notes LS Retail Data Director August 2011

TIBCO Spotfire Metrics Prerequisites and Installation

An Esri White Paper June 2010 Tracking Server 10

How To Use Safety System Software (S3)

Transcription:

Embedding Microsoft.NET Code in TIBCO StreamBase Event Processing Applications

Table of Contents 3 Introduction 3 Benefits of Hosting Code in TIBCO StreamBase 3 The TIBCO StreamBase.NET Operator 4 How it Works 5 Embedding.NET Code Using the Operator 9 Performance Considerations 10 Benchmark Application 11 Conclusion

Embedding Microsoft.NET Code in TIBCO StreamBase Event Processing Applications Introduction TIBCO StreamBase event processing is a deployment platform and authoring environment for complex event processing applications. These are applications that react in real time to incoming events connecting to the source of the event, collecting event data, analyzing that data, making decisions, and then taking action often by publishing more events. Examples of event driven applications include algorithmic trading, risk management, network monitoring, and fraud detection. The TIBCO StreamBase event procesing platform hosts these applications, which often combine logic written in multiple languages including TIBCO StreamBase StreamSQL, TIBCO StreamBase EventFlow, Java, C++, R, MATLAB, or Python. The Microsoft.NET platform has gained a wide user base over the last decade. It includes many libraries, and your organization may already have software or expertise in C#, Visual Basic, and other.net languages. This paper describes how to embed.net code into TIBCO StreamBase, invoking your existing or new.net-hosted assets from a TIBCO StreamBase application, optionally feeding the results back into the application for further processing or automated actions. In this way, non-real-time.net code can easily be executed against real-time data and trigger real-time reaction. Benefits of Hosting Code in TIBCO StreamBase Developing business applications that respond to real-time information can be difficult. Developers may have to deal with messaging protocols, event models, threading, scalability, and fault tolerance. By working on top of the TIBCO StreamBase platform, these applications are much easier to build. Data connectivity, threading, scale out, and other concerns are handled automatically. Developer tools for debugging, profiling, monitoring, and managing systems, appropriate for real-time deployments, are all included with the platform. Developers can thus focus on their unique analytics or business logic. The embedding of.net code into TIBCO StreamBase brings these same benefits to.net programmers. The TIBCO StreamBase.NET Operator TIBCO StreamBase s Microsoft.NET Operator is the focal point for integration. It seamlessly loads the.net runtime into a StreamBase application s process along with an arbitrary.net assembly (the target assembly ) and invokes its code via a simple, predefined interface. Using this interface, your.net code can process StreamBase tuples without any inter-process or inter-server communication overhead; from the StreamBase application s perspective the.net code is just another operator in its execution path. 3

How it Works The bulk of a TIBCO StreamBase application executes in the context of a Java Virtual Machine (JVM). The.NET Operator transparently embeds the.net runtime inside the JVM s process and allows data to be passed between the two environments seamlessly with minimal overhead. Figure 1 - A tuple s path through the.net Operator The.NET Operator is created and configured like any other TIBCO StreamBase operator available in TIBCO StreamBase Studio. An instance of the operator is dragged from the Operators and Adapters palette to the canvas, and its properties are set via Studio s Operator Properties tab. 4

w h i t e pa p e r Figure 2 - Creating an instance of the.net Operator Among the properties available is the.net strong name (or the full path) of the assembly to load and the fully qualified name of the class contained therein which extends the StreamBase.SB.Operator class. When the application is run, the.net Operator loads the Microsoft.NET runtime environment into the application s process, loads the given assembly, and instantiates the given class. As tuples are received by the operator, they are passed on to the.net object, which can then process them and optionally send tuples of its own to the application for further processing. Embedding.NET Code Using the Operator In order for the.net Operator to interact with arbitrary.net code, the latter must expose an object extending StreamBase.SB.Operator, which is defined in the TIBCO StreamBase.NET Client API library (StreamBase.SB.Client.dll) included in the TIBCO StreamBase base product installation. This class contains several methods that are either called by the operator when interesting events occur (for example, when a tuple is received on one of the input ports), or called by the client code to interact with the TIBCO StreamBase application (for example, to send new tuples on one of the output ports). Example Let s say we have some logic to calculate p (pi) to the Nth digit in a C# method defined as... string MyCalculatorClass.GetPi(int n)... that is compiled into class library called CalculatorAssembly.DLL. We would like to invoke this code from our TIBCO StreamBase application. 5

First let s think about the number of desired input and output ports and their associated schemas for our.net Operator in the application. In this case we can easily handle the task by having one input port containing a single field of type int (call it numdigits) and one output port containing a string field (call it answer). More involved scenarios could of course require multiple input and output ports with complex schemas, but for this example we have all we need. Now we need to create some TIBCO StreamBase client code in C# to extend StreamBase. SB.Operator. Your Microsoft Visual Studio project should: Be set to produce a class library Include a reference to StreamBase.SB.Client.DLL (located in <streambase_home>\bin), with its Copy Local property set to false Include a reference to CalculatorAssembly.DLL (to use MyCalculatorClass) Target the full.net 4.0 Framework Profile as opposed to the Client Profile (this is true for any StreamBase.NET Client API code) We ll call the resulting assembly MyDotNETOperator.DLL. The implementation of the StreamBase.SB.Operator subclass is as follows (error checking is omitted for clarity): using StreamBase.SB; namespace MyNamespace { public class MyDotNETOperator : Operator { MyCalculatorClass calc = null; public override void Init() { // Create a calculator instance calc = new MyCalculatorClass(); } public override void ProcessTuple(int port, Tuple tuple) { // Get the input value from the tuple int numdigits = tuple.getint( numdigits ); // Calculate the answer string answer = calc.getpi(numdigits); // Place the answer in a new tuple Tuple returntuple = GetOutputSchema(0).CreateTuple() returntuple.setstring( answer, answer); // Send the tuple on the operator s output port #0 SendOutput(0, returntuple); } // The class needs a public default constructor (compilergenerated or explicitly defined), // which will be used by the.net Operator to create the instance public MyDotNETOperator() { } } } 6

When the MyDotNETOperator.DLL assembly is compiled, we place it alongside CalculatorAssembly.DLL in a directory (call it C:\MyAssemblies\). The accompanying.pdb files may also be included for debugging purposes. Now we have all the pieces needed by the.net Operator, and we can create the TIBCO StreamBase application. The EventFlow will be simple: one input stream connected to a.net Operator, in turn connected to an output stream. The input stream s schema contains a numdigits field of type int. On the operator s Operator Properties tab the full path to the assembly is entered (C:\MyAssemblies\CalculatorAssembly.DLL), as well as the fully-qualified class name (MyNamespace.MyDotNETOperator). On the Ports tab the number of input ports and output ports are both set to 1. On the Schemas tab the schema of the output port is made to contain one field: answer (string). Everything is now set and ready to run. When TIBCO StreamBase Studio s Run button is clicked, the application is started, the.net runtime environment is loaded along with all the assemblies, and an instance of MyDotNETOperator is created. In the Debug Perspective s Manual Input pane, you can enter a value for numdigits and hit the Send Data button, which will route the tuple to the.net code and calculate the value of p to the specified digit. The.NET code will generate a new tuple with the answer, and this will be emitted on the operator s output stream, as evidenced by the Application Output pane. 7

Assembly Loading Considerations The.NET runtime environment has a special set of rules in determining locations to examine when looking for assemblies. For starters (and rather counter intuitively) it doesn t look in the path defined in the PATH environment variable, and the rules only get more complex after that. The.NET Operator s ability to locate and load your assembly depends on several factors, outlined in this table: How the assembly name is specified to the operator s Assembly Name property How the operator locates the assembly How the operator locates other referenced assemblies Using the assembly s exact location on disk (C:\MyDir\MyAssembly. DLL) Looks in the specified directory. If a relative path is specified, the current working directory of the StreamBase application is used as a reference. If the assembly is not located in the specified directory, the load will fail. If normal.net loading rules fail to locate the assembly, the directory containing the operator s assembly is probed. If the assembly is found there, it will be loaded. Otherwise the load will fail. Using the assembly s simple name ( MyAssembly ) or fully qualified name ( MyAssembly, Version=1.0, ) Normal.NET loading rules apply. If the assembly is not found using these rules. the load will fail. If normal.net loading rules fail to locate the assembly, the directory containing the operator s assembly is probed. If the assembly is found there. it will be loaded. Otherwise the load will fail. If your assembly refers to other assemblies, the normal.net loading rules will be used in locating them; however should these rules fail. a last attempt will be made by looking in the directory where your initial assembly was found. Clearly, the most expedient solution to ensure seamless operation is to place all the assemblies in a specific directory whenever possible and use the full path to that directory as a value to the operator s Assembly Name property. If a situation is encountered where either the target assembly or one of its dependents fails to load, determining the exact cause can be tricky. One thing to double-check in such cases is for the target assembly s reference to StreamBase.SB.Client.DLL to have its Copy Local property set to false. Beyond that there are a number of online resources to help with diagnosis, most of which revolve around the use of a free Microsoft tool called Fusion Log Viewer. 8

Debugging the.net Operator s Target Assembly Provided you have a copy of Microsoft Visual Studio installed and debugging symbols are available (the assembly s.pdb file), debugging the.net client code is easy: Open the target assembly s solution in Visual Studio Place a breakpoint in the desired location (for example in the code s implementation of Operator.ProcessTuple()) In the menu go to Debug Attach to Process and select sbd-java.exe in the list of processes, then click Attach The debugger should load the process and install the breakpoint. From then on debugging proceeds as with any other.net application. If you wish to debug your operator s Init() method, an additional step will be required because this gets called very early in the application s lifecycle, and it is doubtful there will be enough time to attach the.net debugger before its invocation. The solution here is to run your TIBCO StreamBase Server with the --suspend option to start your application in suspended mode, then use TIBCO StreamBase s sbadmin utility (sbadmin resume) to resume your application after having attached your.net debugger to the process. Performance Considerations Interoperability between TIBCO StreamBase and.net code involves translating data from StreamBase s memory structures to.net s and vice versa, a process called data marshaling. This extra conversion step consumes some processing cycles and affects the overall performance of the operator (target assembly s processing time notwithstanding, of course). Specifically: The more data there is to convert in a given StreamBase tuple, the more processing cycles it will cost to marshal. Complex data types (nested tuples, lists, capture fields, functions) require more cycles to marshal than simple data types (boolean, integer, long, double, string, timestamp, blob). Given these observations, we can look at some benchmark tests involving simple and complex schemas (both containing the same total number of fields) in an attempt to characterize performance. Both benchmark tests are identical save for their respective input and output schemas. In each test, one hundred thousand tuples are first sent through to prime both the Java and.net JIT compilers. Then one million tuples are sent as fast as possible while timing the operation. The target assembly performs minimal work but returns a tuple for each tuple sent so that timing values represent full StreamBase-.NET-StreamBase roundtrips. The simple schema is defined as follows: 7 int fields 7 long fields 6 string fields 6 double fields 9

The complex schema is defined as: int field long field tuple field with a schema of { int, long, double, string }) list-of-tuples field (tuple schema is again { int, long, double, string }), five elements in the list Note that both schemas contain the same number of fields overall (26). Benchmark Application The TIBCO StreamBase project described above includes two separate but nearly identical TIBCO StreamBase applications, one that uses the.net Operator and one that uses a Java Operator performing the same work. In this way a valid comparison can be made for the performance overhead of running custom.net code vs. custom Java code in a TIBCO StreamBase application. Benchmark Results Here are the results from running the.net Operator benchmark test application: Tuple roundtrip time (SB ->.NET -> SB) Roundtrip tuples per second Simple Schema ~26.3 microseconds ~38,000 Complex Schema ~44.0 microseconds ~22,700 By comparison, an identical test run against a Java Operator performing exactly the same work exhibits the following performance: Tuple roundtrip time (SB ->.NET -> SB) Roundtrip tuples per second Simple Schema ~1.65 microseconds ~606,000 Complex Schema ~2.7 microseconds ~370,400 These tests were run on a Dell Latitude E6510 quad-core laptop with 6GB of RAM running Windows 7 64 bits SP1, with StreamBase 7.3.1 64 bits. During the test the processor load hovered around 25%, although no one core was at 100% at any time. The application was run from the command line to avoid the additional overhead introduced by TIBCO StreamBase Studio s runtime environment. Performance Conclusions Hosting.NET code in TIBCO StreamBase adds about 24-42 microseconds of latency compared to a similar Java operator a total end to end latency of about 26-44 microseconds. 10

Conclusion The TIBCO StreamBase platform is a powerful and productive way to write event driven applications that acquire and process data and perform automated actions. The platform enables the StreamBase developer to focus on business logic. The addition of the.net Operator further enhances the overall platform productivity through seamless integration of existing or new.net application logic. Productivity gains are achieved by leveraging existing code and enabling developers to use their existing skills while also benefitting from using TIBCO StreamBase to coordinate event-oriented processing. TIBCO Software Inc. (NASDAQ: TIBX) is a global leader in infrastructure and business intelligence software. Whether it s optimizing inventory, cross-selling products, or averting crisis before it happens, TIBCO uniquely delivers the Two-Second Advantage the ability to capture the right information at the right time and act on it preemptively for a competitive advantage. With a broad mix of innovative products and services, customers around the world trust TIBCO as their strategic technology partner. Learn more about TIBCO at www.tibco.com. Global Headquarters 3307 Hillview Avenue Palo Alto, CA 94304 Tel: +1 650-846-1000 +1 800-420-8450 Fax: +1 650-846-1005 www.tibco.com 2014, TIBCO Software Inc. All rights reserved. TIBCO, the TIBCO logo, TIBCO StreamBase, TIBCO StreamBase EventFlow, and StreamBase Studio are trademarks or registered trademarks of TIBCO Software Inc. and/or subsidiaries of TIBCO Software Inc. in the United States and/or other countries. All other product and company names and marks in this document are the property of their respective owners and mentioned for identification purposes only. 11 exported27jan2014