SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
Go Synchronized
Andrej Vckovski
What I want to transmit

 Go is useful and neat for heavily
concurrent applications
 Webrockets socks!

Go synchronized

2
A small poll

Point your [smartphone] browser to

nca.me/l
Go synchronized

3
nca.me/l

Go synchronized

4
nca.me/l

Go synchronized

5
About go
 Started by Robert Griesemer, Rob Pike and Ken
Thompson in Fall 2007,
Open-sourced 2009, Go 1 March 2012
 Main features

– C/Pascal/Modula-like, garbage collected, no pointer
arithmetics, type safe, very fast compiler
– Simple type system without hierarchies
– Concepts for concurrent programming in the “CSP”-style
– Embeds dependency management
– Today about similar memory/execution-performance as
Java or Node.

Go synchronized

6
Concurrency?
 Separate, potentially simultaneously executed
computations
 Usually somehow interacting
 Candidates to leverage multi-{core|cpu|node}
environments
 Usually but not necessarily correspond to multiple users
 Often on the server side
And hard to make it right
Go synchronized

7
Go and concurrency
Communicating Sequential Processes (CSP) pattern
(C. A. R. Hoare, 1978)
1. Channels
2. Go-routines
3. select-statement

“Do not communicate by sharing memory;
instead, share memory by communicating”
Occam, Erlang, Newsqueak, Limbo, Clojure and many more
Go synchronized

8
Example
package main
import ("fmt"; "time"; "math/rand")
func main() {
table := make(chan string)
for _, player := range [...]string{"alice", "bob"} {
go func(who string) {
num := 0;
for {
ball := <- table;
fmt.Printf("player %s: %sn", who, ball)
table <- fmt.Sprintf("tick-%s-%d",who,num)
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
num++
}
}(player)
}
table <- "go"
time.Sleep(10 * time.Second)
}

Go synchronized

9
The application:
Very Instant Massive (Audience) Polling
 Presentations
like this one
 TV shows with
added
interactivity
 Pause
entertainment in
a stadium
 Flipped
Classrooms
Go synchronized

© Nhenze

© Chris Lawrence

© Loozrboy

© Jeff Chenqinyi

10
Browser
JS
that
displays
questions
and
allows
voting

System context

go

Browser
JS
that
displays
questions
and
allows
voting

ipoll
server

Presentation Software (e.g., PowerPoint)

JS
Browser
JS
that
displays
questions
and
allows
voting

Go synchronized

Browser that displays
voting results

11
Browser
JS
that
displays
questions
and
allows
voting

WebSockets

go

 Full-duplex conversation
ipoll
over TCP connectionserver
 JS
RFC 6455
 Available in most modern
browsers
 Simple JavaScript binding
JS
 Handshake by HTTP then
,
user-defined messages over
the same socket

Client
(Browser)
HTTP GET Request,
special attributes
HTTP response
“switch protocol”

Browser
that
displays
questions
and
allows
voting

Browser
that
displays
questions
and
allows
voting

Go synchronized

Server

Message

Presentation Software (e.g., PowerPoint)

JS

Message
Message
Browser that displays
voting results
Message

Message
12
Multiplexer
and
Demultiplexer

Browser
that
displays
questions
and
allows
voting

Browser
that
displays
questions
and
allows
voting

Browser
that
displays
questions
and
allows
voting

Go synchronized

ipoll
server

Presentation Software (e.g., PowerPoint)

Browser that displays
voting results

13
Small Demo

Point your smartphone browser to

nca.me/l
Go synchronized

14
Demo: New Question 1

nca.me/l
Go synchronized

15
Demo: New Question 2

nca.me/l
Go synchronized

16
Demo: New Question 3

nca.me/l
Go synchronized

17
WebSocket on server side (go)
func startWebserver() {
// [...]

http.HandleFunc("/svy", surveyHandler)
}

Go

// [...]

