Erlang and the Cloud

C20f7f4a8aa455aa6e0c2a0092883cd0?s=47 Roberto Aloi
November 17, 2012

Erlang and the Cloud

In the era of multicore and cloud computing, the only limit for your application is the sky. But for your application to be able to exploit all of this potential, it needs to be designed in a manner that scales. In this talk we discuss the suitability of the Erlang programming language for scenarios such as cloud computing and multicore, explaining how the concurrency model of Erlang maps to multicore architectures and what principles should be kept in mind when designing a scalable application.

C20f7f4a8aa455aa6e0c2a0092883cd0?s=128

Roberto Aloi

November 17, 2012
Tweet

Transcript

  1. 3.
  2. 6.
  3. 7.

    Definitions of Scalability “Property of a system that can accommodate

    changes in transaction volume without major changes to the system [...] A scalable system can be downsized as easily as it can grow” Barron's Marketing Dictionary “The ability of a system, network, or process, to handle a growing amount of work in a capable manner” André B. Bondi, 2000
  4. 9.

    “The ability for a business or technology to accept increased

    volume without impacting the contribution margin” Wikipedia Alternative definition of Scalability Contribution Margin = Marginal Profit per Unit Sale
  5. 18.

    - TONS OF PROCESSES - EXECUTING SIMULTANEOUSLY - REACTING TO

    EVENTS - PERFORMING SMALL COMPUTATIONS
  6. 19.

    Processes need to be easy to create and destroy. Context

    switch needs to be a cheap operation.
  7. 21.

    - FAIL IS UNAVOIDABLE - FAIL FAST - AVOID PROPAGATION

    OF FAILURES - RECOVER FROM FAILURE
  8. 25.

    - HAVE IMMUTABLE DATA - USE PURE FUNCTIONS - NO

    SIDE EFFECTS - REFERENTIAL TRANSPARENCY
  9. 30.

    IMMUTABILITY SCALABILITY 101 LARGE SCALE CONCURRENCY ASYNCHRONOUS COMMUNICATION RELIABILITY PREDICTABILITY

    DECOUPLING PROCESS ISOLATION FAULT ISOLATION NO SHARED MEMORY SYNCHRONIZATION RACE CONDITIONS EVENTUAL CONSISTENCY CAP THEOREM SMP MULTICORE CLOUD COMPUTING DECENTRALIZATION OF DATA MAINTENANCE NO DOWN TIME
  10. 33.

    • OPEN SOURCE • CONCURRENCY-ORIENTED • LIGHTWEIGHT PROCESSES (10.000 PER

    CORE) • ASYNCHRONOUS MESSAGE PASSING • SHARE-NOTHING MODEL • PROCESS LINKING / MONITORING • SUPERVISION TREES AND RECOVERY STRATEGIES • TRANSPARENT DISTRIBUTION MODEL • SOFT-REAL TIME • LET-IT-FAIL PHILOSOPHY • HOT-CODE UPGRADES WHAT IS ERLANG DOES IT SOUND FAMILIAR?
  11. 40.

    Let It Crash convert(Day) -> case Day of monday ->

    1; tuesday -> 2; wednesday -> 3; thursday -> 4; friday -> 5; saturday -> 6; sunday -> 7; Other -> {error, unknown_day} end.
  12. 41.

    Let It Crash convert(Day) -> case Day of monday ->

    1; tuesday -> 2; wednesday -> 3; thursday -> 4; friday -> 5; saturday -> 6; sunday -> 7; end.
  13. 52.

    SEND A MESSAGE TO A PROCESS Pid2 Pid1 Pid2 !

    {self(), msg} Message Passing
  14. 53.

    SEND A MESSAGE TO A PROCESS Pid2 Pid1 Pid2 !

    {self(), msg} {Pid1, msg} Message Passing
  15. 55.
  16. 58.

    RELEASE STATEMENT OF AIMS “To scale the radical concurrency-oriented programming

    paradigm to build reliable general-purpose software, such as server- based systems, on massively parallel machines (10^5 cores).”
  17. 59.

    WP4 Scalable Infrastructure WP3 SD Erlang Language WP2 Virtual Machine

    WP5 Tools WP6 Case Studies LIMITATIONS ARE PRESENT AT THREE LEVELS
  18. 60.

    • PUSH THE RESPONSIBILITY FOR SCALABILITY FROM THE PROGRAMMER TO

    THE VM • ANALYZE PERFORMANCE AND SCALABILITY • IDENTIFY BOTTLENECKS AND PRIORITIZE CHANGES AND EXTENSIONS • TACKLE WELL-KNOWN SCALABILITY ISSUES • ETS TABLES (SHARED GLOBAL DATA STRUCTURE) • MESSAGE PASSING, COPYING AND FREQUENTLY COMMUNICATING PROCESSES VM LANGUAGE INFRASTRUCTURE
  19. 61.

    VM LANGUAGE INFRASTRUCTURE • TWO MAJOR ISSUES • FULLY CONNECTED

    CLUSTERS • EXPLICIT PROCESS PLACEMENT • SCALABLE DISTRIBUTED (SD) ERLANG • NODES GROUPING • NON-TRANSITIVE CONNECTIONS • IMPLICIT PROCESS PLACEMENT • PART OF THE STANDARD ERLANG/OTP PACKAGE • NEW CONCEPTS INTRODUCED • LOCALITY, AFFINITY AND DISTANCE
  20. 62.

    • MIDDLEWARE LAYER • SET OF ERLANG APPLICATIONS • CREATE

    AND MANAGE CLUSTERS OF (HETEROGENEOUS) ERLANG NODES • API TO MONITOR AND CONTROL ERLANG DISTRIBUTED SYSTEMS • EXISTING TRACING/LOGGING/DEBUGGING TOOLS PLUGGABLE • BROKER LAYER BETWEEN USERS AND CLOUD PROVIDERS • AUTO-SCALING VM LANGUAGE INFRASTRUCTURE CCL /sɪˈsɪlɪ/ ... AND MUCH MORE
  21. 63.
  22. 64.
  23. 68.
  24. 71.

    erlang.org github.com/erlang/otp erlang-solutions.com www.learnyousomeerlang.org elearning.erlang-solutions.com Erlang Programming Erlang and OTP

    in Action Official Home Page Sources Binary Packages, News, Events Best Online Tutorial Commercial e-learning solution Best book about Erlang Best book about OTP