SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Productivity Gains in Erlang
A Heriot-Watt and Motorola Production

           Jan Henry Nyström
           jann@macs.hw.ac.uk   jan@erlang-consulting.com
                                              Phil Trinder
                                   trinder@macs.hw.ac.uk
                                               David King
                                 david.king@praxis-his.com
Project
• High-Level Techniques for Distributed Telecoms Software
• EPSRC (UK Govt) Project, Dec 2002 – Feb 2006
• Collaboration between
    Motorola UK Labs
    Heriot-Watt University




Erlongue Paris          Productivity Gains in Erlang        2
Project
• High-Level Techniques for Distributed Telecoms Software
• EPSRC (UK Govt) Project, Dec 2002 – Feb 2006
• Collaboration between
    Motorola UK Labs
    Heriot-Watt University
• Aim: Produce scientific evidence that high-level distributed
  languages like Erlang or Glasgow distributed Haskell (GdH)
  can improve distributed software robustness and
  productivity.




Erlongue Paris           Productivity Gains in Erlang            3
Erlang Comparisons
• A number of sequential comparisons
    Computer Language Shootout
• Very few distributed system comparisons published!

• Ulf Wiger [Wiger01] reports
    Erlang systems have between 4 and 10 times less code
      than C/C++/Java/PLEX systems
    Similar error rates/line of code, similar productivity rates
    No direct comparative measurements




Erlongue Paris            Productivity Gains in Erlang              4
Research Questions: Potential Benefits
•   RQ1: Can robust, configurable systems be readily developed?
•   Resilience to extreme loads
•   Availability in the face of hardware & software failures
•   Dynamic reconfigurability on available hardware

• RQ2: Can productivity and maintainability be improved?
• How do the sizes of the C++ and Erlang components compare &
  what language features contribute to size differential?




Erlongue Paris             Productivity Gains in Erlang           5
Research Questions: Feasibility

High-level distributed languages:

• Abrogate control of low-level coordination aspects, so
   ●
     RQ3: can the required functionality be specified?
• typically pay space and time penalties for their automatic
  coordination management.
   ●
     RQ4: can acceptable performance be achieved?
• RQ5: What are the costs of interoperating with conventional
  technology?
• RQ6: Is the technology practical?




Erlongue Paris             Productivity Gains in Erlang         6
Research Strategy

• Reengineer telecoms applications in GdH and Erlang
    Dispatch Call Controller [NTK04,NTK05]
    Data Mobility component
• Compare high-level and Java/C++ implementations for
    Performance
    Robustness
    Productivity
    Impact of programming language constructs




Erlongue Paris         Productivity Gains in Erlang     7
Data Mobility Component (DM)
First Product Application

•   Communicates with Motorola mobile devices
•   3000 lines of C++
•   Uses 18,000 lines of Motorola C library functions
•   Has a transmitter, a receiver and 2 message types
•   Interacts with 5 other components of the system




Erlongue Paris             Productivity Gains in Erlang   8
Despatch Call Controller (DCC)
Second Application

• Handles mobile phone calls
• A process manages each call
• Scalable with multiple servers




Erlongue Paris            Productivity Gains in Erlang   9
Two Erlang DM Implementations

1. Pure Erlang DM

2. Erlang / C DM
    Reuses some C DM libraries & drivers

• Both interoperate with a test harness
• Combines
  • Unix Processes
  • Erlang processes
  • C Threads (Erlang/C DM)




Erlongue Paris            Productivity Gains in Erlang   10
RQ3 Performance 1: Throughput
     Platform: 167MHz, 128Mb Sun Ultra 1, SunOS 5.8

            C++ DM          Erlang/C DM                       Pure Erlang DM

                  480                 230                            940




    • Maximum DM Throughput at 100% QoS
    • Pure Erlang DM is twice as fast as C++ DM
             Better process management and marshalling

    • Erlang/C DM is ½ speed of C++ DM
             Still meets nominal throughput

Erlongue Paris                 Productivity Gains in Erlang                    11
RQ3 Performance 2: Roundtrip Times
                             C++ DM     Erlang/C DM            Pure Erlang DM

          7
          6
          5
          4
ms
          3
          2
          1
          0
                   Query type 1              Query type 2                Broken query

     • Pure Erlang is approximately 3 times faster
     • Erlang/C is 26% - 50% slower

Erlongue Paris                        Productivity Gains in Erlang                      12
Performance Analysis
• Pure Erlang DM is faster due to fast lightweight process
  management