func surveyHandler(c http.ResponseWriter, req *http.Request) {
// [...]
go websocket.Handler(func (ws *websocket.Conn) { s.VoterHandler(ws)} ).ServeHTTP(c, req)
// [...]
}
func (s *Survey) VoterHandler(ws *websocket.Conn) {
defer func() {
s.voterChan <- voter{ws, false}
log.Printf("connection closed by client")
ws.Close()
}()
s.voterChan <- voter{ws, true} // notify hub of a new voter
for {
// [...]
len, err := ws.Read(buf)
// [...]
var v vote
err = json.Unmarshal(buf, &v)
if err == nil {
s.voteChan <- v
} else {
// [...]
}
}
synchronized
}

18
Core data massaged at a single place:
The “model” implements an event-loop
func (s *Survey) surveyHub() {
// [...]
t := time.NewTicker(100 * time.Millisecond)
// [...]
for {
select {
case _ = <-t.C: // tick arrived
// [...]
case ctrl := <-s.controlChan: // control message
// [...]
case voter := <-s.voterChan: // voter subscribed
// [...]
case viewer := <-s.viewerChan: // viewer subscribed
// [...]
case admin := <-s.adminChan: // admin subscribed
// [...]
case vote := <-s.voteChan: // a vote arrived
// [...]
}
}
}

19
Conclusions

 Go (or “CSP”-design) has massively
simplified the concurrency challenges
 WebSockets are easy to use and will be
increasingly popular

Go synchronized

20
http://golang.org
Rob Pike on “concurrency is not parallelism”:
http://vimeo.com/49718712
(mascot by Renée French)
Bonus poll

Go synchronized

nca.me/l

22
Thanks for the attention!
andrej.vckovski@netcetera.com
netcetera.com
ipoll.ch
(coming soon)

Contenu connexe

Tendances

Fscons future transports
Fscons future transportsFscons future transports
Fscons future transportsDaniel Stenberg
 
Timeless - Websocket on Rails
Timeless - Websocket on RailsTimeless - Websocket on Rails
Timeless - Websocket on RailsFramgia Vietnam
 
internet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcainternet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcaRenu Thakur
 
What Could Microsoft Do To Make PHP Run Better On Windows
What Could Microsoft Do To Make PHP Run Better On WindowsWhat Could Microsoft Do To Make PHP Run Better On Windows
What Could Microsoft Do To Make PHP Run Better On WindowsManuel Lemos
 
All Aboard The Stateful Train
All Aboard The Stateful TrainAll Aboard The Stateful Train
All Aboard The Stateful TrainSmartLogic
 
Resource Prioritization
Resource PrioritizationResource Prioritization
Resource PrioritizationPatrick Meenan
 
Ajax Patterns : Periodic Refresh & Multi Stage Download
Ajax Patterns : Periodic Refresh & Multi Stage DownloadAjax Patterns : Periodic Refresh & Multi Stage Download
Ajax Patterns : Periodic Refresh & Multi Stage DownloadEshan Mudwel
 
Java concurrency
Java concurrencyJava concurrency
Java concurrencyfbenault
 

Tendances (9)

Fscons future transports
Fscons future transportsFscons future transports
Fscons future transports
 
Timeless - Websocket on Rails
Timeless - Websocket on RailsTimeless - Websocket on Rails
Timeless - Websocket on Rails
 
internet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcainternet programming and java notes 5th sem mca
internet programming and java notes 5th sem mca
 
Web Sockets - HTML5
Web Sockets - HTML5Web Sockets - HTML5
Web Sockets - HTML5
 
What Could Microsoft Do To Make PHP Run Better On Windows
What Could Microsoft Do To Make PHP Run Better On WindowsWhat Could Microsoft Do To Make PHP Run Better On Windows
What Could Microsoft Do To Make PHP Run Better On Windows
 
All Aboard The Stateful Train
All Aboard The Stateful TrainAll Aboard The Stateful Train
All Aboard The Stateful Train
 
