SlideShare a Scribd company logo
Erlang 101
Istanbul Hacker Space
https://istanbulhs.org/
25 Kasim 2012
Gokhan Boranalp
gokhan@zetaops.com
● Nereden nereye.
○ Tarihçe ve şimdiki durum.
● Dil
● Önemli Noktalar
● Kullananlar
● Made with Erlang
● Sorular
Tarihçe
● SHARED MEMORY WITH LOCKS
● SOFTWARE TRANSACTIONAL MEMORY
(STM)
● FUTURES, PROMISES, AND SIMILAR
● MESSAGE PASSING
Process Modelleri
Karakteristik Özellikler
■ Message Passing
■ Dynamic typed
■ Actor model
■ Share Nothing
■ Immutable Objects
Dil
1> io:format("Naber dunya~n").
Naber dunya
ok
2> io:format("Naber, ~s!~n", [kanka]).
Naber, kanka!
ok
- ~s = %s printf C
- ~n = n
Dil
Atoms
- true, false, test_me, kunthar@local, 'EXIT'
Integers
- 10, -200, 12345678909999999999999999999
- 16#FFffFFff=4294967295
- 16#FF= 255
- $A = 65 (ASCII kod A)
Floats
3.14
-0.123
299792458.0
6.022137e23
6.6720e-11
Dil
Tuples
- {1, 2, 3}
{bir, iki, uc, dort} {buradan, "IHS", "sizi selamlar"}
{complex, {nested, "structure", {here}}}
Lists
[]
[1, 2, 3]
[bir, iki, uc]
[[1,2,3],[4,5,6]]
[{yarin, "biraz oku"}, {sonra, "yuruyus yap"}, {enson, "otur da yaz"}]
Dil
String (list of ASCII codes)
"merhaba" = [$m, $e, $r, $h, $a, $b, $a] = [109,101,114,104,97,98,97]
Binaries
<<0, 1, 2, ..., 255>>
<<109,101,114,104,97,98,97>> = <<"merhaba">>
Binaries with Bit Syntax
<<1:1,32787:15>> = 2#1111111111111111
Diger Data Tipleri
Funs (lambda expression or closure)
Function-as-data-object
Dil
Pids (Process Identifiers)
self().
<0.31.0>
Ports
#Port<0.472>.
References
5> make_ref().
#Ref<0.0.0.42>
Noktalama
○ (.) when hariç herşeyi sonlandir
○ (;) koşulu sonlandır
○ (,) ifadeyi (expressions) sonlandır
List Comprehensions
{2n : n in L}
in Erlang:
○ brackets ({}) become square brackets ([]),
○ the colon (:) becomes two pipes (||)
○ and the word 'in' becomes the arrow (<-).
1> [2*N || N <- [1,2,3,4]].
[2,4,6,8]
List Operations
List Operations
Anonymous Functions
Functions
Erlang Önemli Noktalar
● Declarative
● Concurrency
● Soft real-time
● Robustness
● Distribution
● Hot code loading
● External Interfaces
● Portability
○ Functional programming
language
○ High abstraction level
○ Pattern matching
○ Readable programs
Erlang Önemli Noktalar
● Declarative
● Concurrency
● Soft real-time
● Robustness
● Distribution
● Hot code loading
● External Interfaces
● Portability
○ Solid concurrency model
○ Scales to handle complex
concurrency
○ Simple abstractions
Örnekler
spawn ile yeni bir process yaratmak
Pid = spawn(ex3,activity,[Joe,75,1024])
activity(Joe,75,1024)
Asenkron mesajlar
hard core concurrency
Erlang Önemli Noktalar
● Declarative
● Concurrency
● Soft real-time
● Robustness
● Distribution
● Hot code loading
● External Interfaces
● Portability
○ Lightweight processes
○ Fast message passing
○ Response times in the order of
milliseconds efficient garbage
collection
Oynat Uğurcuğum
process creation times
message passing times
Erlang Önemli Noktalar
● Declarative
● Concurrency
● Soft real-time
● Robustness
● Distribution
● Hot code loading
● External Interfaces
● Portability
○ Simple and consistent error
recovery
○ Supervision hierarchies
Örnekler
process'ler birbirine bağlı çalışabilir!
proses hata kontrolü
- Proses sonlandığında, bağlı tüm proseslere exit sinyali
gönderilir.
hata kontrolü (2)
- Exit sinyalleri "tuzaklanarak" (trap) messages şeklinde alınabilir.
Supervisors & Workers
Error handling
● No global variables -- fewer side-effects
● No direct memory access -- no pointer errors
● No malloc/free bugs
● Solid concurrency model -- reduces synchronization
problems, reduces the state space (simpler programs)
● Fault isolation -- memory-protected lightweight
processes
● Built-in error recovery support -- more consistency
Concurrency & Fault Tolerance were designed into the
language from the start!
Debugging and Profiling Support
● Symbolic crash reports
○ Usually sufficient info to locate bugs within minutes
● Built-in trace support
○ Function calls (ability to filter on module name,
function and args)
○ Messages (+ sequence trace)
○ Process events (context switch, spawn, link, exit)
○ Garbage collections
○ Optionally with timestamps (can be used for profiling,
benchmarks)
○ Trace to process, file, or port (network socket)
○ Also available on live systems
Erlang Önemli Noktalar
● Declarative
● Concurrency
● Soft real-time
● Robustness
● Distribution
● Hot code loading
● External Interfaces
● Portability
○ Explicit or transparent
distribution
○ Network-aware runtime
system
Örnekler
Transparent Distribution
- başka bir bilgisayara prosesler arası mesaj gönderimi, aynı
bilgisayarda mesaj gönderimi kadar kolaydır.
Simple RPC
Erlang Önemli Noktalar
● Declarative
● Concurrency
● Soft real-time
● Robustness
● Distribution
● Hot code loading
● External Interfaces
● Portability
○ Easily change code in a
running system
○ Enables non-stop operation
○ Simplifies testing
Erlang Önemli Noktalar
● Declarative
● Concurrency
● Soft real-time
● Robustness
● Distribution
● Hot code loading
● External Interfaces
● Portability
○ Ports to the outside world
○ behave as Erlang processes
- Erlang Port Drivers
Erlang Önemli Noktalar
● Declarative
● Concurrency
● Soft real-time
● Robustness
● Distribution
● Hot code loading
● External Interfaces
● Portability
○ Any UNIX
○ Windows
○ VxWorks etc.
Systems Overview
Erlang/OTP (Open Telecom Platform)
● Middleware for Erlang development
● Designed for fault tolerance and portability
● Behaviors: A formalization of design patterns
● Components
○ Error handling, reporting and logging
○ Mnesia, distributed real-time database management
system CORBA, IDL Compiler, Java & C Interface Support
○ HTTP Server + Client, FTP Client
○ SNMP Agent + ASN.1 Compiler
○ H.248
○ XML
○ ...
OTP Behaviors
● "A formalization of design patterns"
○ A framework + generic code to solve a common problem
○ Built-in support for debugging and software upgrade
○ Makes it easier to reason about the behavior of a program
● Examples of OTP behaviors
application defines how an application is implemented
supervisor used to write fault-tolerant supervision trees
gen_server for writing client-server applications
gen_event for writing event handlers
gen_fsm for finite state machine programming
Büyük Projelerde Erlang
● Easy to build a first runnable application
● Easy to debug
● Easy to maintain
● Very strong support for fault tolerance
● Suitable for large systems/projects
● Great for prototyping
● Impressive performance/scalability in real applications
Outstanding tool for test automation
● High programmer satisfaction
Kullananlar
● Amazon Web Servisleri - SQS ve SimpleDB
● Facebook, chat
● Twitter
● Mochimedia
● del.icio.us / Yahoo
● T-Mobile
● Telia
● Bluetail/Alteon/Nortel
● Github
Made with Erlang
○ Apache CouchDB – document-based DB with REST
○ Disco – Map/Reduce framework for Erlang
○ Fuzed – Generic clustering framework (Powerset)
○ Mochiweb – Fast lightweight web server framework
(like Java Servlets for Erlang)
○ DHT – Distributed Key/Value Stores – 90% of all
implementations in Erlang – Dynomite, Scalaris, etc.
○ Yaws web server
○ Cowboy
○ Nitrogen
○ RabbitMQ
○ Riak
Good fit for
● Irregular concurrency
○ Task-level parallelism
○ Fine-grained parallelism
● Network servers
● Distributed systems
● Middleware:
○ Parallel databases
○ Message Queue servers
● Soft Real-Time / Embedded applications
● Monitoring, control and testing tools
Kaynaklar
http://en.wikipedia.org/wiki/Abstraction_%28computer_science%29
http://is.gd/xHWvZ3
http://www.erlang.org
http://learnyousomeerlang.com/

