• Like
  • Save
Cloud computing & lamp applications
Upcoming SlideShare
Loading in...5
×
 

Cloud computing & lamp applications

on

  • 1,454 views

How to scale with AWS web applications based on LAMP.

How to scale with AWS web applications based on LAMP.

Statistics

Views

Total Views
1,454
Views on SlideShare
1,355
Embed Views
99

Actions

Likes
2
Downloads
22
Comments
0

2 Embeds 99

http://www.gabrielemittica.com 97
http://lanyrd.com 2

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Cloud computing & lamp applications Cloud computing & lamp applications Presentation Transcript

    • CLOUD COMPUTING &LAMP APPLICATIONS Gabriele Mittica www.gabrielemittica.com - @gabrielemittica Corley srl - www.corley.it Cloud Conference 2013
    • LAMP & Scalability• Applications deployed on LAMP platforms are not usually designed to be scalable Disk Access MySQL Network Traffic
    • Common scalability
    • HOW TO SCALE?
    • Scalability and High Availability
    • Static filesWe can’t host static files (uploads, The goal is make our web instancesimages, css…) on the web instance full dedicated to host the logic of the application, with no relationships to static files.• Move static files to a dedicated service like S3• S3 is a scalable service that grants the 99,999999999% of file durability With AWS, you can upload files from your instances to a S3 bucket with AWS• We can use a CDN and create several SDK for php subdomains as media.mywebsite.tld, (http://aws.amazon.com/sdkforphp/) upload.mywebsite.tld, etc.
    • Cache and sessionsWe need a dedicate service where host • session.save_handler =cache and sessions, in order to make memcachethem always • session.save_path =• Use an hosted cache system (as "tcp://1.cache.group.doma Memcache) instead of local ones (as in.tld:11211" APC)• PHP has a native handler to use manage sessions with Memcache• We can use a Elasicache or DynamoDB to host both cache and sessions
    • Database scalability• Multi A-Z • Master / Slave (Read Replica)When you provision a Multi-AZ DB The master database is regarded as theInstance, Amazon RDS automatically authoritative source, and the slavecreates a primary DB instance and databases are synchronized to it.synchronously replicates the data to astandby instance in a different Use the master instance to write andAvailability Zone (AZ). slave ones to read data.+ easy to manage + easy to scale- pay double - hard to manage
    • Database scalability• MySQL native driver? • Available from PHP >=5.3 • Compile PHP with mysqlnd support • --with-mysqli=mysqlnd --with-pdo=mysqlnd --with-mysql=mysqlnd • WARN mysql extension is deprecated as of PHP 5.5.0• Delegate to “mysqlnd_ms” the master/slave management • http://www.php.net/manual/en/book.mysqlnd-ms.php
    • Database scalability{ The simple JSON configuration is divided in two main "myapp": { "master": { section "master_0": { "host": "localhost", • Master "port": "3306" } • Slaves }, "slave": { "slave_0": { “myapp” is the hostname that we use instead the real "host": "192.168.2.27", mysql host address. "port": "3306" } } Eg. } • mysql_connect(“myapp”, “user”, “passwd”);} • new Mysqli(“myapp”, “user”, “passwd”); • new PDO(“mysql:dbname=testdb;host=myapp”);
    • Load balancing• ELB – Elastic Load Balancer • Distributed load balancer on AWS regions (eu- When a server starts, it has to create a valid west-1, 2, 3 you have to select in how many region environment in order to provides web pages. you are available) Strategies? Compile and bundle all softwares in one instance • Watch EC2 status thanks to a ping strategy image • Page check every x minutes/seconds • all software becomes old very quickly and • Turn on/off EC2 instances automatically thanks to when you have to release an update you alarms (CloudWatch raise alarms) have to compile a new image and update - It • Receive Alarms from CloudWatch and engage scale is a long and complex operation operations • You can raise CPU alarms, Network Alarms, VM status Use EC2_USER_DATA feature provided by AWS alarms and many others in order to increase or decrease • You can run a shell script when your the actual number of EC2 instances bootstraps. It is more flexible • Scale strategy is not simple and you have to because you can create a skeleton (PHP + understand how your application works libraries) and download all software runtime • CPU is the simplest way but remember that the during the boot operation bandwidth is limited by network interfaces and bottlenecks can obfuscate the CPU alarm and your application stucks in weird and strange situations.
    • Load balancing• If you ran 10 servers execute commands could be hard. You can use tools to run command on a server list • Capistrano (Ruby) https://github.com/capistrano/capistra no • Fabric (Python) https://github.com/fabric/fabric Use CLOTH for AWS EC2 instanceshttps://github.com/garethr/cloth
    • jMeter App instances instances 1 billion of monthly pageviewsAverage 400 concurrent connections 60 $ on the cloud
    • before after
    • More code onhttp://www.slideshare.net/corleycloud/corley-scalability-19163383
    • THANKYOUhttp://www.corley.it