Resource Prioritization
Resource PrioritizationResource Prioritization
Resource Prioritization
 
Ajax Patterns : Periodic Refresh & Multi Stage Download
Ajax Patterns : Periodic Refresh & Multi Stage DownloadAjax Patterns : Periodic Refresh & Multi Stage Download
Ajax Patterns : Periodic Refresh & Multi Stage Download
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 

En vedette

Resume_Mounika_Transcriptionist
Resume_Mounika_TranscriptionistResume_Mounika_Transcriptionist
Resume_Mounika_TranscriptionistMounika Doolam
 
Ab0401 e learning sharon,may,mirnawaty,bi jun,linda
Ab0401  e learning sharon,may,mirnawaty,bi jun,lindaAb0401  e learning sharon,may,mirnawaty,bi jun,linda
Ab0401 e learning sharon,may,mirnawaty,bi jun,lindaNBS
 
Brosjyre - Lindesnes fyr - Norge
Brosjyre - Lindesnes fyr  - NorgeBrosjyre - Lindesnes fyr  - Norge
Brosjyre - Lindesnes fyr - NorgeLindesnesFyr
 
Green Grass ppt template
Green Grass ppt templateGreen Grass ppt template
Green Grass ppt templateteodorszasz
 
You Talking to me? Dwustronna komunikacja w Social Media.
You Talking to me? Dwustronna komunikacja w Social Media.You Talking to me? Dwustronna komunikacja w Social Media.
You Talking to me? Dwustronna komunikacja w Social Media.Michal Kowalik
 
Textual strategies Plastic Tactics - Kendall R. Philips
Textual strategies Plastic Tactics - Kendall R. PhilipsTextual strategies Plastic Tactics - Kendall R. Philips
Textual strategies Plastic Tactics - Kendall R. PhilipsBurak Taşdizen
 
m. fagaras
m. fagarasm. fagaras
m. fagarastearox
 
Herpes Healing
Herpes HealingHerpes Healing
Herpes Healingbullandhe
 
Rpp kelas 4 2013
Rpp kelas 4 2013Rpp kelas 4 2013
Rpp kelas 4 2013yudiyunika
 
Recruit presenter 2013
Recruit presenter 2013Recruit presenter 2013
Recruit presenter 2013mwappett
 
Presentacion de andrea internet
Presentacion de andrea internetPresentacion de andrea internet
Presentacion de andrea internetlmabaldovinon
 
информатика в лицах
информатика в лицахинформатика в лицах
информатика в лицахzupar
 

En vedette (15)

Resume_Mounika_Transcriptionist
Resume_Mounika_TranscriptionistResume_Mounika_Transcriptionist
Resume_Mounika_Transcriptionist
 
便宜又便利的工作室出租
便宜又便利的工作室出租便宜又便利的工作室出租
便宜又便利的工作室出租
 
MY_UPDATED_RESUME
MY_UPDATED_RESUMEMY_UPDATED_RESUME
MY_UPDATED_RESUME
 
Ab0401 e learning sharon,may,mirnawaty,bi jun,linda
Ab0401  e learning sharon,may,mirnawaty,bi jun,lindaAb0401  e learning sharon,may,mirnawaty,bi jun,linda
Ab0401 e learning sharon,may,mirnawaty,bi jun,linda
 
Brosjyre - Lindesnes fyr - Norge
Brosjyre - Lindesnes fyr  - NorgeBrosjyre - Lindesnes fyr  - Norge
Brosjyre - Lindesnes fyr - Norge
 
Green Grass ppt template
Green Grass ppt templateGreen Grass ppt template
Green Grass ppt template
 
You Talking to me? Dwustronna komunikacja w Social Media.
You Talking to me? Dwustronna komunikacja w Social Media.You Talking to me? Dwustronna komunikacja w Social Media.
You Talking to me? Dwustronna komunikacja w Social Media.
 