More Related Content

What's hot

ZFS Log Spacemap - Flushing Algorithm
ZFS Log Spacemap - Flushing AlgorithmZFS Log Spacemap - Flushing Algorithm
ZFS Log Spacemap - Flushing Algorithm
Serapheim-Nikolaos Dimitropoulos
 
Cryptography and secure systems
Cryptography and secure systemsCryptography and secure systems
Cryptography and secure systems
Vsevolod Stakhov
 
Benchmarking Apache Samza: 1.2 million messages per sec per node
Benchmarking Apache Samza: 1.2 million messages per sec per nodeBenchmarking Apache Samza: 1.2 million messages per sec per node
Benchmarking Apache Samza: 1.2 million messages per sec per node
Tao Feng
 
Avoiding Data Hotspots at Scale
Avoiding Data Hotspots at ScaleAvoiding Data Hotspots at Scale
Avoiding Data Hotspots at Scale
ScyllaDB
 
Samza memory capacity_2015_ieee_big_data_data_quality_workshop
Samza memory capacity_2015_ieee_big_data_data_quality_workshopSamza memory capacity_2015_ieee_big_data_data_quality_workshop
Samza memory capacity_2015_ieee_big_data_data_quality_workshop
Tao Feng
 
Tempesta FW: a FrameWork and FireWall for HTTP DDoS mitigation and Web Applic...
Tempesta FW: a FrameWork and FireWall for HTTP DDoS mitigation and Web Applic...Tempesta FW: a FrameWork and FireWall for HTTP DDoS mitigation and Web Applic...
Tempesta FW: a FrameWork and FireWall for HTTP DDoS mitigation and Web Applic...
Alexander Krizhanovsky
 
