Slide 1

Slide 1 text

PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR PRACTICAL ELIXIR Arnaud Wetzel, co-founder Shopping Adventure

Slide 2

Slide 2 text

INTRODUCTION Shopping Adventure connects physical shops Microservices Java/C/Python/Ruby/Clojure/Erlang/Elixir Erlang : stateful services, microservices inside, simple and available Elixir additions ? Syntax ? really ? Macros ? `parse_transform` Tools ? Erlang ecosystem is more mature and stable Feedback : productivity, flexibility, the whole experience This presentation is a feeback

Slide 3

Slide 3 text

PROJECT Mall e-commerce website : nice UI to quickly fill a cart with mall shops products and buy them, then organize pick up or delivery. Backend Magic: construct data set from nothing, or very bad inputs Backend magic: handle heterogeneous processes, connect retailer software, synchronize teams

Slide 4

Slide 4 text

PROJECT Bad input dataset Format / Augment / Filter / Merge / Join Heterogeneous providers Local micro services Heterogeneous order workflows Transactional order changes Connect non technical partners APIfy websites and emails UI == eternal nightmare Small team == well partitioned jobs

Slide 5

Slide 5 text

OUR OWN ECOSYSTEM Hex.pm: Open repository is the future (before the chaos) HTTP DSL: Ewebmachine Data Mashup: ADAP Service Aggregation: EXOS/node_erlastic/python_erlastic/clojure_erlastic Mail destructuring/structuring: Mailibex State Distribution: Supervisorring FSM definition: ExFSM Rules as matches: ExRules Dev env: neovim-elixir

Slide 6

Slide 6 text

UI UI : Webflow (0LOC) UI state/cache : reaxt/jsxz (900LOC) HTTP API : Ewebmachine (350LOC) Cache : ets/riak (50LOC) Service clients : httpc (300LOC)

Slide 7

Slide 7 text

ORDER MANAGEMENT DHT distributed order transactions as FSM Core: transactors and models (350LOC) Order adapter for incomplete order (70LOC) FSM Selector rules (20LOC) Processes specification as FSM (500LOC) Service clients/adapters : clojure/python/http (500LOC)

Slide 8

Slide 8 text

WEBSITE AUTOMATION Distributed Selenium sessions Clojure Port/GenServer to talk to selenium Elixir is used to maintain and supervise sessions, and route then to free browsers

Slide 9

Slide 9 text

DATA MANAGEMENT Ruby workflows / python / c / etc. Our new approach, Elixir to pipe them all Distribute multi-language services and state : image caches / RDBS / machine learning models on dedicated nodes Query your entire dataset to create a new one Stream data entities accross the cluster hoping from one node to another when remote data is needed Data sink node will reorder and join entities with a buffer queue Augmentation rules (1000LOC)

Slide 10

Slide 10 text

LESSONS: MICRO SERVICES READY BERT Binary Format GenServer are services Communicate with protocols

Slide 11

Slide 11 text

ELIXIR: FOCUS ON API Sweet_JS API vs xmerl dbg:p ? dbg:c ?

Slide 12

Slide 12 text

ELIXIR: COMMAND LINE Copy paste friendly Partial execution friendly

Slide 13

Slide 13 text

ELIXIR: FLEXIBLE MODULE Organize your code Generate your functions (ex: riak_search stop words) Compile your spec (ex: mailibex mime type)

Slide 14

Slide 14 text

ELIXIR: FLEXIBLE DSL Make code matches your business if it does not match functionnal abstractions ex: Rule system, HTTP, FSM system

Slide 15

Slide 15 text

ELIXIR: CODE CACHE OPTIMIZATION Compile your getter (erlang mochiglobal) Templates

Slide 16

Slide 16 text

CONCLUSION Overall Elixir productivity seems to beat erlang in our experience Language is now stable The community is very active Library are more up to date Diversity of developers using it in France ?

Slide 17

Slide 17 text

QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ? QUESTIONS ?