Textual strategies Plastic Tactics - Kendall R. Philips
Textual strategies Plastic Tactics - Kendall R. PhilipsTextual strategies Plastic Tactics - Kendall R. Philips
Textual strategies Plastic Tactics - Kendall R. Philips
 
MATRIC
MATRICMATRIC
MATRIC
 
m. fagaras
m. fagarasm. fagaras
m. fagaras
 
Herpes Healing
Herpes HealingHerpes Healing
Herpes Healing
 
Rpp kelas 4 2013
Rpp kelas 4 2013Rpp kelas 4 2013
Rpp kelas 4 2013
 
Recruit presenter 2013
Recruit presenter 2013Recruit presenter 2013
Recruit presenter 2013
 
Presentacion de andrea internet
Presentacion de andrea internetPresentacion de andrea internet
Presentacion de andrea internet
 
информатика в лицах
информатика в лицахинформатика в лицах
информатика в лицах
 

Similaire à JAZOON'13 - Andrej Vckovski - Go synchronized

LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :) LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :) Sascha Sambale
 
Web Development Environments: Choose the best or go with the rest
Web Development Environments:  Choose the best or go with the restWeb Development Environments:  Choose the best or go with the rest
Web Development Environments: Choose the best or go with the restgeorge.james
 
Beyond Java: Go for Java developers
Beyond Java: Go for Java developersBeyond Java: Go for Java developers
Beyond Java: Go for Java developersNetcetera
 
150603 go go-beyond-vckovski-jugs
150603 go go-beyond-vckovski-jugs150603 go go-beyond-vckovski-jugs
150603 go go-beyond-vckovski-jugsNetcetera
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN StackRob Davarnia
 
Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassSpike Brehm
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application developmentzonathen
 
Get Started with JavaScript Frameworks
Get Started with JavaScript FrameworksGet Started with JavaScript Frameworks
Get Started with JavaScript FrameworksChristian Gaetano
 
Front End Development | Introduction
Front End Development | IntroductionFront End Development | Introduction
Front End Development | IntroductionJohnTaieb
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS UniverseStefano Di Paola
 
Over view of Technologies
Over view of TechnologiesOver view of Technologies
Over view of TechnologiesChris Mitchell
 
Node Js Non-blocking or asynchronous Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous  Blocking or synchronous.pdfNode Js Non-blocking or asynchronous  Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous Blocking or synchronous.pdfDarshanaMallick
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleIT Arena
 
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R..."Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...Fwdays
 
Would Mr. Spok choose Open Source
Would Mr. Spok choose Open SourceWould Mr. Spok choose Open Source
Would Mr. Spok choose Open Sourcevlcinsky
 

Similaire à JAZOON'13 - Andrej Vckovski - Go synchronized (20)

LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :) LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :)
 
NodeJS
NodeJSNodeJS
NodeJS
 
Real time web
Real time webReal time web
Real time web
 
Proposal
ProposalProposal
Proposal
 
Web Development Environments: Choose the best or go with the rest
Web Development Environments:  Choose the best or go with the restWeb Development Environments:  Choose the best or go with the rest
Web Development Environments: Choose the best or go with the rest
 
Beyond Java: Go for Java developers
Beyond Java: Go for Java developersBeyond Java: Go for Java developers
Beyond Java: Go for Java developers
 
150603 go go-beyond-vckovski-jugs
150603 go go-beyond-vckovski-jugs150603 go go-beyond-vckovski-jugs
150603 go go-beyond-vckovski-jugs
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master Class
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
Get Started with JavaScript Frameworks
Get Started with JavaScript FrameworksGet Started with JavaScript Frameworks
Get Started with JavaScript Frameworks
 
Front End Development | Introduction
Front End Development | IntroductionFront End Development | Introduction
Front End Development | Introduction
 
WEB BROWSER
WEB BROWSERWEB BROWSER
WEB BROWSER
 
Coffee script throwdown
Coffee script throwdownCoffee script throwdown
Coffee script throwdown
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe
 
