13
The Migration from Erlang to OTP A case study of a heavy duty TCP/IP client/server application Francesco Cesarini [email protected] Mickaël Rémond [email protected]

The Migration From Erlang To Otp A Case Study Of A Heavy Duty Tcpip Clientserver Application

  • Upload
    l-xf

  • View
    1.882

  • Download
    3

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

The Migration from Erlang to OTPA case study of a heavy duty TCP/IP

client/server application

Francesco [email protected]

Mickaël Ré[email protected]

Page 2: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

The Product...

IDEALX runs in-house customer projects– Based on Open Source components

– develop what is not available

– release reusable applications on their site

Develop an Instant Messaging Server– For one of the largest French ISPs

– Handle 10,000 simultaneous users

– Based on the Jabber protocol

– Scaleable during runtime

– Allow flexible addition of services

Page 3: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

The Product...

Page 4: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

Building the Prototype.

A team of 4 software engineers Erlang Knowledge

– All self-taught

– Had been active in in-house Erlang projects

– Used the erlang-questions mailing list They had a working prototype in 5 weeks

– Handled 900 simultaneous users

– Had performance and reliability problems Delivered to an impressed customer

Page 5: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

Building the Prototype.

Decide to take in external help– Code & Architecture review

– Improve performance

– Explain OTP behaviours The code review showed

– Well written code

– Little use of higher order functions

– Lots of unnecessary concurrency

– NO OTP behaviours or design principles!!

Page 6: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

Building the Prototype.

multiplexing

multiplexingde-multiplexing

de-multiplexing

state/error handling

users

sockets listener

sockets

Page 7: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

How could they miss OTP?

How do I apply object oriented design in Erlang?

How do I apply object oriented design in Erlang?

Mickaël RémondJoe Armstrong

You do not need to apply OOdesign as Erlang has something more

powerful called behaviours!

Page 8: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

How could they miss OTP?

The name Open Telecom Platform– They were developing XML based products

– They were developing products for ISPs

– They were not developing telecom products They did not find the documentation

– Relations between behaviours not evident

– No tutorials Found very few OTP examples online

Page 9: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

To the Rescue!

OTP training: 2.5 days– Only behaviours were covered

Code review: 1 day New system architecture design: 0.5 days

– No documents necessary ‘Code rewrite’ examples: 1 day

– Using higher order functions

– How to remove deeply nested cases

– Bit syntax, etc.

Page 10: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

To the Rescue!

multiplexing

multiplexingde-multiplexing

state/error handling

users

sockets listener

de-multiplexing

sockets supervisor

simple 1-1

Page 11: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

To the Rescue!

25 days work from prototype to product– Included training, redesign, rewriting, testing

Code reduction of 50% Free goodies from OTP

– Restart strategies, application control, etc. Problems

– Limit of TCP connections per Unix process

– One listen socket for many Erlang nodes

– Windows NT database performance

Page 12: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

The Moral of the Story.

OTP design principles and behaviours fill a gap that existed in pure Erlang– Structuring of programs

– Reuse of Code

– Methodology

– Development strategy For some one downloading Erlang/OTP off

the web, finding/understanding design principles and behaviours is not obvious/easy.

Page 13: The Migration From Erlang To Otp   A Case Study Of A Heavy Duty Tcpip Clientserver Application

The Moral of the Story.

We who work with OTP should promote it better– Advantages– The gap it fills– More and better examples– Help existing open source projects

Hopefully, this will result in others not doing the same mistake– Happy users = Many users– Many users = Fun user conferences