On component interface
On component interfaceOn component interface
On component interface
Laurence Chen
 
Distributed Postgres
Distributed PostgresDistributed Postgres
Distributed Postgres
Stas Kelvich
 
Experiences with Microservices at Tuenti
Experiences with Microservices at TuentiExperiences with Microservices at Tuenti
Experiences with Microservices at Tuenti
Andrés Viedma Peláez
 
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
ScyllaDB
 
NPF scripting with Lua by Lourival Vieira Neto
NPF scripting with Lua by Lourival Vieira NetoNPF scripting with Lua by Lourival Vieira Neto
NPF scripting with Lua by Lourival Vieira Neto
eurobsdcon
 
Temporal Performance Modelling of Serverless Computing Platforms - WoSC6
Temporal Performance Modelling of Serverless Computing Platforms - WoSC6Temporal Performance Modelling of Serverless Computing Platforms - WoSC6
Temporal Performance Modelling of Serverless Computing Platforms - WoSC6
Nima Mahmoudi
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPC
Guo Jing
 
A simple tool for debug (tap>)
A simple tool for debug (tap>)A simple tool for debug (tap>)
A simple tool for debug (tap>)
Laurence Chen
 
Building your First gRPC Service
Building your First gRPC ServiceBuilding your First gRPC Service
Building your First gRPC Service
Jessie Barnett
 

What's hot (19)

ZFS Log Spacemap - Flushing Algorithm
ZFS Log Spacemap - Flushing AlgorithmZFS Log Spacemap - Flushing Algorithm
ZFS Log Spacemap - Flushing Algorithm
 
Zero mq logs
Zero mq logsZero mq logs
Zero mq logs
 
Cryptography and secure systems
Cryptography and secure systemsCryptography and secure systems
Cryptography and secure systems
 
Benchmarking Apache Samza: 1.2 million messages per sec per node
Benchmarking Apache Samza: 1.2 million messages per sec per nodeBenchmarking Apache Samza: 1.2 million messages per sec per node
Benchmarking Apache Samza: 1.2 million messages per sec per node
 
rspamd-hyperscan
rspamd-hyperscanrspamd-hyperscan
rspamd-hyperscan
 
rspamd-slides
rspamd-slidesrspamd-slides
rspamd-slides
 
Avoiding Data Hotspots at Scale
Avoiding Data Hotspots at ScaleAvoiding Data Hotspots at Scale
Avoiding Data Hotspots at Scale
 