Over view of Technologies
Over view of TechnologiesOver view of Technologies
Over view of Technologies
 
Node Js Non-blocking or asynchronous Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous  Blocking or synchronous.pdfNode Js Non-blocking or asynchronous  Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous Blocking or synchronous.pdf
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R..."Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
 
Would Mr. Spok choose Open Source
Would Mr. Spok choose Open SourceWould Mr. Spok choose Open Source
Would Mr. Spok choose Open Source
 

Plus de jazoon13

JAZOON'13 - Joe Justice - Test First Saves The World
JAZOON'13 - Joe Justice - Test First Saves The WorldJAZOON'13 - Joe Justice - Test First Saves The World
JAZOON'13 - Joe Justice - Test First Saves The Worldjazoon13
 
JAZOON'13 - Ulrika Park- User Story telling The Lost Art of User Stories
JAZOON'13 - Ulrika Park- User Story telling The Lost Art of User StoriesJAZOON'13 - Ulrika Park- User Story telling The Lost Art of User Stories
JAZOON'13 - Ulrika Park- User Story telling The Lost Art of User Storiesjazoon13
 
JAZOON'13 - Bartosz Majsak - Git Workshop - Kung Fu
JAZOON'13 - Bartosz Majsak - Git Workshop - Kung FuJAZOON'13 - Bartosz Majsak - Git Workshop - Kung Fu
JAZOON'13 - Bartosz Majsak - Git Workshop - Kung Fujazoon13
 
JAZOON'13 - Thomas Hug & Bartosz Majsak - Git Workshop -Essentials
JAZOON'13 - Thomas Hug & Bartosz Majsak - Git Workshop -EssentialsJAZOON'13 - Thomas Hug & Bartosz Majsak - Git Workshop -Essentials
JAZOON'13 - Thomas Hug & Bartosz Majsak - Git Workshop -Essentialsjazoon13
 
JAZOON'13 - Oliver Zeigermann - Typed JavaScript with TypeScript
JAZOON'13 - Oliver Zeigermann - Typed JavaScript with TypeScriptJAZOON'13 - Oliver Zeigermann - Typed JavaScript with TypeScript
JAZOON'13 - Oliver Zeigermann - Typed JavaScript with TypeScriptjazoon13
 
JAZOON'13 - Andres Almiray - Spock: boldly go where no test has gone before
JAZOON'13 - Andres Almiray - Spock: boldly go where no test has gone beforeJAZOON'13 - Andres Almiray - Spock: boldly go where no test has gone before
JAZOON'13 - Andres Almiray - Spock: boldly go where no test has gone beforejazoon13
 
JAZOON'13 - Andres Almiray - Rocket Propelled Java
JAZOON'13 - Andres Almiray - Rocket Propelled JavaJAZOON'13 - Andres Almiray - Rocket Propelled Java
JAZOON'13 - Andres Almiray - Rocket Propelled Javajazoon13
 
JAZOON'13 - Sven Peters - How to do Kick-Ass Software Development
JAZOON'13 - Sven Peters - How to do Kick-Ass Software DevelopmentJAZOON'13 - Sven Peters - How to do Kick-Ass Software Development
JAZOON'13 - Sven Peters - How to do Kick-Ass Software Developmentjazoon13
 
JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...
JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...
JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...jazoon13
 
JAZOON'13 - Pawel Wrzeszcz - Visibility Shift In Distributed Teams
JAZOON'13 - Pawel Wrzeszcz - Visibility Shift In Distributed TeamsJAZOON'13 - Pawel Wrzeszcz - Visibility Shift In Distributed Teams
JAZOON'13 - Pawel Wrzeszcz - Visibility Shift In Distributed Teamsjazoon13
 
JAZOON'13 - Kai Waehner - Hadoop Integration
JAZOON'13 - Kai Waehner - Hadoop IntegrationJAZOON'13 - Kai Waehner - Hadoop Integration
JAZOON'13 - Kai Waehner - Hadoop Integrationjazoon13
 
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next GenerationJAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generationjazoon13
 
