Thoughts on how to utilize Amazons EC2 (Elastic Compute Cloud) web service for hosting applications, especially with Ruby on Rails in mind. A major issue is the non persistence of local storage in the EC2 environment. We outlined several approaches on how to possibly solve this issue, minimizing potential data loss.
by Adam Groves and Martin Rehfeld
Mira Road Awesome 100% Independent Call Girls NUmber-9833754194-Dahisar Inter...
ย
S3 and EC2 Rails Scenarios
1. Amazon S3 + EC2
+ Rails = Dream Team?
Thoughts by
Adam Groves and Martin Rehfeld
@ BRUG 05-Apr-2007
2. Amazon S3
Simple Storage Service
โข Pricing
โข $0.15 per GB-Month NO CO
ST
(10 GB = $1.50 per month)
DRIVE
R
โข $0.20 per GB of data transferred BEWA
RE
HIGH
TRAFF
IC
(100 GB = additional $20 per month) SITES
3. Amazon S3
Common Terms
โข buckets:
S3
global name space
some bucket A
โข objects:
accessed by key [~ path+name] my bucket #1
can have metadata object 1, key = โimages/icons/smile.pngโ, encoding=...
object 2, key = โimages/icons/cry.pngโ, encoding=...
โข pre๏ฌxes:
}
identical pre๏ฌx
searching by pre๏ฌx emulates
directory structure my bucket #2
โข ACL: some bucket B
...
everyone, authenticated users,
owner / named users
5. Amazon EC2
Elastic Compute Cloud
โข Pricing
โข $0.10 per instance-hour consumed IDEAL
STAGIN FOR
GA
SCALIN ND
(1 month 24x7 ~ $72) G
โข $0.20 per GB of data transferred
(just internet traf๏ฌc; TRAFF
WARN IC
no charge for EC2-S3 traf๏ฌc)
IN
APPLIE G
S
6. Amazon EC2
Instance Specs
โข ~ 1.7 GHz x86 CPU
ACTUA
LLY
A XEN
VIRTUA
INSTAN L
CE
โข 1.75 GB RAM
โข 160 GB local disk space
โข 250 Mb/s network bandwidth
7. Amazon EC2
Common Terms
โข images:
named OS images stored in S3: โAMIโ
โข instances:
virtual maschines running an AMI
โข bundling:
saving customized images back to S3
โข non-persistence: BUG O
FEATU R
local disk storage will not survive instance RE?
shutdown or failure
8. Amazon EC2
Network Security
access group quot;defaultquot;
access group quot;webquot;
Internet
access group quot;backendquot;
9. Amazon EC2
Rails Scenario
}
EC2 S3
Web Static
Server Content
๏ผ
Application
Code
Server
memcached,
backgrounDRb,
...
๏ท
SQL HOW
TO
GET A
PERSIS
Database TENT
DB?
10. Amazon EC2
Database Persistence
Flavor A:
โข on instance failure
Frequent backup to S3 you will lose all
changes since last
backup
S3 โข backup using a lot
backup job
of resources
DB
โข no automatic
failover
11. Amazon EC2
Database Persistence
Flavor B:
โข on instance failure
Backup write ahead logs to S3 you will lose all
changes since last
log switch
โข
S3
DB
backup is fast, but
backup job
recovery will take
WAL
longer
โข still no automatic
failover
12. Amazon EC2
Database Persistence
Flavor C:
โข you might still lose all
Shadow database changes since last log
switch
โข
Master Shadow backup is fast, recovery is
usually not neccessary
(only if master and slave
continous
DB recovery
should fail at the same
time)
WAL transfer DB
WAL
โข no load balancing
between master and slave
via
โข automatic failover can be
achieved
S3
13. Amazon EC2
Database Persistence
โข
Flavor D: data loss only on failure
of all instances
(Multi-Master-)Replication โข reduced write
performance
Master #1 Master #2
โข sophisticated
con๏ฌguration
๏ข can be tricky
two-way
โข should be combined with
replication
DB ๏ฌavor A or B for backup
DB
โข load balancing can be
backup job
achieved
โข automatic failover can be
achieved
S3
14. Amazon EC2
Database Persistence
Flavor E (highly Experimental): โข unless caching is used
there should be no data
DB ๏ฌles on S3DFS loss
โข (very?) reduced
performance
โข reliability of S3DFS yet to
S3 be proven
โข can be combined with
DB
S3DFS fuse ๏ฌlesystem
๏ฌavors A or B for backup
โข can be combined with
๏ฌavors C or D for
failover and load
balancing (๏ฌavor D only)