290 likes | 482 Views
StreamInsight 04 – Installing, Deploying and Maintaining the SQL Server 2008 R2 StreamInsight Runtime Engine. SQL10R2UPD05-DECK-04 [Presenter Name] [Presenter Title] [Company Name]. Module Overview. Introducing StreamInsight Querying Events in StreamInsight
E N D
StreamInsight04 – Installing, Deploying and Maintaining the SQL Server 2008 R2 StreamInsight Runtime Engine SQL10R2UPD05-DECK-04 [Presenter Name][Presenter Title] [Company Name]
Module Overview • Introducing StreamInsight • Querying Events in StreamInsight • Designing StreamInsight Event Models and Adapters • Installing, Deploying, and Maintaining the StreamInsight Runtime Engine
Agenda • Choosing a Development Model • Choosing a Deployment Model • Demo: Working with a Development Model • Installing, Monitoring, and Maintaining StreamInsight • Demo: Event Flow Debugger • Lab: Debugging Event Flows
StreamInsight Development Models • Two development models: • Implicit Server (Easiest) • Explicit Server (Most Flexible)
Implicit Server Development Model • Easy development model to use • Hides most complexity • StreamInsight server acts as an implicit host • Creates and registers required objects • Allows developers to focus on query logic • Good test environment for query developers
Implicit Server: Process • Server created implicitly for each query • Query is automatically hosted • Stored in memory, not on stable storage (disk) • Developer provides: • Input/output adapter bindings • Query logic and binding • Server manages objects • Creates event type (accesses it via reflection) • Registers input/output adapters • Registers query template and query • Creates objects when query starts • Disposes of objects when query is disposed
Implicit Server: Query Example varinputConf = newTextFileInputConfig("MyData.csv"); varoutputConf = newTextFileOutputConfig("Result.csv"); varinputStream = CepStream<PayloadType>.Create("inputStream", typeof(TextFileInputFactory),inputConf, EventShape.Point); CepStream<PayloadType> filter = from e ininputStream wheree.value > 10 select e; Query query = filter.ToQuery(typeof(TextFileOutputFactory), outputConf, EventShape.Interval, StreamEventOrder.FullyOrdered); query.Start(); // perform work or wait for output adapter to signal complete query.Stop();
Explicit Server Development Model • Developer explicitly creates and registers all objects • Provides complete control of • StreamInsight application • Development environment (via client-side object model API) • Allows for reuse of • Queries • Adapters • Event Types • Third-party Query Templates
Explicit Server: Process • Code creates or connects to server • Code creates all objects and registers them into server • Query Template • Query Instance • Event Types • Input/Output Adapters • Server can store metadata in memory or persist to disk • Server can run locally or remotely via Web service
Explicit Server: Query Example 1 of 2 Server server = Server.Create(); Applicationapplication = server.CreateApplication("app1"); InputAdapteria = application.CreateInputAdapter<MyInputAdapterFactory>( "InputAdapterName", "Some description"); OutputAdapteroa = application.CreateOutputAdapter<MyOutputAdapterFactory>( "OutputAdapterName", "Some other description"); CepStream<PayloadType> inputStream = CepStream<PayloadType>.Create("inputStream"); varhighWaterMarkAlert = from e ininputStream wheree.value > 99 select e;
Explicit Server: Query Example 2 of 2 QueryTemplate qt1 = application.CreateQueryTemplate( "highWaterMarkAlert", highWaterMarkAlert); QueryBinderqb = newQueryBinder(qt1); qb.BindProducer("inputStream", ia, newMyInputAdapterConfig(), EventShape.Interval); qb.AddConsumer("queryresult", oa, newMyOutputAdapterConfig(), EventShape.Point, StreamEventOrder.FullyOrdered); Query q1 = application.CreateQuery( "query1", qb, "Query Description"); q1.Start();
Explicit Server: Connect to Existing Server // Connect to a remote CEP server. Server server = Server.Connect( newSystem.ServiceModel.EndpointAddress( @"http://localhost:12345/CEP")); // Retrieve the application app1 from the server. Applicationapplication = server.Applications["app1"]; // Retrieve existing query template, qt1, from server. QueryTemplate qt1 = application.QueryTemplates["qt1"];
Agenda • Choosing a Development Model • Choosing a Deployment Model • Demo: Working with a Development Model • Installing, Monitoring, and Maintaining StreamInsight • Demo: Event Flow Debugger • Lab: Debugging Event Flows
StreamInsight Deployment Scenarios • Full integration into host application as embedded DLL • Standalone server • Multiple applications • Multiple users • Option for a Windows Service on install
Deployment: Hosted DLL • Use this option for the following scenarios: • Using Implicit Server development model • Needing to minimize memory footprint • Wanting to use a single process for both application and CEP server • Wanting to tightly control access to the CEP server • Do not use this option if: • You require shared access to the metadata • You require shared access to the streaming event data
Deployment: Standalone Server • Use this option for the following scenarios: • Metadata objects need to be shared between applications • Event Types • Adapter Types • Query Templates • A data source registered with the server provides an event stream for another existing application • Can choose to set up Windows Service during install • SQL Server CE Metadata Store
Deployment: Other Potential Scenarios • StreamInsight-enabled device • Building operational intelligence
Working with a Development Model SQL10R2UPD05-DEMO-06 Demo
Agenda • Choosing a Development Model • Choosing a Deployment Model • Demo: Working with Development Models • Installing, Monitoring, and Maintaining StreamInsight • Demo: Event Flow Debugger • Lab: Debugging Event Flows
StreamInsight Installation Requirements • Admin privileges required • .NET Framework 3.5 SP1 • Must remove any existing SQL Server CE installation • Uninstall by Control Panel or re-running the setup msi
Supplied Samples • Many samples available • CodePlex project hosting for samples • http://streaminsight.codeplex.com
Monitoring StreamInsight • Need to track • Overall health of system • Query performance • Diagnostic views using ManagementService API • Use URIs for resource naming • GetDiagnosticView() • SetDiagnosticSettings() • ClearDiagnosticSettings() • Can be accessed via PowerShell
Available Diagnostic Granularity • Individual • Query • Adapter • Operator • Stream • Scheduler • Server-wide • Event Manager • Plan Manager • Scheduler • Query
Accessing Diagnostics from Powershell PS C:\> [System.Reflection.Assembly]::LoadWithPartialName( "Microsoft.ComplexEventProcessing") PS C:\> $server = [Microsoft.ComplexEventProcessing.Server]::Connect( "http://localhost/StreamInsight") PS C:\> $server | gm TypeName: Microsoft.ComplexEventProcessing.Server PS C:\> $dv= $server.GetDiagnosticView("cep:/Server/EventManager") PS C:\> $dv= $server.GetDiagnosticView("cep:/Server/PlanManager") PS C:\> $dv= $server.GetDiagnosticView( "cep:/Server/Application/ObjectModelSample/Query/SensorQuery")
Event Flow Debugger • Analyzes events through time • Step through time • Follows events from one operator to the next • Can inspect all events on all streams and locate events • Helps answer: “How did this event get to this state?” • Root-cause analysis • Shows the effect of one event on downstream events • Event propagation analysis • Shows query execution statistics
Event Flow Debugger SQL10R2UPD05-DEMO-07 Demo
Resources • StreamInsight Website • http://www.microsoft.com/sqlserver/2008/en/us/R2-complex-event.aspx • StreamInsight Books Online • http://msdn.microsoft.com/en-us/library/ee362541(SQL.105).aspx • StreamInsight Forums • http://social.msdn.microsoft.com/Forums/en-US/streaminsight/threads • StreamInsight Whitepaper • http://download.microsoft.com/download/F/D/5/FD5E855C-D895-45A8-9F3E-10AFADBE51A/Microsoft%20CEP%20Overview.docx
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.