Samza memory capacity_2015_ieee_big_data_data_quality_workshop
Samza memory capacity_2015_ieee_big_data_data_quality_workshopSamza memory capacity_2015_ieee_big_data_data_quality_workshop
Samza memory capacity_2015_ieee_big_data_data_quality_workshop
 
Tempesta FW: a FrameWork and FireWall for HTTP DDoS mitigation and Web Applic...
Tempesta FW: a FrameWork and FireWall for HTTP DDoS mitigation and Web Applic...Tempesta FW: a FrameWork and FireWall for HTTP DDoS mitigation and Web Applic...
Tempesta FW: a FrameWork and FireWall for HTTP DDoS mitigation and Web Applic...
 
ZeroMQ with NodeJS
ZeroMQ with NodeJSZeroMQ with NodeJS
ZeroMQ with NodeJS
 
On component interface
On component interfaceOn component interface
On component interface
 
Distributed Postgres
Distributed PostgresDistributed Postgres
Distributed Postgres
 
Experiences with Microservices at Tuenti
Experiences with Microservices at TuentiExperiences with Microservices at Tuenti
Experiences with Microservices at Tuenti
 
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
 
NPF scripting with Lua by Lourival Vieira Neto
NPF scripting with Lua by Lourival Vieira NetoNPF scripting with Lua by Lourival Vieira Neto
NPF scripting with Lua by Lourival Vieira Neto
 
Temporal Performance Modelling of Serverless Computing Platforms - WoSC6
Temporal Performance Modelling of Serverless Computing Platforms - WoSC6Temporal Performance Modelling of Serverless Computing Platforms - WoSC6
Temporal Performance Modelling of Serverless Computing Platforms - WoSC6
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPC
 
A simple tool for debug (tap>)
A simple tool for debug (tap>)A simple tool for debug (tap>)
A simple tool for debug (tap>)
 
Building your First gRPC Service
Building your First gRPC ServiceBuilding your First gRPC Service
Building your First gRPC Service
 

Viewers also liked

Acik Kaynak Kodlu Kurumsal Eposta Sistemleri
Acik Kaynak Kodlu Kurumsal Eposta SistemleriAcik Kaynak Kodlu Kurumsal Eposta Sistemleri
Acik Kaynak Kodlu Kurumsal Eposta Sistemleri
Gokhan Boranalp
 
Riak ve RiakCS
Riak ve RiakCSRiak ve RiakCS
Riak ve RiakCS
Gokhan Boranalp
 
Buluta Ilk Adım Analizi
Buluta Ilk Adım AnaliziBuluta Ilk Adım Analizi
Buluta Ilk Adım Analizi
Gokhan Boranalp
 
Kak depolama stratejiniz nasıl olmalı?
Kak depolama stratejiniz nasıl olmalı?Kak depolama stratejiniz nasıl olmalı?
Kak depolama stratejiniz nasıl olmalı?
Gokhan Boranalp
 
Açık kaynak iş modeli nedir?
Açık kaynak iş modeli nedir?Açık kaynak iş modeli nedir?
Açık kaynak iş modeli nedir?
Gokhan Boranalp
 
Comparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms SoftwareComparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms Softwarel xf
 
Kurumlar icin openstack rehberi
Kurumlar icin openstack rehberi Kurumlar icin openstack rehberi
Kurumlar icin openstack rehberi
Gokhan Boranalp
 
Siz değil iş sizi nasıl bulur? GDG İzmir
Siz değil iş sizi nasıl bulur? GDG İzmir Siz değil iş sizi nasıl bulur? GDG İzmir
Siz değil iş sizi nasıl bulur? GDG İzmir
Gokhan Boranalp
 

Viewers also liked (8)

Acik Kaynak Kodlu Kurumsal Eposta Sistemleri
Acik Kaynak Kodlu Kurumsal Eposta SistemleriAcik Kaynak Kodlu Kurumsal Eposta Sistemleri
Acik Kaynak Kodlu Kurumsal Eposta Sistemleri
 
Riak ve RiakCS
Riak ve RiakCSRiak ve RiakCS
Riak ve RiakCS
 
Buluta Ilk Adım Analizi
Buluta Ilk Adım AnaliziBuluta Ilk Adım Analizi
Buluta Ilk Adım Analizi
 
Kak depolama stratejiniz nasıl olmalı?
Kak depolama stratejiniz nasıl olmalı?Kak depolama stratejiniz nasıl olmalı?
Kak depolama stratejiniz nasıl olmalı?
 