JAZOON'13 - Guide Schmutz - Kafka and Strom Event Processing In Realtime
JAZOON'13 - Guide Schmutz - Kafka and Strom Event Processing In RealtimeJAZOON'13 - Guide Schmutz - Kafka and Strom Event Processing In Realtime
JAZOON'13 - Guide Schmutz - Kafka and Strom Event Processing In Realtimejazoon13
 
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experienceJAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experiencejazoon13
 
JAZOON'13 - Anatole Tresch - Go for the money (JSR 354) !
JAZOON'13 - Anatole Tresch - Go for the money (JSR 354) !JAZOON'13 - Anatole Tresch - Go for the money (JSR 354) !
JAZOON'13 - Anatole Tresch - Go for the money (JSR 354) !jazoon13
 
JAZOON'13 - Abdelmonaim Remani - The Economies of Scaling Software
JAZOON'13 - Abdelmonaim Remani - The Economies of Scaling SoftwareJAZOON'13 - Abdelmonaim Remani - The Economies of Scaling Software
JAZOON'13 - Abdelmonaim Remani - The Economies of Scaling Softwarejazoon13
 
JAZOON'13 - Stefan Saasen - True Git: The Great Migration
JAZOON'13 - Stefan Saasen - True Git: The Great MigrationJAZOON'13 - Stefan Saasen - True Git: The Great Migration
JAZOON'13 - Stefan Saasen - True Git: The Great Migrationjazoon13
 
JAZOON'13 - Stefan Saasen - Real World Git Workflows
JAZOON'13 - Stefan Saasen - Real World Git WorkflowsJAZOON'13 - Stefan Saasen - Real World Git Workflows
JAZOON'13 - Stefan Saasen - Real World Git Workflowsjazoon13
 

Plus de jazoon13 (18)

JAZOON'13 - Joe Justice - Test First Saves The World
JAZOON'13 - Joe Justice - Test First Saves The WorldJAZOON'13 - Joe Justice - Test First Saves The World
JAZOON'13 - Joe Justice - Test First Saves The World
 
JAZOON'13 - Ulrika Park- User Story telling The Lost Art of User Stories
JAZOON'13 - Ulrika Park- User Story telling The Lost Art of User StoriesJAZOON'13 - Ulrika Park- User Story telling The Lost Art of User Stories
JAZOON'13 - Ulrika Park- User Story telling The Lost Art of User Stories
 
JAZOON'13 - Bartosz Majsak - Git Workshop - Kung Fu
JAZOON'13 - Bartosz Majsak - Git Workshop - Kung FuJAZOON'13 - Bartosz Majsak - Git Workshop - Kung Fu
JAZOON'13 - Bartosz Majsak - Git Workshop - Kung Fu
 
JAZOON'13 - Thomas Hug & Bartosz Majsak - Git Workshop -Essentials
JAZOON'13 - Thomas Hug & Bartosz Majsak - Git Workshop -EssentialsJAZOON'13 - Thomas Hug & Bartosz Majsak - Git Workshop -Essentials
JAZOON'13 - Thomas Hug & Bartosz Majsak - Git Workshop -Essentials
 
JAZOON'13 - Oliver Zeigermann - Typed JavaScript with TypeScript
JAZOON'13 - Oliver Zeigermann - Typed JavaScript with TypeScriptJAZOON'13 - Oliver Zeigermann - Typed JavaScript with TypeScript
JAZOON'13 - Oliver Zeigermann - Typed JavaScript with TypeScript
 
JAZOON'13 - Andres Almiray - Spock: boldly go where no test has gone before
JAZOON'13 - Andres Almiray - Spock: boldly go where no test has gone beforeJAZOON'13 - Andres Almiray - Spock: boldly go where no test has gone before
JAZOON'13 - Andres Almiray - Spock: boldly go where no test has gone before
 
