Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Juju - Google Go in a scalable Environment
Search
Frank Mueller
July 28, 2013
Programming
92
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Juju - Google Go in a scalable Environment
Frank Mueller
July 28, 2013
More Decks by Frank Mueller
See All by Frank Mueller
Beauty and Power of Go
themue
0
73
Other Decks in Programming
See All in Programming
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
Kotlinの15年とServer-Side Kotlin
n_takehata
1
150
R8 の設定見直しでアプリサイズ削減
andpad
0
220
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
170
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
590
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
SREの越境 / SRE Collaboration
y0hgi
2
310
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
Featured
See All Featured
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
570
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
A designer walks into a library…
pauljervisheath
211
25k
Exploring anti-patterns in Rails
aemeredith
4
540
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.2k
Ruling the World: When Life Gets Gamed
codingconduct
0
400
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
630
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Transcript
Juju ‑ Google Go in a scalable Environment Frank Müller
/ Oldenburg / Germany
Introduction Frank Müller Born 1965 in Oldenburg Software Development since
1984 Author since 1999 Book about Go in 2011
Well known scenario Wordpress MySQL
Different in clouds Wordpress Wordpress MySQL
Scaling means effort
Juju for provisioning Amazon Web Services OpenStack Local MAAS Microsoft
Azure
Create your environment juju init -w juju bootstrap State
Add and relate services State juju deploy cs:precise/wordpress juju deploy
cs:precise/mysql juju add-relation wordpress mysql Wordpress MySQL
Add another unit State Wordpress MySQL Wordpress juju add-unit wordpress
Scale! State memcached MySQL Wordpress juju add-unit -n2 wordpress juju
deploy memcached juju add-relation wordpress memcached
Also web UI available
Why Google Go?
Architectural insights
State - Watcher - Worker State Provisioner Firewaller Machiner Deployer
Uniter Collections Individual Objects Lifecycles Client
Agent Lots of concurrent work State Worker Goroutine Goroutine Worker
Goroutine Goroutine
Firewaller State Main Loop Environment Configuration Machines machind Loop Machine
Units unitd Loop serviced Loop Ports Exposes
Goroutine control
Monitoring and stopping • not part of the language spec
• launchpad.net/tomb • signals to leave loops • wait until goroutine stopped • leave in case of an error • remember and retrieve that error
Loops with tomb // loop processes ... func (t *T)
loop() { defer t.tomb.Done() for { select { case <-t.tomb.Dying: // Cleanup ... return case f := <-t.fooChan: if err := t.foo(f); err != nil { t.tomb.Kill(err) } case b := <-t.barChan: // ... } } }
Stop and error handling // Stop ends the main loop.
func (t *T) Stop() error { t.tomb.Kill(nil) return t.tomb.Wait() } // Err retrieves the error in case the backend loop died. func (t *T) Err() error { return t.tomb.Err() }
Interfaces
Define behaviors type StorageReader interface { Get(name string) (io.ReadCloser, error)
List(prefix string) ([]string, error) URL(name) (string, error) } type StorageWriter interface { Put(name string, r io.Reader, length int64) error Remove(name string) error } type Storage interface { StorageReader StorageWriter }
Like a toolbox Storage EC2 OpenStack MAAS Azure Dummy Environ
Also help in tests type Foo interface { DoThis(with That)
error } type MyFoo struct { ... } func (m *MyFoo) DoThis(with That) error { ... } type MockFoo struct { ... } func (m *MockFoo) DoThis(with That) error { ... } func Bar(f Foo, t That) error { return f.DoThis(t) }
What else? • extreme fast builds • cross-compilation • binaries
are simple to deploy • table-driven tests • benchmarks and race detection • go get always takes tip!
Questions?