• Erlang/C is slower due to additional communication to C
  components




Erlongue Paris          Productivity Gains in Erlang         13
Performance 3: Memory Residence
                    ERTS    Moto C lib       App C/C++             App Erlang

                  7000
                  6000
                  5000
                  4000
             Kb




                  3000
                  2000
                  1000
                    0
                           C++ DM         Erlang/C DM              Erlang DM

     • Erlang DMs use 170% more memory
     • Erlang runtime sys (ERTS) has a fixed size
          Would be a smaller % of a larger application

Erlongue Paris                      Productivity Gains in Erlang                14
RQ1 Robustness 1: Resilience

Throughput
                                    Erlang A       C++ A         Pure Erlang A
(queries/s)
     1200
         1000
          800
          600
          400
          200
              0
                                        00

                                        00

                                        00

                                        00
                    0




                                         0




                                         0

                                         0

                                                                               0




                                                                                           0
                          0

                                0




                                                                                     0
                  24




                                       94




                                                                                         24
                        31

                              48




                                                                            48

                                                                                   31
                                      00

                                      00
                                     47

                                     94
                                     14

                                     19




                                    16

                                    25
                                               Load (queries/s)




 Erlongue Paris                       Productivity Gains in Erlang                             15
RQ1 Robustness 1: Resilience

When overloaded:

• C++ DM fails catastrophically
• Pure Erlang & Erlang/C DMs:
• Throughput degrades
    Never completely fails
    Handling 48 q/s at peak load (25000q/s)
    Recovers automatically after load drops




Erlongue Paris            Productivity Gains in Erlang   16
DCC Resilience




Erlongue Paris     Productivity Gains in Erlang   17
Robustness 2: Availability


Erlang DCC system:

• Remains available despite
  repeated hardware and
  software failures
• Performance doesn’t
  degrade with repeated
  failures



                              DCC Throughput with Repeated Failures


 Erlongue Paris           Productivity Gains in Erlang         18
Robustness 2: Availability


Erlang DCC system:

• Resists the simultaneous
  failure of multiple components
• When more components fail
  throughput drops lower &
  recovery takes longer




                                       5-processor DCC with Multiple Failures


 Erlongue Paris            Productivity Gains in Erlang                  19
Robustness 3: Dynamic Configurability


Erlang DCC system:

• Dynamically adapt to the
  available hardware resources
• 5 processor system
  Remove a processor 4 times
  Add a processor 4 times




                                                         DCC Throughput
                                        with Varying Numbers of Processors

 Erlongue Paris           Productivity Gains in Erlang                    20
RQ2: Productivity & Maintainability

•    Shorter programs are
•    Faster to develop
•    Contain fewer errors [Wiger01]
•    Easier to maintain

• The metric we use is Source Lines Of Code (SLOC)




Erlongue Paris               Productivity Gains in Erlang   21
Productivity: Source Code Sizes
Lang.            C/C++   Erlang   Total            Lang.          C++     IDL   Erlang   Total


C++              3101             3101             C++            14.8K   83             14.9K


Erl./C           247     616      863              Erlang                       4882     4882


Erlang                   398      398
                                                                  DCC Implementations

         DM Implementations




• Erlang DCC & DM are less than 1/3rd of size of C++ version
• Consistent with Wiger & folklore


Erlongue Paris                          Productivity Gains in Erlang                        22
Productivity: DM Source Code Sizes
                                     C++/C         Erlang

                 3500
                 3000
                 2500
                 2000
                 1500
                 1000
                 500
                   0
                        C++ DM        Erlang/C DM               Pure Erlang DM


• Erlang/C DM is 1/3rd of the size of the C++ DM
• Pure Erlang DM is 1/7th of the size of the C++ DM
• Erlang/C DM is 1/18th of the size of the C++ DM + libraries


Erlongue Paris                   Productivity Gains in Erlang                    23
Reasons for difference in Code Size

• Erlang programmers can
    Rely on fault tolerance and code for the successful case
    27% of C++ DM code is defensive
• And have to their use
    Automatic memory management (11% of C++ DM code)
    High-level communication (23% of C++ DM code)
    Telecom design pattern libraries




Erlongue Paris               Productivity Gains in Erlang   24
DM Code Breakdown