Açık kaynak iş modeli nedir?
Açık kaynak iş modeli nedir?Açık kaynak iş modeli nedir?
Açık kaynak iş modeli nedir?
 
Comparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms SoftwareComparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms Software
 
Kurumlar icin openstack rehberi
Kurumlar icin openstack rehberi Kurumlar icin openstack rehberi
Kurumlar icin openstack rehberi
 
Siz değil iş sizi nasıl bulur? GDG İzmir
Siz değil iş sizi nasıl bulur? GDG İzmir Siz değil iş sizi nasıl bulur? GDG İzmir
Siz değil iş sizi nasıl bulur? GDG İzmir
 

Similar to erlang 101

An End to Order (many cores with java, session two)
An End to Order (many cores with java, session two)An End to Order (many cores with java, session two)
An End to Order (many cores with java, session two)
Robert Burrell Donkin
 
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json  postgre-sql vs. mongodbPGConf APAC 2018 - High performance json  postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
Dave Cross
 
Languages formanandmachine
Languages formanandmachineLanguages formanandmachine
Languages formanandmachine
Gireesh Punathil
 
Full stack development
Full stack developmentFull stack development
Full stack development
Pavlo Iuriichuk
 
Sînică Alboaie - Programming for cloud computing Flows of asynchronous messages
Sînică Alboaie - Programming for cloud computing Flows of asynchronous messagesSînică Alboaie - Programming for cloud computing Flows of asynchronous messages
Sînică Alboaie - Programming for cloud computing Flows of asynchronous messagesCodecamp Romania
 
Tips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development EfficiencyTips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development Efficiency
Olivier Bourgeois
 
Introdução à Elixir
Introdução à ElixirIntrodução à Elixir
Introdução à Elixir
Guilherme Oliveira
 
Reactive Software Systems
Reactive Software SystemsReactive Software Systems
Reactive Software Systems
Behrad Zari
 
Benchmarks, performance, scalability, and capacity what s behind the numbers...
Benchmarks, performance, scalability, and capacity  what s behind the numbers...Benchmarks, performance, scalability, and capacity  what s behind the numbers...
Benchmarks, performance, scalability, and capacity what s behind the numbers...
james tong
 
Benchmarks, performance, scalability, and capacity what's behind the numbers
Benchmarks, performance, scalability, and capacity what's behind the numbersBenchmarks, performance, scalability, and capacity what's behind the numbers
Benchmarks, performance, scalability, and capacity what's behind the numbers
Justin Dorfman
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
Mukesh Singh
 
Testing data streaming applications
Testing data streaming applicationsTesting data streaming applications
Testing data streaming applications
Lars Albertsson
 
Bsdtw17: george neville neil: realities of dtrace on free-bsd
Bsdtw17: george neville neil: realities of dtrace on free-bsdBsdtw17: george neville neil: realities of dtrace on free-bsd
Bsdtw17: george neville neil: realities of dtrace on free-bsd
Scott Tsai
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
Wei Shan Ang
 
Machine learning and big data @ uber a tale of two systems
Machine learning and big data @ uber a tale of two systemsMachine learning and big data @ uber a tale of two systems
Machine learning and big data @ uber a tale of two systems
Zhenxiao Luo
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
Dmytro Semenov
 
Erlang: Software for a Concurrent world
Erlang: Software for a Concurrent worldErlang: Software for a Concurrent world
Erlang: Software for a Concurrent world
Arjan
 

Similar to erlang 101 (20)

Erlang OTP
Erlang OTPErlang OTP
Erlang OTP
 
An End to Order (many cores with java, session two)
An End to Order (many cores with java, session two)An End to Order (many cores with java, session two)
An End to Order (many cores with java, session two)
 
An End to Order
An End to OrderAn End to Order
An End to Order
 
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json  postgre-sql vs. mongodbPGConf APAC 2018 - High performance json  postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
Languages formanandmachine
Languages formanandmachineLanguages formanandmachine
Languages formanandmachine
 
Full stack development
Full stack developmentFull stack development
Full stack development
 
Sînică Alboaie - Programming for cloud computing Flows of asynchronous messages
Sînică Alboaie - Programming for cloud computing Flows of asynchronous messagesSînică Alboaie - Programming for cloud computing Flows of asynchronous messages
Sînică Alboaie - Programming for cloud computing Flows of asynchronous messages
 
Tips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development EfficiencyTips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development Efficiency
 
