concurrent applications with f# agents

19
presented by Rachel Reese Twitter #fsharp #codemash @rachelreese @fireflylogic Concurrent Applications with F# Agents

Upload: rachel-reese

Post on 15-Dec-2014

448 views

Category:

Technology


0 download

DESCRIPTION

To build today's responsive and scalable applications, developers need to start leveraging asynchronous programming methods. During this talk, we'll explore how developers can easily use the F# agent-based programming model, which is based upon the actor concurrency model first made popular in Erlang, to simply and quickly build concurrent applications.

TRANSCRIPT

Page 1: Concurrent Applications with F# Agents

presented by

Rachel Reese

Twitter

#fsharp#codemash

@rachelreese@fireflylogic

Concurrent Applications with F# Agents

Page 2: Concurrent Applications with F# Agents

What are F# agents?

F#’s implementation of Erlang-style message passing

(also in Clojure, Scala, Elixir (and many others))

[But there are differences.]

Page 3: Concurrent Applications with F# Agents

What is Erlang-style message passing?

Hello,

Joe!

Erlang’s message passing is based on the actor model devised by Carl Hewitt et al. in 1973.

Page 4: Concurrent Applications with F# Agents

What is the actor model?

dynamic creation of actors

inclusion of actor addresses in messages

interaction only through direct asynchronous message passing

no restriction on message arrival order

Page 5: Concurrent Applications with F# Agents

What is an actor?

Everything

An actor is an independent computational entity which contains a queue, and receives and processes messages.

Page 6: Concurrent Applications with F# Agents

What can an actor do?

Determine what to do with the next incoming message

Create more actors

Send messages to another actor

Page 7: Concurrent Applications with F# Agents

“One actor is no actor. They come in systems.”

- Carl Hewitt

Page 8: Concurrent Applications with F# Agents

from: http://www.developerfusion.com/article/140677/writing-concurrent-applications-using-f-agents/

What does a system of actors look like?

Page 9: Concurrent Applications with F# Agents

Genes maestros de regulación, from: http://cienciasdejoseleg.blogspot.com/2011/10/genes-maestros-de-regulacion.html

What does a system of actors look like?

Page 10: Concurrent Applications with F# Agents

Ingredient networks for recipe data, from: http://www.ladamic.com/wordpress/?p=294

What does a system of actors look like?

Page 11: Concurrent Applications with F# Agents

Tokyo Subway Map, from: http://www.speedymole.com/Tubes/Tokyo/tokyo-subway-map.html

What does a system of actors look like?

Page 12: Concurrent Applications with F# Agents

What is the actor model?

dynamic creation of actors

inclusion of actor addresses in messages

interaction only through direct asynchronous message passing

no restriction on message arrival order

Page 13: Concurrent Applications with F# Agents

What are F# agents?

F#’s implementation of Erlang-style message passing

(also in Clojure, Scala, Elixir (and many others))

[But there are differences.]

Page 14: Concurrent Applications with F# Agents

Definitions

Asynchronous

Non-blocking, specifically in

reference to I/O operations (not

necessarily parallel, can be sequential.)

ParallelMultiple operations processed simultaneously.

ConcurrentMultiple operations happening at the same time (not necessarily in parallel).

Page 15: Concurrent Applications with F# Agents

Demos: Intro, Replies, Scanning, Emailer

Page 16: Concurrent Applications with F# Agents

What are some major differences between F# agents & Erlang’s message passing?

F# agents are

contained in-process;

they are not distributed.

Lack of support for supervisors.

No built-in durable

mailboxes.

Page 17: Concurrent Applications with F# Agents

Demo: FSharp.Actor framework

Page 18: Concurrent Applications with F# Agents

Additional Resources

Actors and Agents

Fsharp.Actor

TPL Dataflow

ActorFx

Orleans

Hewitt, Meijer, and Szyperski C9

Async and Parallel Design Patterns in F# Agents

An Introduction to Agents

Image pipeline using agents

Building an actor in F# w/ higher throughput than Akka or Erlang

F# MailboxProcessor

Building clean and cohesive concurrent systems with F# agents

F# in general, and Async, Concurrency, & Parallelism

Try F#

F# Koans

SkillsMatter

FsSnip

F# Chat on IRC or JabbR

The Hitchhiker’s Guide to Concurrency

F# Asynchronous Programming Model

Page 19: Concurrent Applications with F# Agents

Rachel ReeseTwitter: @rachelreeseEmail: [email protected]

Firefly Logic, Inc.1000 Main Street #201Nashville, TN 37206

http://fireflylogic.com

Thanks!