1 / 45

Embrace the cloud

Embrace the cloud. Programming for the cloud. Outline. About us Cloud computing challenges Current cloud computing practices M-Brace overview Programming with M-Brace Code examples Concluding remarks. About us. George Stavroulakis Executive consultant at Nessos IT S.A.

minowa
Télécharger la présentation

Embrace the cloud

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Embrace the cloud Programming for the cloud

  2. Outline • About us • Cloud computing challenges • Current cloud computing practices • M-Brace overview • Programming with M-Brace • Code examples • Concluding remarks

  3. About us • George Stavroulakis • Executive consultant at Nessos IT S.A. • Ph.D student at NTUA in HPC and FEM • M-Brace testing, quality assurance and project management • GianNtzik • R&D assistant developer at Nessos IT S.A. • Ph.D student at Imperial College in Program Reasoning and Verification • M-Brace development

  4. About Nessos IT S.A. • ISV company active in custom software development • Technology specialization • Microsoft .NET framework and F# • Silverlight • NHibernate • Business specialization • Business process management • GIS • Application framework development

  5. Cloud computing challenges The world then… • Single core • Global memory • Single node • Sequential code

  6. Cloud computing challenges The world then… • Upfront investments in hardware • Scale up • Code performance is irrelevant to running costs • Programs speed-up with increase of CPU clock speed

  7. Cloud computing challenges The world now… • Multi-core • Distributed memory • Multi node • Parallel code

  8. Cloud computing challenges The world now… • Ad-hoc elasticity demands with respect to current needs • Scale out • Code performance directly affects costs • “The free lunch is over”

  9. Cloud computing • Cloud providers: Microsoft Azure, Amazon EC2, … • Reduces infrastructure costs • Allocate as many machines you need. All you need is a credit card. • Challenges: • Different programming model • Machine failure • Code maintenance - versioning • Performance: The cloud equates performance to money

  10. Cloud computing • Different programming model – Distributed computing • Message Passing • Today’s best practices / patterns • Map – reduce • Distributed agents

  11. Map - Reduce Input Files Output Files Reduce phase Map phase Reduce phase Map phase Computation Intermediate results file

  12. Map reduce • Programming Primitives • Map function • Reduce function • Limited applicability • Concerns beyond the program’s function • Partition function – hashing • Input – output: key-values, read/write from (distributed) file system • NOT proper map / reduce function semantics • map/reduce are higher order function with a standard signature • map: (‘T -> ‘U) -> seq<‘T> -> seq<‘U> • reduce: (‘T -> ‘T -> ‘T) -> seq<‘T> -> ‘T

  13. Distributed Agents • Message Passing • Agents accept messages -> perform computations -> modify state Agent Agent Agent Agent Agent Agent Agent Agent Agent Agent Agent Agent

  14. Distributed Agents • Challenges • Express computation workflows => FSM • Deployment, Monitoring • Fault tolerance Agent Agent Agent Agent Agent Agent Agent Agent Agent Agent Agent Agent

  15. Distributed Agents • Application logic is broken to many pieces • Considerations beyond application’s function • Messages • Agent granularity • Fault tolerance: reapplication of state • Code noise • Code maintenance • Updating • Debugging

  16. M-Brace overview What is M-Brace? • Software stack comprised of: • Framework with libraries, tools and patterns • Runtime for deploying, running and managing cloud apps • Based on the .NET framework • Leverages the power of the F# language Embrace the cloud

  17. M-Brace overview What is NOT M-Brace? • Just an API or another library • A new language • A compiler-specific language extension (like PG-Fortran) • Just a set of tools or in need of 3rd party tools Embrace the cloud

  18. M-Brace overview Distributed computations Distributed data Messaging

  19. Cloud programming with M-Brace • Building blocks for cloud-based distributed computations • Cloud Monad: cloud { … } • F# computation expressions • Similar to Asynchronous Workflows (Async Monad)

  20. F# Monads – e.g. Async Workflows let getWebResponse (url: string) = async { let request = WebRequest.Create(url) let! response = req.AsyncGetResponse() return response.GetResponseStream() } WebRequest.AsyncGetResponse: unit -> Async<WebResponse> • getWebResponse : string -> Async<Stream> let stream = getWebResponse "http://www.m-brace.net" |> Async.RunSynchronously

  21. F# Async Workflows • .NET Thread Pool Thread Pool Active Thread SuspendedThread Task

  22. F# Async Workflows let getWebResponse (url: string) = async { let request = WebRequest.Create(url) let! response = req.AsyncGetResponse() return response.GetResponseStream() } 1 • getWebResponse() is executed in as a thread pool task

  23. F# Async Workflows let getWebResponse (url: string) = async { let request = WebRequest.Create(url) let! response = req.AsyncGetResponse() return response.GetResponseStream() } 1 2 • async { … } of getWebResponse() is executed as a thread pool task • async { … } of AsyncGetResponse() is executed as a thread pool task. The outer async { … } is suspended until the result is available.

  24. F# Async Workflows let getWebResponse (url: string) = async { let request = WebRequest.Create(url) let!response = req.AsyncGetResponse() return response.GetResponseStream() } 1 3 2 • async { … } of getWebResponse() is executed as a thread pool task • async { … } of AsyncGetResponse() is executed as a thread pool task. The outer async { … } is suspended until the result is available. • The result is bound to response and the async { … } continues.

  25. Cloud Monad • cloud { … } • Programming primitive • Unit of distribution, execution & scheduling • Anything inside cloud { … } will be executed (somewhere) in the Cloud • Composition (monadic) • Sequential • Parallel

  26. Cloud Monad • Somewhere in the cloud, Deep Though will compute the answer • The function does not return a value, but a computation let askDeepThought () = cloud { return “42” } askDeepThought: unit -> ICloud<string>

  27. Cloud Monad • RunRemoteSynchronously() sends the quotation to the runtime for execution. • askDeepThought() will be executed somewhere in the runtime’s cloud based worker pool. [<Cloud>] let askDeepThought () = cloud { return “42” } let answer = Cloud.RunRemoteSynchronously <@ askDeepThought() @>

  28. Cloud Monad [<Cloud>] let askDeepThought () = cloud { return “42” } let answer = Cloud.RunRemoteSynchronously <@ askDeepThought() @> Cloud storage code+state code+state Workers Workers M-Brace runtime

  29. Cloud Monad - Composition [<Cloud>] let askDeepThought () = cloud { return “42” } [<Cloud>] let getUltimateQuestionAnswer () = cloud { let! firstTime = askDeepThought () let! secondTime = askDeepThought () return sprintf “%s and %s !” firstTimesecondTime } let result = Cloud.RunRemoteSynchronously <@ getUltimateQuestionAnswer() @>

  30. Cloud Monad - Composition • getUltimateQuestionAnswer() begins execution in some worker let askDeepThought () = cloud { return “42” } let getUltimateQuestionAnswer () = cloud { let! firstTime = askDeepThought () let! secondTime = askDeepThought () return sprintf “%s and %s !” firstTimesecondTime } 1

  31. Cloud Monad - Composition • on let!,askDeepThought() begins execution (in some other worker) • Execution of getUltimateQuestionAnswer() is suspended until the result is received let askDeepThought () = cloud { return “42” } let getUltimateQuestionAnswer () = cloud { let!firstTime = askDeepThought() let! secondTime = askDeepThought () return sprintf “%s and %s !” firstTimesecondTime } 1 2

  32. Cloud Monad - Composition • The returned result is bound to firstTime • The rest of computation continues (until the second let!) 2 let askDeepThought () = cloud {return “42” } let getUltimateQuestionAnswer () = cloud { let!firstTime= askDeepThought() let! secondTime = askDeepThought () return sprintf “%s and %s !” firstTimesecondTime } 1 3

  33. Cloud Monad – Parallel Composition let pDeepThought () = cloud { let! (first, second) = askDeepThought() <||>askDeepThought() return sprintf “%s and %s !” first second } (<||>) : ICloud<‘T> -> ICloud<‘U> -> ICloud<‘T * ‘U> let pDeepThought () = cloud { let! results = Cloud.Parallel [| askDeepThought(); askDeepThought() |] return sprintf “%s and %s !” (results.[0]) (results.[1]) } Cloud.Parallel: ICloud<‘T> [] -> ICloud<‘T[]>

  34. Demo • A data mining example: Count word occurrences in the work of Shakespeare • Use a distributed map – reduce • map: download text and tokenize to words • reduce: count occurrences of each word • Power of cloud { } composition: • We can define a higher order cloud { } map – reduce combinator

  35. Demo – Distributed mapReduce Splits a list in two halves Cloud-parallel combinator

  36. Some code Mapping: Download files and count words Download text from web string -> ICloud<(string*int) list>

  37. Some code Reduction: Collapse lists and aggregate (string*int) list -> (string*int) list -> ICloud<(string*int) list>

  38. M-Brace – Key Points The M-Brace framework • Easy and transparent cloud programming • Single-source code authoring • Unification of distributed and shared memory paradigms • Single node execution and debugging

  39. M-Brace – Key Points The M-Brace runtime • Process and data flow orchestration between nodes • Constant supervision and monitoring • Process execution • Node environment state • Resource allocation and usage • per node (CPU, network, etc.) • Automated distribution of code • and state upon failure

  40. M-Brace – Key Points Why M-Brace? • Distribution and orchestration has compositional properties, based on computation expressions • Conceptual model is simple • Lightweight and transparent • Underlying cloud services are abstracted • Based on managed code • Solely based on F# concepts and architecture • No 3rd party frameworks or tools needed

  41. M-Brace overview Uses and applications • High performance computing • Simulation and engineering • Computational finance • Bio-engineering • Weather forecasting • DSP and imaging

  42. M-Brace overview Uses and applications • Map-reduce algorithms • Data mining and large data manipulation • Web crawling and graph traversal • Document clustering and inverted index building • Large-scale web applications • Social networks and large e-shops • Messaging systems

  43. M-Brace: The present • Distributed computations • Exception management • Fault tolerance • Local testing and debugging • Windows Azure implementation

  44. M-Brace: The future • Distributed data • Messaging • Hot code swapping • On-demand tracing and logging • Distributed computation run-time optimizations • Support for more cloud platforms

  45. M-Brace: The needs • Opinions and feedback from the F# community • Usage and testing on real-life scenarios • Funding and/or investors to: • Accelerate development • Expand and specialize to the needs of specific markets www.m-brace.net

More Related