JAZOON'13 - Andres Almiray - Rocket Propelled Java
JAZOON'13 - Andres Almiray - Rocket Propelled JavaJAZOON'13 - Andres Almiray - Rocket Propelled Java
JAZOON'13 - Andres Almiray - Rocket Propelled Java
 
JAZOON'13 - Sven Peters - How to do Kick-Ass Software Development
JAZOON'13 - Sven Peters - How to do Kick-Ass Software DevelopmentJAZOON'13 - Sven Peters - How to do Kick-Ass Software Development
JAZOON'13 - Sven Peters - How to do Kick-Ass Software Development
 
JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...
JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...
JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...
 
JAZOON'13 - Pawel Wrzeszcz - Visibility Shift In Distributed Teams
JAZOON'13 - Pawel Wrzeszcz - Visibility Shift In Distributed TeamsJAZOON'13 - Pawel Wrzeszcz - Visibility Shift In Distributed Teams
JAZOON'13 - Pawel Wrzeszcz - Visibility Shift In Distributed Teams
 
JAZOON'13 - Kai Waehner - Hadoop Integration
JAZOON'13 - Kai Waehner - Hadoop IntegrationJAZOON'13 - Kai Waehner - Hadoop Integration
JAZOON'13 - Kai Waehner - Hadoop Integration
 
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next GenerationJAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
 
JAZOON'13 - Guide Schmutz - Kafka and Strom Event Processing In Realtime
JAZOON'13 - Guide Schmutz - Kafka and Strom Event Processing In RealtimeJAZOON'13 - Guide Schmutz - Kafka and Strom Event Processing In Realtime
JAZOON'13 - Guide Schmutz - Kafka and Strom Event Processing In Realtime
 
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experienceJAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
 
JAZOON'13 - Anatole Tresch - Go for the money (JSR 354) !
JAZOON'13 - Anatole Tresch - Go for the money (JSR 354) !JAZOON'13 - Anatole Tresch - Go for the money (JSR 354) !
JAZOON'13 - Anatole Tresch - Go for the money (JSR 354) !
 
JAZOON'13 - Abdelmonaim Remani - The Economies of Scaling Software
JAZOON'13 - Abdelmonaim Remani - The Economies of Scaling SoftwareJAZOON'13 - Abdelmonaim Remani - The Economies of Scaling Software
JAZOON'13 - Abdelmonaim Remani - The Economies of Scaling Software
 
JAZOON'13 - Stefan Saasen - True Git: The Great Migration
JAZOON'13 - Stefan Saasen - True Git: The Great MigrationJAZOON'13 - Stefan Saasen - True Git: The Great Migration
JAZOON'13 - Stefan Saasen - True Git: The Great Migration
 
JAZOON'13 - Stefan Saasen - Real World Git Workflows
JAZOON'13 - Stefan Saasen - Real World Git WorkflowsJAZOON'13 - Stefan Saasen - Real World Git Workflows
JAZOON'13 - Stefan Saasen - Real World Git Workflows
 

Dernier

Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 

Dernier (20)

Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 