100%
 90%
                                                                  Defensive
 80%
                                                                  Defines
 70%
                                                                  Includes
 60%
                                                                  Type Delcarations
 50%
                                                                  Communication
 40%
                                                                  Memory Management
 30%
                                                                  Process Management
 20%
                                                                  App
 10%
  0%
                 C++ A   Moto Clib Erlang/C              Erlang

Erlongue Paris                     Productivity Gains in Erlang                  25
Code Difference Example
void DataMobilityRxProcessor::processUnsupVer(void)
{
    MSG_PTR          msg_buf_ptr;
    MM_DEVICE_INFO_MSG *msg_ptr;
    RETURN_STATUS        ret_status;
    UINT16          msg_size;
                                                       C++
    // Determine size of ici message
    msg_size = sizeof( MM_DEVICE_INFO_MSG);


    // Create ICI message object to send to DMTX so it sends a Device Info
    // message to VLR and HLR clients
    IciMsg ici_msg_object( MM_DEVICE_INFO_OPC, ICI_DMTX_TASK_ID, msg_size);


    // Retrieve ICI message buffer pointer
                                                                                                       Erlang
                                                                                                 sz_dme_dmtx:cast(device_info)
    msg_buf_ptr = ici_msg_object.getIciMsgBufPtr();


    // Typecast pointer from (void *) to (MM_DEVICE_INFO_MSG *)
    msg_ptr = (MM_DEVICE_INFO_MSG *)msg_buf_ptr;



    // Populate message buffer
    SET_MM_DEVICE_INFO_DEVICE_TYPE( msg_ptr, SERVER);
    SET_MM_DEVICE_INFO_NUM_VER_SUPPORTED( msg_ptr, NUM_VER_SUPPORTED);
    SET_MM_DEVICE_INFO_FIRST_SUP_PROTO_VERS( msg_ptr, PROTO_VERSION_ONE);



// Send message to the DMTX task
   ret_status = m_ici_io_ptr->send(&ici_msg_object);

    // Check that message was sent successfully
    if (ret_status != SUCCESS)
    {
        // Report problem when sending ICI message
        sz_err_msg( MAJOR, SZ_ERR_MSG_ERR_OPCODE, __FILE__, __LINE__,
                "DataMobilityRxProcessor processUnsupVer: failure sending "
                " device info message to DMTX");
    }


Erlongue Paris                                                    Productivity Gains in Erlang                                   26
Erlang DCC Reusability

        Part                SLOC                     No. Modules        Percentage

        Reusable                   2994                         26           61%
        Platform

        Specific Services          147                              1         3%


        Testing &                  1741                         11           36%
        Statistics




•Considerable potential for reuse



Erlongue Paris                       Productivity Gains in Erlang                    27
Summary


• Investigated high-level distributed language technology for
  telecoms software

• Reengineered two telecoms components in Erlang

• Measured & compared the Erlang & C++ components




 Erlongue Paris            Productivity Gains in Erlang         28
RQ1:Robust and Configurable Systems
• Improved resilience:
    Erlang DM and DCC sustain throughput at extreme loads
    Automatically recover when load drops
    C++ DM fails catastrophically (predict C++/CORBA DCC
     would)
• Improved availability:
    Erlang DCC recovers from repeated & multiple failures
    Predict C++/CORBA DCC would fail catastrophically
• Dynamic Reconfiguration
    Erlang DCC can be dynamically reconfigured to available
     hardware
    C++/CORBA DCC can also be dynamically reconfigured
     using CORBA
• Potential for hot-code loading (not demonstrated)


 Erlongue Paris                Productivity Gains in Erlang    29
RQ2:Productivity and Maintainability
• Erlang DM and DCC:
    Less than 1/3rd size of C++ implementation
    Erlang DM 1/18th size of C++ DM with libraries
    Good reusability
• Reasons:
    Code for successful case – saves 27%
    Automatic memory management – saves 11%
    High-level communications – saves 23%
    Telecom design pattern libraries




 Erlongue Paris                Productivity Gains in Erlang   30
Distributed Functionality

• Even though Erlang abstracts over low-level coordination, the
  required DM and DCC functionality is readily specified.




 Erlongue Paris           Productivity Gains in Erlang            31
RQ4: Performance
Time:
• Max. throughput at 100% QoS:
    Pure Erlang DM is twice as fast as C++ DM
    Erlang/C is ½ as fast as C++ DM , but still exceeds
     throughput requirements
• Roundtrip times
    Pure Erlang DM is three times as fast as C++ DM
    Erlang/C is between 26% and 50% slower as C++ DM
Space:
• Pure Erlang and Erlang/C both have 170% greater memory
  residency due to (fixed size) 5Mb runtime system




 Erlongue Paris         Productivity Gains in Erlang       32
RQ5: Interoperation Costs
• Erlang DMs interoperate with a C test harness, and Erlang/C
  DM incorporates C drivers & library functions
• Costs
    Low space cost: an additional 15% residency
    High time cost:
      •Erlang/C roundtrip times up to 6 times pure Erlang
      •Erlang/C max. throughput ¼ of pure Erlang
• Potential for incremental re-engineering of large systems




 Erlongue Paris           Productivity Gains in Erlang          33
RQ6: Pragmatics
• Erlang is available on several HW/OS platforms, including the
  Sun/Solaris DM product platform
• Is supported with training, consultancy, libraries etc.




 Erlongue Paris           Productivity Gains in Erlang            34
Conclusions

• Erlang offers robustness & productivity benefits for
  distributed telecoms software (RQs 1 & 2)

• High-level distributed languages like Erlang can deliver the
  required telecoms functionality and performance (RQs 3 & 4)

• Erlang can interoperate with existing technologies and meets
  pragmatic requirements (RQs 5 and 6)




 Erlongue Paris            Productivity Gains in Erlang          35
Further Information
•   Web sites/Seminars
     Project Site: www.macs.hw.ac.uk/~dsg/telecoms/
•   References
     [NTK04] Nystrom J.H. Trinder P.W. King D.J. Evaluating
      Erlang for Robust
     Telecoms Software S3S’04, Chicago, July 2004.
     [NTK05] Nystrom J.H. Trinder P.W. King D.J. Are High-
      Level languages suitable for
     Robust Telecoms Software? SafeComp’05, Fredrikstad,
      Norway, Sept. 2005.
     [Wiger01] Ulf Wiger, Workshop on Formal Design of Safety
      Critical Embedded
     Systems, Munich, March 2001
      http://www.erlang.se/publications/Ulf_Wiger.pdf




    Erlongue Paris         Productivity Gains in Erlang          36

Weitere ähnliche Inhalte

Ähnlich wie Productivity Gains in Erlang

Smart line level transmitter sales presentation
Smart line level transmitter   sales presentationSmart line level transmitter   sales presentation
Smart line level transmitter sales presentationPavel Buček
 
Fundamentals of Modern Embedded Systems
Fundamentals of Modern Embedded SystemsFundamentals of Modern Embedded Systems
Fundamentals of Modern Embedded Systemseselab
 
DTMF based Home Applicance System
DTMF based Home Applicance SystemDTMF based Home Applicance System
DTMF based Home Applicance SystemDaksh Raj Chopra
 
Corporate Presentation India
Corporate Presentation IndiaCorporate Presentation India
Corporate Presentation Indiakrishnan_2
 
Corporate Presentation India
Corporate Presentation IndiaCorporate Presentation India
Corporate Presentation Indiakrishnan_2
 
programmable logic controller presentation
programmable logic controller presentationprogrammable logic controller presentation
programmable logic controller presentationAshutosh Verma
 
Comparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms SoftwareComparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms Softwarel xf
 
smalltalk numbercrunching
smalltalk numbercrunchingsmalltalk numbercrunching
smalltalk numbercrunchingDaniel Poon
 
PyMADlib - A Python wrapper for MADlib : in-database, parallel, machine learn...
PyMADlib - A Python wrapper for MADlib : in-database, parallel, machine learn...PyMADlib - A Python wrapper for MADlib : in-database, parallel, machine learn...
PyMADlib - A Python wrapper for MADlib : in-database, parallel, machine learn...Srivatsan Ramanujam
 
Advanced methods for robotic machining of hard materials
Advanced methods for robotic machining of hard materialsAdvanced methods for robotic machining of hard materials
Advanced methods for robotic machining of hard materialsStan Pastukhov
 
TYPHOON HIL - Product Catalog-.pdf
TYPHOON HIL - Product Catalog-.pdfTYPHOON HIL - Product Catalog-.pdf
TYPHOON HIL - Product Catalog-.pdfShababZehraRizvi
 
Concurrency And Erlang
Concurrency And ErlangConcurrency And Erlang
Concurrency And Erlangl xf
 
How we scale up our architecture and organization at Dailymotion
How we scale up our architecture and organization at DailymotionHow we scale up our architecture and organization at Dailymotion
How we scale up our architecture and organization at DailymotionStanislas Chollet
 
Pic18 f4520 and robotics
Pic18 f4520 and roboticsPic18 f4520 and robotics
Pic18 f4520 and roboticsSiddhant Chopra
 
Cray HPC Environments for Leading Edge Simulations
Cray HPC Environments for Leading Edge SimulationsCray HPC Environments for Leading Edge Simulations
Cray HPC Environments for Leading Edge Simulationsinside-BigData.com
 

Ähnlich wie Productivity Gains in Erlang (20)

Smart line level transmitter sales presentation
Smart line level transmitter   sales presentationSmart line level transmitter   sales presentation
Smart line level transmitter sales presentation
 
Fundamentals of Modern Embedded Systems
Fundamentals of Modern Embedded SystemsFundamentals of Modern Embedded Systems
Fundamentals of Modern Embedded Systems
 
DTMF based Home Applicance System
DTMF based Home Applicance SystemDTMF based Home Applicance System
DTMF based Home Applicance System
 
Corporate Presentation India
Corporate Presentation IndiaCorporate Presentation India
Corporate Presentation India
 
Corporate Presentation India
Corporate Presentation IndiaCorporate Presentation India
Corporate Presentation India
 
RNA presentation 2017/2018
RNA presentation 2017/2018RNA presentation 2017/2018
RNA presentation 2017/2018
 
programmable logic controller presentation
programmable logic controller presentationprogrammable logic controller presentation
programmable logic controller presentation
 
Comparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms SoftwareComparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms Software
 
smalltalk numbercrunching
smalltalk numbercrunchingsmalltalk numbercrunching
smalltalk numbercrunching
 
Eldo_Premier_2015
Eldo_Premier_2015Eldo_Premier_2015
Eldo_Premier_2015
 
PyMADlib - A Python wrapper for MADlib : in-database, parallel, machine learn...
PyMADlib - A Python wrapper for MADlib : in-database, parallel, machine learn...PyMADlib - A Python wrapper for MADlib : in-database, parallel, machine learn...
PyMADlib - A Python wrapper for MADlib : in-database, parallel, machine learn...
 
Tech brochure
Tech brochureTech brochure
Tech brochure
 
Robotics technical Presentation
Robotics technical PresentationRobotics technical Presentation
Robotics technical Presentation
 
Advanced methods for robotic machining of hard materials
Advanced methods for robotic machining of hard materialsAdvanced methods for robotic machining of hard materials
Advanced methods for robotic machining of hard materials
 
TYPHOON HIL - Product Catalog-.pdf
TYPHOON HIL - Product Catalog-.pdfTYPHOON HIL - Product Catalog-.pdf
TYPHOON HIL - Product Catalog-.pdf
 
RNA Presentation 2015
RNA Presentation 2015RNA Presentation 2015
RNA Presentation 2015
 
Concurrency And Erlang
Concurrency And ErlangConcurrency And Erlang
Concurrency And Erlang
 
How we scale up our architecture and organization at Dailymotion
How we scale up our architecture and organization at DailymotionHow we scale up our architecture and organization at Dailymotion
How we scale up our architecture and organization at Dailymotion
 
Pic18 f4520 and robotics
Pic18 f4520 and roboticsPic18 f4520 and robotics
Pic18 f4520 and robotics
 
Cray HPC Environments for Leading Edge Simulations
Cray HPC Environments for Leading Edge SimulationsCray HPC Environments for Leading Edge Simulations
Cray HPC Environments for Leading Edge Simulations
 

Kürzlich hochgeladen

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Kürzlich hochgeladen (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

Productivity Gains in Erlang

  • 1. Productivity Gains in Erlang A Heriot-Watt and Motorola Production Jan Henry Nyström jann@macs.hw.ac.uk jan@erlang-consulting.com Phil Trinder trinder@macs.hw.ac.uk David King david.king@praxis-his.com
  • 2. Project • High-Level Techniques for Distributed Telecoms Software • EPSRC (UK Govt) Project, Dec 2002 – Feb 2006 • Collaboration between  Motorola UK Labs  Heriot-Watt University Erlongue Paris Productivity Gains in Erlang 2
  • 3. Project • High-Level Techniques for Distributed Telecoms Software • EPSRC (UK Govt) Project, Dec 2002 – Feb 2006 • Collaboration between  Motorola UK Labs  Heriot-Watt University • Aim: Produce scientific evidence that high-level distributed languages like Erlang or Glasgow distributed Haskell (GdH) can improve distributed software robustness and productivity. Erlongue Paris Productivity Gains in Erlang 3
  • 4. Erlang Comparisons • A number of sequential comparisons  Computer Language Shootout • Very few distributed system comparisons published! • Ulf Wiger [Wiger01] reports  Erlang systems have between 4 and 10 times less code than C/C++/Java/PLEX systems  Similar error rates/line of code, similar productivity rates  No direct comparative measurements Erlongue Paris Productivity Gains in Erlang 4
  • 5. Research Questions: Potential Benefits • RQ1: Can robust, configurable systems be readily developed? • Resilience to extreme loads • Availability in the face of hardware & software failures • Dynamic reconfigurability on available hardware • RQ2: Can productivity and maintainability be improved? • How do the sizes of the C++ and Erlang components compare & what language features contribute to size differential? Erlongue Paris Productivity Gains in Erlang 5
  • 6. Research Questions: Feasibility High-level distributed languages: • Abrogate control of low-level coordination aspects, so ● RQ3: can the required functionality be specified? • typically pay space and time penalties for their automatic coordination management. ● RQ4: can acceptable performance be achieved? • RQ5: What are the costs of interoperating with conventional technology? • RQ6: Is the technology practical? Erlongue Paris Productivity Gains in Erlang 6
  • 7. Research Strategy • Reengineer telecoms applications in GdH and Erlang  Dispatch Call Controller [NTK04,NTK05]  Data Mobility component • Compare high-level and Java/C++ implementations for  Performance  Robustness  Productivity  Impact of programming language constructs Erlongue Paris Productivity Gains in Erlang 7
  • 8. Data Mobility Component (DM) First Product Application • Communicates with Motorola mobile devices • 3000 lines of C++ • Uses 18,000 lines of Motorola C library functions • Has a transmitter, a receiver and 2 message types • Interacts with 5 other components of the system Erlongue Paris Productivity Gains in Erlang 8
  • 9. Despatch Call Controller (DCC) Second Application • Handles mobile phone calls • A process manages each call • Scalable with multiple servers Erlongue Paris Productivity Gains in Erlang 9
  • 10. Two Erlang DM Implementations 1. Pure Erlang DM 2. Erlang / C DM  Reuses some C DM libraries & drivers • Both interoperate with a test harness • Combines • Unix Processes • Erlang processes • C Threads (Erlang/C DM) Erlongue Paris Productivity Gains in Erlang 10
  • 11. RQ3 Performance 1: Throughput Platform: 167MHz, 128Mb Sun Ultra 1, SunOS 5.8 C++ DM Erlang/C DM Pure Erlang DM 480 230 940 • Maximum DM Throughput at 100% QoS • Pure Erlang DM is twice as fast as C++ DM  Better process management and marshalling • Erlang/C DM is ½ speed of C++ DM  Still meets nominal throughput Erlongue Paris Productivity Gains in Erlang 11
  • 12. RQ3 Performance 2: Roundtrip Times C++ DM Erlang/C DM Pure Erlang DM 7 6 5 4 ms 3 2 1 0 Query type 1 Query type 2 Broken query • Pure Erlang is approximately 3 times faster • Erlang/C is 26% - 50% slower Erlongue Paris Productivity Gains in Erlang 12
  • 13. Performance Analysis • Pure Erlang DM is faster due to fast lightweight process management • Erlang/C is slower due to additional communication to C components Erlongue Paris Productivity Gains in Erlang 13
  • 14. Performance 3: Memory Residence ERTS Moto C lib App C/C++ App Erlang 7000 6000 5000 4000 Kb 3000 2000 1000 0 C++ DM Erlang/C DM Erlang DM • Erlang DMs use 170% more memory • Erlang runtime sys (ERTS) has a fixed size  Would be a smaller % of a larger application Erlongue Paris Productivity Gains in Erlang 14
  • 15. RQ1 Robustness 1: Resilience Throughput Erlang A C++ A Pure Erlang A (queries/s) 1200 1000 800 600 400 200 0 00 00 00 00 0 0 0 0 0 0 0 0 0 24 94 24 31 48 48 31 00 00 47 94 14 19 16 25 Load (queries/s) Erlongue Paris Productivity Gains in Erlang 15
  • 16. RQ1 Robustness 1: Resilience When overloaded: • C++ DM fails catastrophically • Pure Erlang & Erlang/C DMs: • Throughput degrades  Never completely fails  Handling 48 q/s at peak load (25000q/s)  Recovers automatically after load drops Erlongue Paris Productivity Gains in Erlang 16
  • 17. DCC Resilience Erlongue Paris Productivity Gains in Erlang 17
  • 18. Robustness 2: Availability Erlang DCC system: • Remains available despite repeated hardware and software failures • Performance doesn’t degrade with repeated failures DCC Throughput with Repeated Failures Erlongue Paris Productivity Gains in Erlang 18
  • 19. Robustness 2: Availability Erlang DCC system: • Resists the simultaneous failure of multiple components • When more components fail throughput drops lower & recovery takes longer 5-processor DCC with Multiple Failures Erlongue Paris Productivity Gains in Erlang 19
  • 20. Robustness 3: Dynamic Configurability Erlang DCC system: • Dynamically adapt to the available hardware resources • 5 processor system  Remove a processor 4 times  Add a processor 4 times DCC Throughput with Varying Numbers of Processors Erlongue Paris Productivity Gains in Erlang 20
  • 21. RQ2: Productivity & Maintainability • Shorter programs are • Faster to develop • Contain fewer errors [Wiger01] • Easier to maintain • The metric we use is Source Lines Of Code (SLOC) Erlongue Paris Productivity Gains in Erlang 21
  • 22. Productivity: Source Code Sizes Lang. C/C++ Erlang Total Lang. C++ IDL Erlang Total C++ 3101 3101 C++ 14.8K 83 14.9K Erl./C 247 616 863 Erlang 4882 4882 Erlang 398 398 DCC Implementations DM Implementations • Erlang DCC & DM are less than 1/3rd of size of C++ version • Consistent with Wiger & folklore Erlongue Paris Productivity Gains in Erlang 22
  • 23. Productivity: DM Source Code Sizes C++/C Erlang 3500 3000 2500 2000 1500 1000 500 0 C++ DM Erlang/C DM Pure Erlang DM • Erlang/C DM is 1/3rd of the size of the C++ DM • Pure Erlang DM is 1/7th of the size of the C++ DM • Erlang/C DM is 1/18th of the size of the C++ DM + libraries Erlongue Paris Productivity Gains in Erlang 23
  • 24. Reasons for difference in Code Size • Erlang programmers can  Rely on fault tolerance and code for the successful case  27% of C++ DM code is defensive • And have to their use  Automatic memory management (11% of C++ DM code)  High-level communication (23% of C++ DM code)  Telecom design pattern libraries Erlongue Paris Productivity Gains in Erlang 24
  • 25. DM Code Breakdown 100% 90% Defensive 80% Defines 70% Includes 60% Type Delcarations 50% Communication 40% Memory Management 30% Process Management 20% App 10% 0% C++ A Moto Clib Erlang/C Erlang Erlongue Paris Productivity Gains in Erlang 25
  • 26. Code Difference Example void DataMobilityRxProcessor::processUnsupVer(void) { MSG_PTR msg_buf_ptr; MM_DEVICE_INFO_MSG *msg_ptr; RETURN_STATUS ret_status; UINT16 msg_size; C++ // Determine size of ici message msg_size = sizeof( MM_DEVICE_INFO_MSG); // Create ICI message object to send to DMTX so it sends a Device Info // message to VLR and HLR clients IciMsg ici_msg_object( MM_DEVICE_INFO_OPC, ICI_DMTX_TASK_ID, msg_size); // Retrieve ICI message buffer pointer Erlang sz_dme_dmtx:cast(device_info) msg_buf_ptr = ici_msg_object.getIciMsgBufPtr(); // Typecast pointer from (void *) to (MM_DEVICE_INFO_MSG *) msg_ptr = (MM_DEVICE_INFO_MSG *)msg_buf_ptr; // Populate message buffer SET_MM_DEVICE_INFO_DEVICE_TYPE( msg_ptr, SERVER); SET_MM_DEVICE_INFO_NUM_VER_SUPPORTED( msg_ptr, NUM_VER_SUPPORTED); SET_MM_DEVICE_INFO_FIRST_SUP_PROTO_VERS( msg_ptr, PROTO_VERSION_ONE); // Send message to the DMTX task ret_status = m_ici_io_ptr->send(&ici_msg_object); // Check that message was sent successfully if (ret_status != SUCCESS) { // Report problem when sending ICI message sz_err_msg( MAJOR, SZ_ERR_MSG_ERR_OPCODE, __FILE__, __LINE__, "DataMobilityRxProcessor processUnsupVer: failure sending " " device info message to DMTX"); } Erlongue Paris Productivity Gains in Erlang 26
  • 27. Erlang DCC Reusability Part SLOC No. Modules Percentage Reusable 2994 26 61% Platform Specific Services 147 1 3% Testing & 1741 11 36% Statistics •Considerable potential for reuse Erlongue Paris Productivity Gains in Erlang 27
  • 28. Summary • Investigated high-level distributed language technology for telecoms software • Reengineered two telecoms components in Erlang • Measured & compared the Erlang & C++ components Erlongue Paris Productivity Gains in Erlang 28
  • 29. RQ1:Robust and Configurable Systems • Improved resilience:  Erlang DM and DCC sustain throughput at extreme loads  Automatically recover when load drops  C++ DM fails catastrophically (predict C++/CORBA DCC would) • Improved availability:  Erlang DCC recovers from repeated & multiple failures  Predict C++/CORBA DCC would fail catastrophically • Dynamic Reconfiguration  Erlang DCC can be dynamically reconfigured to available hardware  C++/CORBA DCC can also be dynamically reconfigured using CORBA • Potential for hot-code loading (not demonstrated) Erlongue Paris Productivity Gains in Erlang 29
  • 30. RQ2:Productivity and Maintainability • Erlang DM and DCC:  Less than 1/3rd size of C++ implementation  Erlang DM 1/18th size of C++ DM with libraries  Good reusability • Reasons:  Code for successful case – saves 27%  Automatic memory management – saves 11%  High-level communications – saves 23%  Telecom design pattern libraries Erlongue Paris Productivity Gains in Erlang 30
  • 31. Distributed Functionality • Even though Erlang abstracts over low-level coordination, the required DM and DCC functionality is readily specified. Erlongue Paris Productivity Gains in Erlang 31
  • 32. RQ4: Performance Time: • Max. throughput at 100% QoS:  Pure Erlang DM is twice as fast as C++ DM  Erlang/C is ½ as fast as C++ DM , but still exceeds throughput requirements • Roundtrip times  Pure Erlang DM is three times as fast as C++ DM  Erlang/C is between 26% and 50% slower as C++ DM Space: • Pure Erlang and Erlang/C both have 170% greater memory residency due to (fixed size) 5Mb runtime system Erlongue Paris Productivity Gains in Erlang 32
  • 33. RQ5: Interoperation Costs • Erlang DMs interoperate with a C test harness, and Erlang/C DM incorporates C drivers & library functions • Costs  Low space cost: an additional 15% residency  High time cost: •Erlang/C roundtrip times up to 6 times pure Erlang •Erlang/C max. throughput ¼ of pure Erlang • Potential for incremental re-engineering of large systems Erlongue Paris Productivity Gains in Erlang 33
  • 34. RQ6: Pragmatics • Erlang is available on several HW/OS platforms, including the Sun/Solaris DM product platform • Is supported with training, consultancy, libraries etc. Erlongue Paris Productivity Gains in Erlang 34
  • 35. Conclusions • Erlang offers robustness & productivity benefits for distributed telecoms software (RQs 1 & 2) • High-level distributed languages like Erlang can deliver the required telecoms functionality and performance (RQs 3 & 4) • Erlang can interoperate with existing technologies and meets pragmatic requirements (RQs 5 and 6) Erlongue Paris Productivity Gains in Erlang 35
  • 36. Further Information • Web sites/Seminars  Project Site: www.macs.hw.ac.uk/~dsg/telecoms/ • References  [NTK04] Nystrom J.H. Trinder P.W. King D.J. Evaluating Erlang for Robust  Telecoms Software S3S’04, Chicago, July 2004.  [NTK05] Nystrom J.H. Trinder P.W. King D.J. Are High- Level languages suitable for  Robust Telecoms Software? SafeComp’05, Fredrikstad, Norway, Sept. 2005.  [Wiger01] Ulf Wiger, Workshop on Formal Design of Safety Critical Embedded  Systems, Munich, March 2001 http://www.erlang.se/publications/Ulf_Wiger.pdf Erlongue Paris Productivity Gains in Erlang 36