C++ and the Cloud Steve Gates Visual C++ / Parallel Computing Platform Microsoft Corporation
Mar 28, 2015
C++ and the Cloud
Steve GatesVisual C++ / Parallel Computing PlatformMicrosoft Corporation
Microsoft Confidential.
An incubation effort to:
Support client -> server communication in native code with a modern C++ API design
Support writing Azure-based and on-premise REST services in modern C++
Let developers fall into a “pit of scalability success” by designing the I/O libraries to primarily provide asynchronous APIs
Experiment with actor-based programming model(s) in C++
CasablancaWhat is it?
Accomplished by set of libraries, tooling, and hosting services
Cross platform – public API is only C++11 (Win32, WinRT, Linux)
Open source (fall 2012)
Eventual supported release as the Azure SDK for C++
Microsoft Confidential.
Inspirations and basic principles
Highlight some of the major features
HTTP, JSON, Azure Storage, Async I/O, Tooling and Deployment
Demos and code walkthroughs
CasablancaOverview
Microsoft Confidential.
.NET
Client APIs, asynchronous libraries
Node.js
Simplicity, asynchronous-only I/O libraries
Erlang
Actor model: scalable, safe, robust server-side code
CasablancaInspiration
Microsoft Confidential.
CasablancaArchitecture
Async File I/O
TimersBinary
Serializers
JSONParser & Writer
Azure / IIS Host Windows Executable Host
Windows 7 / 8
IOCPPPLWinHTTP/HTTP.sys
HTTPClient & Listener
TCPClient & Listener
Web SocketsClient & Listener
UDPClient & Listener
Apps & Libraries
Azure Service
s
Windows Live
XboxLive
C++Actors
BingMaps
Microsoft Confidential.
Service scalability is often bounded by I/O efficiency and per-connection resource consumption
CasablancaAsynchrony
Essential for responsive GUI
Asynchrony is hard, requiring code to be rewritten with inverted control flow (callbacks)
Composition of asynchronous operations is even harder without library or language support
Microsoft Confidential.
REST is the main pattern in use for web services
Mostly for stateless services, but can be used for stateful services, too (although that violates its core principles).
Much less complex than SOAP
Supported in Java, .NET, JavaScript, Ruby, Python, etc.
Native code developers on Windows can use OSS libraries or complex Win32 C APIs
CasablancaREST
DemoHello World
http_client client(L"http://localhost/helloworld");
http_response response = client.request(methods::GET).get();
std::wstring response_string = response.extract_string().get();
Microsoft Confidential.
Text-based serialization format
Based on JavaScript
CasablancaJSON
JSON has become the de facto standard for serializing data for REST services
Much less complex than XML
Supported by most language environments on the Web
Microsoft Confidential.
BlobsSimple, file-like, storage
Azure StorageBlobs, Tables, Queues
TablesNon-relational table storage
QueuesSmall (64KB) messages queued persistently in the cloud
Cloud-based storagePersistent, redundant, available everywhere (client, on-premise server, cloud)
DemoGuest Book
DemoVideo Streaming
DemoImage Stitcher
Microsoft Confidential.
CasablancaAzure Integration
Casablanca is focusing on providing the following native-code integration points out-of-the box:
VS template(s) for building Azure projects in C++
Library bindings for Azure storage, service bus, and service runtime
Azure hosting in both web roles and worker roles
Microsoft Confidential.
We’re also providing capabilities for building on-premise services in C++:
CasablancaOn-premise
Integration with IIS
A stand-alone host (console executable, not NT service)
Microsoft Confidential.
Download binaries, samples, and documentation at
http://msdn.microsoft.com/en-us/devlabs/casablanca.aspx
CasablancaMore Information
Forum
http://social.msdn.microsoft.com/Forums/en-US/casablanca/threads
Questions
Release Timeframe
Open source this fall, client side supported release end 2012/early 2013
© 2012 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.
Microsoft Confidential.
Requires C++11 support for lambdas and move semantics
CasablancaC++ Actors
C++ library based on Erlang concepts
Actors
Message-passing
Failure-resistant pattern support