Introdução à Elixir
Introdução à ElixirIntrodução à Elixir
Introdução à Elixir
 
Reactive Software Systems
Reactive Software SystemsReactive Software Systems
Reactive Software Systems
 
Benchmarks, performance, scalability, and capacity what s behind the numbers...
Benchmarks, performance, scalability, and capacity  what s behind the numbers...Benchmarks, performance, scalability, and capacity  what s behind the numbers...
Benchmarks, performance, scalability, and capacity what s behind the numbers...
 
Benchmarks, performance, scalability, and capacity what's behind the numbers
Benchmarks, performance, scalability, and capacity what's behind the numbersBenchmarks, performance, scalability, and capacity what's behind the numbers
Benchmarks, performance, scalability, and capacity what's behind the numbers
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
 
Testing data streaming applications
Testing data streaming applicationsTesting data streaming applications
Testing data streaming applications
 
Bsdtw17: george neville neil: realities of dtrace on free-bsd
Bsdtw17: george neville neil: realities of dtrace on free-bsdBsdtw17: george neville neil: realities of dtrace on free-bsd
Bsdtw17: george neville neil: realities of dtrace on free-bsd
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
 
Machine learning and big data @ uber a tale of two systems
Machine learning and big data @ uber a tale of two systemsMachine learning and big data @ uber a tale of two systems
Machine learning and big data @ uber a tale of two systems
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
 
Erlang: Software for a Concurrent world
Erlang: Software for a Concurrent worldErlang: Software for a Concurrent world
Erlang: Software for a Concurrent world
 

More from Gokhan Boranalp

Zkernel
ZkernelZkernel
Zetaops ZOPS presentation
Zetaops ZOPS presentationZetaops ZOPS presentation
Zetaops ZOPS presentation
Gokhan Boranalp
 
Gdg izmir kubernetes
Gdg izmir kubernetesGdg izmir kubernetes
Gdg izmir kubernetes
Gokhan Boranalp
 
Google Cloud Platform Kubernetes Workshop IYTE
Google Cloud Platform Kubernetes Workshop IYTEGoogle Cloud Platform Kubernetes Workshop IYTE
Google Cloud Platform Kubernetes Workshop IYTE
Gokhan Boranalp
 
ZCloud Consensus on Hardware for Distributed Systems
ZCloud Consensus on Hardware for Distributed SystemsZCloud Consensus on Hardware for Distributed Systems
ZCloud Consensus on Hardware for Distributed Systems
Gokhan Boranalp
 
Zops intelligent platform
Zops intelligent platformZops intelligent platform
Zops intelligent platform
Gokhan Boranalp
 
Git 101
Git 101Git 101
Scrum ve Redmine ile yazılım projesi yönetimi
Scrum ve Redmine ile yazılım projesi yönetimiScrum ve Redmine ile yazılım projesi yönetimi
Scrum ve Redmine ile yazılım projesi yönetimi
Gokhan Boranalp
 
Nosql veritabanlari
Nosql veritabanlariNosql veritabanlari
Nosql veritabanlari
Gokhan Boranalp
 

More from Gokhan Boranalp (10)

Zkernel
ZkernelZkernel
Zkernel
 
Zetaops ZOPS presentation
Zetaops ZOPS presentationZetaops ZOPS presentation
Zetaops ZOPS presentation
 
Gdg izmir kubernetes
Gdg izmir kubernetesGdg izmir kubernetes
Gdg izmir kubernetes
 
Google Cloud Platform Kubernetes Workshop IYTE
Google Cloud Platform Kubernetes Workshop IYTEGoogle Cloud Platform Kubernetes Workshop IYTE
Google Cloud Platform Kubernetes Workshop IYTE
 
ZCloud Consensus on Hardware for Distributed Systems
ZCloud Consensus on Hardware for Distributed SystemsZCloud Consensus on Hardware for Distributed Systems
ZCloud Consensus on Hardware for Distributed Systems
 
Zops intelligent platform
Zops intelligent platformZops intelligent platform
Zops intelligent platform
 
Git 101
Git 101Git 101
Git 101
 
Scrum ve Redmine ile yazılım projesi yönetimi
Scrum ve Redmine ile yazılım projesi yönetimiScrum ve Redmine ile yazılım projesi yönetimi
Scrum ve Redmine ile yazılım projesi yönetimi
 
