Share
Embed
Architecting your cloud application
If you want to know, what is cloud? why you should move to cloud? and what are the things you should follow when developing application for the cloud, then you can check this slide. I present it at Basis SoftExpo 2012.
Raju Mazumder
April 17, 2012
Transcript
50 slides
-
Architec(ng your Cloud applica(on Raju Mazumder Sr. So;ware
Engineer Tasawr Interac(ve Rubyist, Java and PHP Developer Like to work fun and challenging environment Web: www.rajumazumder.com TwiMer: @rajuniit *All the picture taken under crea(ve common license -
A hype? Hos(ng solu(ons? New terminology? Compu(ng
Services? Scalable architecture? Okay, so is it … -
Cloud is …
• Pay only for what you use • Elas(c capacity • Self service interface • Scale based on the level of traffic • Resources are abstracted/virtualized -
• Let’s discuss it in a non-‐technical way so
that your Grandmother can understand it .. Why Cloud? This idea take from: hMp://goo.gl/mIbbs -
• Say you just moved to a city and looking
for a place to live -
• Now you have two op@ons. You can either
Build a house or Rent an apartment -
• If you want to build a house, there are
some important decisions you have to make. -
• How big is the house? • Are you
planning to grow a large family? • Ini@al cost is lots more -
• Flooring, roof, ligh@ng, landscaping
But you get a chance to customize -
• Once the house built, you are responsible for
maintenance • Hire Landscaper, plumber, electrician, hea@ng and cooking, house keeping • Pay property tax, electricity water -
• You have to make a fewer, simpler decisions
• You can start with a one unit and grow later or downsize -
• But you do not have lot of op@ons to
customize your unit -
• However builders provide you with very high quality
infrastructure • High speed internet, high capacity electricity, green materials, triple pane windows -
• No need to worry about maintenance cost. •
No need to hire plumbers, electrician and landscaper • ini@al cost is low -
• Pay as you go • Just pay your
rent and u(li(es bill -
• Lets tell you a story why we should move
to Cloud? Not Convinced? -
Three Developers …. • Anis • Raju
• Khairul working together and have a dream one day they will make something great … -
One day morning… • Anis was very excited. Hey
guys I have a idea. Let’s build it. Raju and Khairul were also very excited to hear it. -
Idea “holiday gi;” • A simple applica@on where user
can buy virtual gi; and sent it to his friends. So they decided, they will develop the applica@on .. -
Technology stack • OS X for development, Linux(centOS) in
produc@on • Apache • PHP • MySQL • Git Developing was progressing .. -
Applica(on Deploy!!! • Within 15 days they have developed
the applica@on and deploy it into a tradi(onal hos(ng site. -
Site is growing • They need more resources
• So they had to invest to buy resources • Bought another one web server • Introduced Load Balancer -
The site was growing too fast • AZer one
week New Year is coming. So they • Bought three memcached servers • Add two more web servers • Add one more database server and par@@on it as master and slave. So they were very excited and but they didn’t what was going to happen.. -
New Architecture
master Database slave -
New year!!! • They didn’t sleep last night.
• Site was going to down very frequently. • Actually they didn’t expect massive user visits • They need more web servers, memcache servers and database servers • But It tokes more (me to add and configured resources -
Disaster!!! • They were trying hard to give backup
• But aZer some few hours they were going to down completely Everyone was very upset and from next day the site was live again. -
Lessons • It takes more @me to add new
resource • No automa@c deployment • No fault tolerance • Had to invest more money but aZer peak hour the resource is idle -
Are you • Engineer? • Developer?
• Architect? If yes then you have to keep something in your mind when developing applica(on for the cloud .. -
Horizontal Scalability • Adding more servers • Load
balancing • Clustering -
Sessions • HTTP is a stateless protocol •
By default on the local server • Cause a problem to load balance • Unintended logout -
To cloudify Sessions • Some load balance support “session
affinity” • Shared sessions using database or file storage • Session clustering using memcached -
Distributed File Storage • Stored on a directory on
the web server • Cause trouble into mul@-‐server environment -
Cloudily file-‐storage • Tradi@onal approach to add a shared
storage • We can use Amazon S3 and Rackspace Cloudfiles • Some open source solu@ons MogileFS2, HDFS3 and Ceph -
Misconcep(ons • Just because it is in the cloud
doesn’t mean it scales • Not only do you need to rebuild your applica@on, you also need to rethink your applica@on • Failure as a Feature