Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

4Developers 2015: Lessons for Erlang VM - Michał Ślaski

230 views

Published on

Speaker: Michał Ślaski
Language: English

YouTube: https://www.youtube.com/watch?v=mCIFPAG1u0k&list=PLnKL6-WWWE_WNYmP_P5x2SfzJ7jeJNzfp&index=56

Goal
Share experiences from using Erlang/OTP in real projects and discuss Erlang VM features, which help maintain and troubleshoot ever running systems.

Details
In this talk we will discuss thinking in a concurrent programming language along with the problems it has to solve.

We will take a look at the real tools Erlang gives you to write highly-available systems that let you sleep through the night: dynamic tracing and remote REPL.

We'll see how these tools are used.

Prerequisites
Attendees should be familiar with functional programming, actor based concurrency, pattern matching, dynamic typing, TCP/IP.

4Developers: http://4developers.org.pl/pl/

Published in: Software
  • Be the first to comment

  • Be the first to like this

4Developers 2015: Lessons for Erlang VM - Michał Ślaski

  1. 1. Lessons    From    Erlang Michał  Ślaski        @michalslaski   ! ! !      4Developers,  20.04.2015
  2. 2. Erlang  timeline  and  my  background
  3. 3. Erlang  timeline  and  my  background Started  out  in  the  Ericsson  software  lab  1987  (!)
  4. 4. Erlang  timeline  and  my  background Started  out  in  the  Ericsson  software  lab  1987  (!) • I  was  six  years  old

  5. 5. Erlang  timeline  and  my  background Started  out  in  the  Ericsson  software  lab  1987  (!) • I  was  six  years  old
 Released  as  open  source  in  1998
  6. 6. Erlang  timeline  and  my  background Started  out  in  the  Ericsson  software  lab  1987  (!) • I  was  six  years  old
 Released  as  open  source  in  1998 • I  started  computer  science  at  AGH  2  years  later

  7. 7. Erlang  timeline  and  my  background Started  out  in  the  Ericsson  software  lab  1987  (!) • I  was  six  years  old
 Released  as  open  source  in  1998 • I  started  computer  science  at  AGH  2  years  later
 Gains  SMP  support  in  2005
  8. 8. Erlang  timeline  and  my  background Started  out  in  the  Ericsson  software  lab  1987  (!) • I  was  six  years  old
 Released  as  open  source  in  1998 • I  started  computer  science  at  AGH  2  years  later
 Gains  SMP  support  in  2005 • I  just  graduated  and  joined  Erlang  Solutions
  9. 9. Maintenance  vs.  Development
  10. 10. Maintenance  vs.  Development Maintenance  may  span  for  20  years,
 whereas  development  may  be  1-­‐2  years.     ! ! ! ! ! ! ! ! ! Schach,  R.,  Software  Engineering
 Fourth  Edition,  McGraw-­‐Hill,  Boston,  MA  1999

  11. 11. Erlang  properties
  12. 12. Erlang  properties OTP  behaviours   • set  of  design  patterns   • client-­‐server,  fsm,  supervisor   • application,  release

  13. 13. Erlang  properties OTP  behaviours   • set  of  design  patterns   • client-­‐server,  fsm,  supervisor   • application,  release
 What  for?   • consistent  maintenance  procedures   • one  tar  ball  artefact
  14. 14. Erlang  OTP  releases $ ls -l ../abacus.tar -rw-r--r-- 1 ms staff 12331520 Oct 31 12:01 abacus.tar ! $ ls -1 bin erts-6.1 lib releases ! $ ./bin/abacus Erlang/OTP 17 [erts-6.1] [smp:4:4] 
 [async-threads:10] [kernel-poll:false] ! Eshell V6.1 (abort with ^G) (abacus@127.0.0.1)1> github.com/michalslaski/erlang-­‐workshop
  15. 15. Erlang  properties
  16. 16. Erlang  properties Robustness   • simple  and  consistent  error  recovery   • supervision  hierarchies   • program  for  the  correct  case   • let  it  crash

  17. 17. Erlang  properties Robustness   • simple  and  consistent  error  recovery   • supervision  hierarchies   • program  for  the  correct  case   • let  it  crash
 What  for?   • resilient  to  bugs  and  failures
  18. 18. Erlang  properties  -­‐  supervision  tree
  19. 19. Erlang  properties  -­‐  supervision  tree
  20. 20. Erlang  properties  -­‐  supervision  tree
  21. 21. Erlang  properties  -­‐  supervision  tree supervisor
  22. 22. Erlang  properties  -­‐  supervision  tree supervisor worker
  23. 23. Erlang  properties  -­‐  supervision  tree supervisor worker
  24. 24. Erlang  properties  -­‐  supervision  tree supervisor worker
  25. 25. Erlang  properties  -­‐  supervision  tree supervisor worker
  26. 26. Erlang  properties
  27. 27. Erlang  properties Distribution   • explicit  or  transparent  distribution   • network-­‐aware  runtime  system

  28. 28. Erlang  properties Distribution   • explicit  or  transparent  distribution   • network-­‐aware  runtime  system
 What  for?   • remote  Erlang  shell  (REPL)   • remote  observing  tools
  29. 29. Erlang  properties  -­‐  distribution
  30. 30. Erlang  properties  -­‐  distribution cat
  31. 31. Erlang  properties  -­‐  distribution cat flea
  32. 32. Erlang  properties  -­‐  distribution cat flea nodes() = [cat@home, flea@home]
  33. 33. Erlang  properties  -­‐  distribution cat dog flea bird nodes() = [cat@home, flea@home]
  34. 34. Erlang  properties  -­‐  distribution cat dog flea bird nodes() = [cat@home, flea@home] nodes() = [dog@home, bird@home]
  35. 35. Erlang  properties  -­‐  distribution cat dog flea bird nodes() = [cat@home, flea@home] nodes() = [dog@home, bird@home]
  36. 36. Erlang  properties  -­‐  distribution cat dog flea bird nodes() = [cat@home, flea@home, dog@work, bird@work]
  37. 37. entop  vs.  top
  38. 38. entop  vs.  top
  39. 39. entop  vs.  top https://github.com/mazenharake/entop
  40. 40. Erlang  properties
  41. 41. Erlang  properties Hot  code  loading   • easily  change  code  in  a  running  system   • enables  non-­‐stop  operation   • simplifies  testing

  42. 42. Erlang  properties Hot  code  loading   • easily  change  code  in  a  running  system   • enables  non-­‐stop  operation   • simplifies  testing
 What  for?   • shorter  development  cycle   • non-­‐stop  operations
  43. 43. Erlang  properties
  44. 44. Erlang  properties Tracing  in  Erlang  VM   • Tracing  is  turned  on/off  per  process   • function  calls,  message  passing,  GC,  scheduler

  45. 45. Erlang  properties Tracing  in  Erlang  VM   • Tracing  is  turned  on/off  per  process   • function  calls,  message  passing,  GC,  scheduler
 What  for?   • live  debugging   • no  need  to  instrument  code  and  recompile
  46. 46. Erlang  tracing courtesy  of  Mats  Cronqvist
  47. 47. Erlang  tracing  calls
  48. 48. Erlang  tracing  calls redbug  -­‐  github.com/massemanet/eper   • tracing  tool  built  on  top  of  erlang:trace/3
  49. 49. Erlang  tracing  calls redbug  -­‐  github.com/massemanet/eper   • tracing  tool  built  on  top  of  erlang:trace/3 1> redbug:start("lists:seq(X,Y) -> return"). {30,1}! 2> lists:seq(1,5).! [1,2,3,4,5]! ! % 12:32:17 <0.32.0>({erlang,apply,2})! % lists:seq(1, 5)! ! % 12:32:17 <0.32.0>({erlang,apply,2})! % lists:seq/2 -> [1,2,3,4,5]
  50. 50. Flame  Graphs  for  Erlang  -­‐  eflame
  51. 51. Flame  Graphs  for  Erlang  -­‐  eflame github.com/proger/eflame   • as  stacks  are  collected  through  tracing,
 blocking  calls  are  noticed  and  are  drawn  in  blue
  52. 52. Flame  Graphs  for  Erlang  -­‐  eflame github.com/proger/eflame   • as  stacks  are  collected  through  tracing,
 blocking  calls  are  noticed  and  are  drawn  in  blue
  53. 53. What’s  next?
  54. 54. Erlang  the  Movie
  55. 55. Erlang  the  Movie
  56. 56. Erlang  the  Movie  II
  57. 57. Erlang  the  Movie  II
  58. 58. Open  source  projects
  59. 59. Open  source  projects • RabbitMQ  message  broker  

  60. 60. Open  source  projects • RabbitMQ  message  broker  
 • MongooseIM  XMPP  server

  61. 61. Open  source  projects • RabbitMQ  message  broker  
 • MongooseIM  XMPP  server
 • Riak  database

  62. 62. Open  source  projects • RabbitMQ  message  broker  
 • MongooseIM  XMPP  server
 • Riak  database
 • CouchDB  database
  63. 63. Erlang  Community
  64. 64. Erlang  Community Erlang  Central   • www.erlangcentral.org

  65. 65. Erlang  Community Erlang  Central   • www.erlangcentral.org
 Erlang  User  Conference   • Stockholm,  June  2015
  66. 66. Erlang  Community Erlang  Central   • www.erlangcentral.org
 Erlang  User  Conference   • Stockholm,  June  2015
  67. 67. Erlang  Community Erlang  Central   • www.erlangcentral.org
 Erlang  User  Conference   • Stockholm,  June  2015 Lambda  Academy   • lambdaacademy.org,  March-­‐June  2015
  68. 68. Questions? ! Michał  Ślaski          @michalslaski

×