Nosql veritabanlari
Nosql veritabanlariNosql veritabanlari
Nosql veritabanlari
 
Erlang web-frameworks
Erlang web-frameworksErlang web-frameworks
Erlang web-frameworks
 

Recently uploaded

Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 

Recently uploaded (20)

Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 

erlang 101

  • 1. Erlang 101 Istanbul Hacker Space https://istanbulhs.org/ 25 Kasim 2012 Gokhan Boranalp gokhan@zetaops.com
  • 2. ● Nereden nereye. ○ Tarihçe ve şimdiki durum. ● Dil ● Önemli Noktalar ● Kullananlar ● Made with Erlang ● Sorular
  • 4. ● SHARED MEMORY WITH LOCKS ● SOFTWARE TRANSACTIONAL MEMORY (STM) ● FUTURES, PROMISES, AND SIMILAR ● MESSAGE PASSING Process Modelleri
  • 5. Karakteristik Özellikler ■ Message Passing ■ Dynamic typed ■ Actor model ■ Share Nothing ■ Immutable Objects
  • 6. Dil 1> io:format("Naber dunya~n"). Naber dunya ok 2> io:format("Naber, ~s!~n", [kanka]). Naber, kanka! ok - ~s = %s printf C - ~n = n
  • 7. Dil Atoms - true, false, test_me, kunthar@local, 'EXIT' Integers - 10, -200, 12345678909999999999999999999 - 16#FFffFFff=4294967295 - 16#FF= 255 - $A = 65 (ASCII kod A) Floats 3.14 -0.123 299792458.0 6.022137e23 6.6720e-11
  • 8. Dil Tuples - {1, 2, 3} {bir, iki, uc, dort} {buradan, "IHS", "sizi selamlar"} {complex, {nested, "structure", {here}}} Lists [] [1, 2, 3] [bir, iki, uc] [[1,2,3],[4,5,6]] [{yarin, "biraz oku"}, {sonra, "yuruyus yap"}, {enson, "otur da yaz"}]
  • 9. Dil String (list of ASCII codes) "merhaba" = [$m, $e, $r, $h, $a, $b, $a] = [109,101,114,104,97,98,97] Binaries <<0, 1, 2, ..., 255>> <<109,101,114,104,97,98,97>> = <<"merhaba">> Binaries with Bit Syntax <<1:1,32787:15>> = 2#1111111111111111 Diger Data Tipleri Funs (lambda expression or closure) Function-as-data-object
  • 11. Noktalama ○ (.) when hariç herşeyi sonlandir ○ (;) koşulu sonlandır ○ (,) ifadeyi (expressions) sonlandır
  • 12. List Comprehensions {2n : n in L} in Erlang: ○ brackets ({}) become square brackets ([]), ○ the colon (:) becomes two pipes (||) ○ and the word 'in' becomes the arrow (<-). 1> [2*N || N <- [1,2,3,4]]. [2,4,6,8]
  • 17. Erlang Önemli Noktalar ● Declarative ● Concurrency ● Soft real-time ● Robustness ● Distribution ● Hot code loading ● External Interfaces ● Portability ○ Functional programming language ○ High abstraction level ○ Pattern matching ○ Readable programs
  • 18. Erlang Önemli Noktalar ● Declarative ● Concurrency ● Soft real-time ● Robustness ● Distribution ● Hot code loading ● External Interfaces ● Portability ○ Solid concurrency model ○ Scales to handle complex concurrency ○ Simple abstractions Örnekler
  • 19. spawn ile yeni bir process yaratmak Pid = spawn(ex3,activity,[Joe,75,1024]) activity(Joe,75,1024)
  • 22. Erlang Önemli Noktalar ● Declarative ● Concurrency ● Soft real-time ● Robustness ● Distribution ● Hot code loading ● External Interfaces ● Portability ○ Lightweight processes ○ Fast message passing ○ Response times in the order of milliseconds efficient garbage collection Oynat Uğurcuğum
  • 25. Erlang Önemli Noktalar ● Declarative ● Concurrency ● Soft real-time ● Robustness ● Distribution ● Hot code loading ● External Interfaces ● Portability ○ Simple and consistent error recovery ○ Supervision hierarchies Örnekler
  • 26. process'ler birbirine bağlı çalışabilir!
  • 27. proses hata kontrolü - Proses sonlandığında, bağlı tüm proseslere exit sinyali gönderilir.
  • 28. hata kontrolü (2) - Exit sinyalleri "tuzaklanarak" (trap) messages şeklinde alınabilir.
  • 30. Error handling ● No global variables -- fewer side-effects ● No direct memory access -- no pointer errors ● No malloc/free bugs ● Solid concurrency model -- reduces synchronization problems, reduces the state space (simpler programs) ● Fault isolation -- memory-protected lightweight processes ● Built-in error recovery support -- more consistency Concurrency & Fault Tolerance were designed into the language from the start!
  • 31. Debugging and Profiling Support ● Symbolic crash reports ○ Usually sufficient info to locate bugs within minutes ● Built-in trace support ○ Function calls (ability to filter on module name, function and args) ○ Messages (+ sequence trace) ○ Process events (context switch, spawn, link, exit) ○ Garbage collections ○ Optionally with timestamps (can be used for profiling, benchmarks) ○ Trace to process, file, or port (network socket) ○ Also available on live systems
  • 32. Erlang Önemli Noktalar ● Declarative ● Concurrency ● Soft real-time ● Robustness ● Distribution ● Hot code loading ● External Interfaces ● Portability ○ Explicit or transparent distribution ○ Network-aware runtime system Örnekler
  • 33. Transparent Distribution - başka bir bilgisayara prosesler arası mesaj gönderimi, aynı bilgisayarda mesaj gönderimi kadar kolaydır.
  • 35. Erlang Önemli Noktalar ● Declarative ● Concurrency ● Soft real-time ● Robustness ● Distribution ● Hot code loading ● External Interfaces ● Portability ○ Easily change code in a running system ○ Enables non-stop operation ○ Simplifies testing
  • 36. Erlang Önemli Noktalar ● Declarative ● Concurrency ● Soft real-time ● Robustness ● Distribution ● Hot code loading ● External Interfaces ● Portability ○ Ports to the outside world ○ behave as Erlang processes - Erlang Port Drivers
  • 37. Erlang Önemli Noktalar ● Declarative ● Concurrency ● Soft real-time ● Robustness ● Distribution ● Hot code loading ● External Interfaces ● Portability ○ Any UNIX ○ Windows ○ VxWorks etc.
  • 39. Erlang/OTP (Open Telecom Platform) ● Middleware for Erlang development ● Designed for fault tolerance and portability ● Behaviors: A formalization of design patterns ● Components ○ Error handling, reporting and logging ○ Mnesia, distributed real-time database management system CORBA, IDL Compiler, Java & C Interface Support ○ HTTP Server + Client, FTP Client ○ SNMP Agent + ASN.1 Compiler ○ H.248 ○ XML ○ ...
  • 40. OTP Behaviors ● "A formalization of design patterns" ○ A framework + generic code to solve a common problem ○ Built-in support for debugging and software upgrade ○ Makes it easier to reason about the behavior of a program ● Examples of OTP behaviors application defines how an application is implemented supervisor used to write fault-tolerant supervision trees gen_server for writing client-server applications gen_event for writing event handlers gen_fsm for finite state machine programming
  • 41. Büyük Projelerde Erlang ● Easy to build a first runnable application ● Easy to debug ● Easy to maintain ● Very strong support for fault tolerance ● Suitable for large systems/projects ● Great for prototyping ● Impressive performance/scalability in real applications Outstanding tool for test automation ● High programmer satisfaction
  • 42. Kullananlar ● Amazon Web Servisleri - SQS ve SimpleDB ● Facebook, chat ● Twitter ● Mochimedia ● del.icio.us / Yahoo ● T-Mobile ● Telia ● Bluetail/Alteon/Nortel ● Github
  • 43. Made with Erlang ○ Apache CouchDB – document-based DB with REST ○ Disco – Map/Reduce framework for Erlang ○ Fuzed – Generic clustering framework (Powerset) ○ Mochiweb – Fast lightweight web server framework (like Java Servlets for Erlang) ○ DHT – Distributed Key/Value Stores – 90% of all implementations in Erlang – Dynomite, Scalaris, etc. ○ Yaws web server ○ Cowboy ○ Nitrogen ○ RabbitMQ ○ Riak
  • 44. Good fit for ● Irregular concurrency ○ Task-level parallelism ○ Fine-grained parallelism ● Network servers ● Distributed systems ● Middleware: ○ Parallel databases ○ Message Queue servers ● Soft Real-Time / Embedded applications ● Monitoring, control and testing tools