Discussion on distributed apps and the cloud resources available to support them. Some discussion on the XMPP/Jabber based messaging system we use at Koordinates. Part of the seminar series for the Wellington Summer of Code programme.
3. What is it?
“Distributed computing deals with hardware and
software systems containing more than one processing
element or storage element, concurrent processes, or
multiple programs, running under a loosely or tightly
controlled regime.” - Wikipedia
http://en.wikipedia.org/wiki/Distributed_computing
4.
5. What is it?
Application architecture
Independent components
Dynamic resourcing
6. What is it?
Distributed computing is not scaling
Distributed computing can help you scale
There are easier ways to scale short-term
27. Task Packages
Kerrows & Brainzs connect via XMPP
Brainz publishes tasks via PubSub
Kerrow negotiates for tasks, then does them
28. Task Packages
Kerrows & Brainzs connect via XMPP
Brainz publishes tasks via PubSub
Kerrow negotiates for tasks, then does them
Brainz notified on task completion/error
29. Task Packages
Kerrows & Brainzs connect via XMPP
Brainz publishes tasks via PubSub
Kerrow negotiates for tasks, then does them
Brainz notified on task completion/error
If Kerrows go offline, tasks are re-assigned
30. Bots
Via IM, we can connect to
Brainz/Kerrow
Ask for status, cancel,
new tasks, …
And it can message us:
errors, info
31. Live Status
Keep a live eye on whats
going on
Danga apps have
terminal consoles (telnet)
Otherwise you’re
debugging via logs
32. Bigger catinthehat.biz
Load balancer
Cache Media
App App App +
Cache Media
DB DB
Worker
Storage
Worker +
+
34. Amazon S3
- Simple Storage Service
Unlimited storage
Cheap!
US$0.15 / GB / month
US$0.10 / GB in & US$0.17 / GB out
http://aws.amazon.com/s3/
35. Amazon S3
Not a hard disk or filesystem
Data is organised into namespaces (buckets)
hatdesigns.catinthehat.biz
Within that: key-value pairs
Access via HTTP
Authentication / access-control
Open source version - mogilefs
http://www.danga.com/mogilefs/
42. Amazon EC2
Not cheapest - US$70+/month for static server
Instances can be terminated at any time!
Organise configuration - Puppet, RightScale, Scalr
Need an app that is architected to handle it
http://slicehost.com/
http://puppet.reductivelabs.com/
http://www.rightscale.com/
http://code.google.com/p/scalr/
43. Amazon EC2 - uses
Uses for catinthehat.biz?
converting customer designs
creating story videos
application servers
44. Bigger catinthehat.biz
Load balancer
Cache Media
App App App +
EC2
Cache Media
DB DB
Worker
Storage
Worker +
EC2 S3
+
45. Google AppEngine
Auto-scaling web applications
Google hosts and runs
Access to BigTable, Image/Email/Cache/HTTP APIs
Restricted Python environment
Free to get started
http://code.google.com/appengine/
46. Google AppEngine
Still in beta, no way of buying “extra” capacity
No offline/background processing
Time limits on requests
No file storage
Datastore isn’t SQL
Lock-in
48. MapReduce
Map Phase Reduce Phase
Take a problem Combine all the
answers to the chunk
Chop it up into chunks
to get the real answer
Distribute chunks to
lots of workers to do
http://en.wikipedia.org/wiki/MapReduce
49. MapReduce
Small atomic chunks of work
Run across acres of machines on masses of data
Easy to write (although problems need to “fit”)
Can be chained together
Open source versions - Hadoop, others
http://en.wikipedia.org/wiki/MapReduce
http://hadoop.apache.org/
51. MapReduce
Use at catinthehat.biz?
Find most popular non-English words in user stories:
def map(document):
for word in document:
if not isEnglishWord(word):
yield (word,1)
52. MapReduce
Use at catinthehat.biz?
Find most popular non-English words in user stories:
def map(document):
for word in document:
if not isEnglishWord(word):
yield (word,1)
def reduce(word, partialCounts):
return sum(partialCounts)
Awesome Web 2.0 site selling hats for cats. In addition to the store...
Facebook app, online games, design-your-own hats, story writing with automatic creation of cat videos from your story, forums, blogs - you name it…
What happens when we get a bit bigger, and we start wanting more than one of anything? When we get load spikes and need 6 or 12 App servers, or 10 Workers rather than 2?
1 worker or 20 workers should be the same to the client, and it should just work if the worker dies mid-process.
What happens when we get a bit bigger, and we start wanting more than one of anything? When we get load spikes and need 6 or 12 App servers, or 10 Workers rather than 2?
Keys can be 1KB, and values(objects) can be up to 5GB
APIs for every language means its easy to incorporate into offline applications as well
Clever access control allows you to delegate authorization
Eventual consistency means that when your PUT request returns, it’ll be in at least 2 datacenters. But it might not be replicated across all of S3 yet, so an immediate GET request might return a not-found error. Likewise with 2 concurrent writes, it’ll take a while for (a random) one to win.
What happens when we get a bit bigger, and we start wanting more than one of anything? When we get load spikes and need 6 or 12 App servers, or 10 Workers rather than 2?