JAZOON'13 - Andrej Vckovski - Go synchronized

  • 2. What I want to transmit  Go is useful and neat for heavily concurrent applications  Webrockets socks! Go synchronized 2
  • 3. A small poll Point your [smartphone] browser to nca.me/l Go synchronized 3
  • 6. About go  Started by Robert Griesemer, Rob Pike and Ken Thompson in Fall 2007, Open-sourced 2009, Go 1 March 2012  Main features – C/Pascal/Modula-like, garbage collected, no pointer arithmetics, type safe, very fast compiler – Simple type system without hierarchies – Concepts for concurrent programming in the “CSP”-style – Embeds dependency management – Today about similar memory/execution-performance as Java or Node. Go synchronized 6
  • 7. Concurrency?  Separate, potentially simultaneously executed computations  Usually somehow interacting  Candidates to leverage multi-{core|cpu|node} environments  Usually but not necessarily correspond to multiple users  Often on the server side And hard to make it right Go synchronized 7
  • 8. Go and concurrency Communicating Sequential Processes (CSP) pattern (C. A. R. Hoare, 1978) 1. Channels 2. Go-routines 3. select-statement “Do not communicate by sharing memory; instead, share memory by communicating” Occam, Erlang, Newsqueak, Limbo, Clojure and many more Go synchronized 8
  • 9. Example package main import ("fmt"; "time"; "math/rand") func main() { table := make(chan string) for _, player := range [...]string{"alice", "bob"} { go func(who string) { num := 0; for { ball := <- table; fmt.Printf("player %s: %sn", who, ball) table <- fmt.Sprintf("tick-%s-%d",who,num) time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) num++ } }(player) } table <- "go" time.Sleep(10 * time.Second) } Go synchronized 9
  • 10. The application: Very Instant Massive (Audience) Polling  Presentations like this one  TV shows with added interactivity  Pause entertainment in a stadium  Flipped Classrooms Go synchronized © Nhenze © Chris Lawrence © Loozrboy © Jeff Chenqinyi 10
  • 11. Browser JS that displays questions and allows voting System context go Browser JS that displays questions and allows voting ipoll server Presentation Software (e.g., PowerPoint) JS Browser JS that displays questions and allows voting Go synchronized Browser that displays voting results 11
  • 12. Browser JS that displays questions and allows voting WebSockets go  Full-duplex conversation ipoll over TCP connectionserver  JS RFC 6455  Available in most modern browsers  Simple JavaScript binding JS  Handshake by HTTP then , user-defined messages over the same socket Client (Browser) HTTP GET Request, special attributes HTTP response “switch protocol” Browser that displays questions and allows voting Browser that displays questions and allows voting Go synchronized Server Message Presentation Software (e.g., PowerPoint) JS Message Message Browser that displays voting results Message Message 12
  • 14. Small Demo Point your smartphone browser to nca.me/l Go synchronized 14
  • 15. Demo: New Question 1 nca.me/l Go synchronized 15
  • 16. Demo: New Question 2 nca.me/l Go synchronized 16
  • 17. Demo: New Question 3 nca.me/l Go synchronized 17
  • 18. WebSocket on server side (go) func startWebserver() { // [...] http.HandleFunc("/svy", surveyHandler) } Go // [...] func surveyHandler(c http.ResponseWriter, req *http.Request) { // [...] go websocket.Handler(func (ws *websocket.Conn) { s.VoterHandler(ws)} ).ServeHTTP(c, req) // [...] } func (s *Survey) VoterHandler(ws *websocket.Conn) { defer func() { s.voterChan <- voter{ws, false} log.Printf("connection closed by client") ws.Close() }() s.voterChan <- voter{ws, true} // notify hub of a new voter for { // [...] len, err := ws.Read(buf) // [...] var v vote err = json.Unmarshal(buf, &v) if err == nil { s.voteChan <- v } else { // [...] } } synchronized } 18
  • 19. Core data massaged at a single place: The “model” implements an event-loop func (s *Survey) surveyHub() { // [...] t := time.NewTicker(100 * time.Millisecond) // [...] for { select { case _ = <-t.C: // tick arrived // [...] case ctrl := <-s.controlChan: // control message // [...] case voter := <-s.voterChan: // voter subscribed // [...] case viewer := <-s.viewerChan: // viewer subscribed // [...] case admin := <-s.adminChan: // admin subscribed // [...] case vote := <-s.voteChan: // a vote arrived // [...] } } } 19
  • 20. Conclusions  Go (or “CSP”-design) has massively simplified the concurrency challenges  WebSockets are easy to use and will be increasingly popular Go synchronized 20
  • 21. http://golang.org Rob Pike on “concurrency is not parallelism”: http://vimeo.com/49718712 (mascot by Renée French)
  • 23. Thanks for the attention! andrej.vckovski@netcetera.com netcetera.com ipoll.ch (coming soon)