modeling the real world with elixir and otp
play

Modeling the real world with Elixir and OTP Aish Raj Dahal - PowerPoint PPT Presentation

Modeling the real world with Elixir and OTP Aish Raj Dahal Concurrency, Events and Why are we the Real World here? Case study of an Elixir use Tour of the BEAM and OTP Demo time! Epilogue How did we get here ? Can


  1. Modeling the real world with Elixir and OTP Aish Raj Dahal

  2. ● Concurrency, Events and Why are we the Real World here? ● Case study of an Elixir use ● Tour of the BEAM and OTP ● Demo time!

  3. Epilogue How did we get here ?

  4. “Can programming be liberated from the von Neumann style” ?

  5. Elixir is a programming language that leverages the power of Erlang VM (BEAM)

  6. With a simple syntax and a supportive community the language has seen tremendous growth

  7. A lot* of PagerDuty is powered by Elixir

  8. It has always not been this way.

  9. At PagerDuty it started as a language of choice for Rails- native way to talk to Kafka

  10. Why ?

  11. It was high value

  12. It was easy to redo it in a different language

  13. How was it ?

  14. It was not all rainbows and unicorns

  15. The application needed some tuning

  16. But language never got in the way

  17. Since then...

  18. A cambrian explosion in Elixir based services

  19. A good number of critical backend applications are written in Elixir

  20. All with the niceness of being built for the Real- World ™

  21. Chapter I The Real World

  22. What is the Real World™?

  23. Are we talking about the universe ?

  24. In the beginning the universe was created. This has made a lot of people very angry and been widely regarded as a bad move. Douglas Adams, The Hitchhiker’s guide to the Galaxy

  25. The Real World ™ is the world we live in

  26. You must care about it because….

  27. When was the last time you programmed a non- multi-core computer ?

  28. Computer science is no more about computers than astronomy is about telescopes. Edsger Dijkstra

  29. Software you write probably models a real world situation

  30. Software you write probably deals with events

  31. Mental model of the real world:

  32. It is inherently concurrent

  33. It is event-based

  34. Failures are unpredictable

  35. It tends to be “real time”

  36. Software you write for the Real World ™ should deal with these situations.

  37. Which means...

  38. Your software should be concurrent.

  39. Your software should deal with events

  40. Your software should be fault- tolerant.

  41. Your software should respond to the user-input within a reasonable* time.

  42. Erlang solved these problems around three decades ago

  43. But this talk is not really about the Erlang programming language �

  44. Chapter II A Whirlwind tour of Elixir, BEAM and OTP

  45. Key ideas in Elixir

  46. Isolated Processes

  47. Pure Message Passing between processes

  48. The ability to detect errors in remote processes

  49. A method for determining what error caused a process to crash

  50. This means that Elixir is ● Concurrent

  51. This means that Elixir is ● Concurrent ● Fault tolerant

  52. This means that Elixir is ● Concurrent ● Fault tolerant ● Soft real time

  53. And built in support for things like hot code swap

  54. Detour: Open Telecom Platform (OTP)

  55. OTP is a set of libraries and tools that provides fundamental abstractions for BEAM languages

  56. Here are some nice building blocks that OTP provides

  57. GenServer: A generic server

  58. Process Supervisors

  59. Agents: State Wrappers

  60. Sounds like what you will want for the Real World ™

  61. Chapter III Demo time

  62. Boids

  63. The rules of flight

  64. Separation: Steer to avoid crowding local flockmates

  65. Rule I: Separation

  66. Alignment: Steer towards the average heading of local flockmates

  67. Rule II: Alignment

  68. Cohesion: Steer to move toward the average position (center of mass) of local flockmates

  69. Rule III: Cohesion

  70. Modeling this with Elixir/OTP

  71. Modeling the events

  72. Move

  73. Render

  74. Dealing with failures

  75. Restart the boid

  76. Concurrency

  77. Keep your processes light and have many of them.

  78. Epilogue

  79. Make it work, then make it beautiful, then if you really, really have to, make it fast. Joe Armstrong

  80. - @aishrajdahal

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend