brief intro to phoenix - elixir meetup at bukalapak

33
Riza Fahmi - ElixirDose.com - @rizafahmi22 - riza@ hacktiv8.com PRODUCTIVE. RELIABLE. FAST.

Upload: riza-fahmi

Post on 10-Feb-2017

1.293 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

Riza Fahmi - ElixirDose.com - @rizafahmi22 - riza@ hacktiv8.com

PRODUCTIVE. RELIABLE. FAST.

Page 2: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

INTRODUCTION

YOU’RE MY REGULATOR, MY COMPILER

▸ Scream when things go too fast / slow / are unclear

▸ Scream when cool things happen

▸ Help me when live coding, I’m suck at it. Find errors for me before the compiler do

▸ Similar to Phoenix channel, this is two way communication channel. Don’t let me do all the talking!

Page 4: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

INTRODUCTION

WHO AM I

▸ Was at CitizenLab, a Belgium-based early stage startup. As a CTO

▸ Now at Hacktiv8, a startup for dev bootcamp

▸ Run ElixirDose — an Elixir-focused blog since November 2013

Page 5: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

INTRODUCTION

WHAT WE’LL SEE

▸ The Awesomeness of Phoenix

▸ Build something with Phoenix

▸ Some live coding

Page 6: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

SOME GLOSSARY

Web Framework

Programming Language

Erlang Virtual Machine

Page 7: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

WHAT IS PHOENIX

Page 8: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

“Framework for building HTML5 apps, API backends and distributed systems to take on the modern web.”

Chris McCord

Page 9: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

HOW IS PHOENIX DIFFERENT?

Page 10: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

PRODUCTIVITYPERFORMANCE VS

Page 11: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

LET’S TALK PRODUCTIVITY

Page 12: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

PRODUCTIVITY

SHORT TERM

▸ Documentation / Guides / Generators

▸ Eliminates trivial choices

Page 13: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

PRODUCTIVITY

LONG TERM

▸ Maintainability

▸ Tried and true architecture patterns

▸ Let it crash mentality

Page 14: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

“IF I HAVE TO BUILD SKYNET, KILLER ARTIFICIAL INTELLIGENT FROM TERMINATOR MOVIES, I WOULD USE ERLANG AND ERLANG VM. MOSTLY BECAUSE IT’S UNKILLABLE AND KEEP COMING BACK!”

Simon St.Laurent from MostlyErlang Podcast

Page 15: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

MORE FEATURES PLEASE…

Page 16: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

FEATURES

STATIC BUILD TOOLS WITH ES6 AS DEFAULT

Ultra fast HTML5 build tools

Compiles/lints your scripts and styles

Concatenates your scripts and styles

Minifies it

Watches for file changes

Page 17: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

FEATURES

PRETTY AND HELPFUL ERROR PAGES

Page 18: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

FEATURES

CHANNELS

▸ The main reason why Phoenix exists in the first place

▸ It’s websocket with steroid

▸ Cross-platform, cross-languages

▸ For creating modern, real-time apps

▸ Beyond HTML

Page 19: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

FEATURES

MORE…

▸ Form builder

▸ Live reloading

▸MCV with twist

▸much more…

Page 20: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

LET’S TALK PERFORMANCE NOW

Page 21: Brief Intro to Phoenix - Elixir Meetup at BukaLapak
Page 22: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

PERFORMANCE

VIEWS & TEMPLATES

▸Precompiled and pretty fast!

▸Views render templates

▸ It’s beyond HTML

Page 23: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

PERFORMANCE

WHAT ABOUT SOME BENCHMARK

Frameworks Throughput (req/s) Latency (ms)Plug (Elixir) 54,948.14 3.83

Gin (Go) 51,483.20 1.94Phoenix (Elixir) 43,063.45 2.82

Express Cluster (Nodejs) 27,669.46 3.73Martini (Go) 14,798.46 6.81

Express (Nodejs) 9,965.56 10.07Sinatra (Ruby) 9,182.86 6.55

Rails (Ruby) 3,274.81 17.25

https://github.com/mroth/phoenix-showdown

Page 24: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

PERFORMANCE

ROBUST CONCURRENCY MODEL

▸ “processes” is extremely lightweight units of concurrency

▸ Garbage collection is per process, no global pauses

Page 25: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

“ WE DO NOT HAVE ONE WEB-SERVER HANDLING 2 MILLIONS SESSIONS. WE HAVE 2 MILLION WEBSERVERS HANDLING ONE SESSION EACH.”

Joe Armstrong - Erlang Fatherhttp://goo.gl/DprVTC

Page 26: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

LET’S BUILD SOMETHING

Page 27: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

WHAT WE’LL BUILD

ELIXIR TALKS VIDEO PORTAL

▸ CRUD app for collecting Elixir-related video talk

▸ Similar confreaks.tv or pyvideo.org

Page 28: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

OFF ROAD… WE GO!

Page 29: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

INSTALLING…

INSTALL PHOENIX

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

$ mix phoenix.new -v

Page 30: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

WANT MORE?

Page 31: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

WANT MORE…

READ SOME BOOKS

Page 32: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

WANT MORE…

WATCH AND LEARN

Page 33: Brief Intro to Phoenix - Elixir Meetup at BukaLapak

I’M DONE. THANKS FOR TUNING IN!