44034 cloud re factoring 332072

Upload: hector-toti-miranda

Post on 07-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/4/2019 44034 Cloud Re Factoring 332072

    1/20

    S umicrosys

    OPT IM IZ ING APP LIC AT IONSFO R CLO UD COMPUT INGENV IRONMENTSW hite P aperNovember 2009

    AbstractC lo ud co mpu ting is a m ode l th at orga niz ations ca n ex ploit in o rde r to re duc e c osts , inc re ase fle xib ility , an dr ed uc e r is k. It can be used to host applica tion s ranging from the business critica l to those needed to sa tisfyshort-te rm needs. W hen decid ing w hether and how to m ove an app lica tion to the cloud, it's im portant to man accu rate assessm ent of w hether th e step w ou ld yie ld the expected benefits . O nce it is de term ined tha t aapp lication can run in the cloud, a second assessm ent can be m ade to de term ine whether it can be furtheroptim ized to harness the energy o f the c loud. T his w hite paper presents a m ethodology for dete rm ining w hea nd h ow to re fa cto r a pp lic at io ns fo r c lo ud c om pu ti ng e nv iro nm en ts .

  • 8/4/2019 44034 Cloud Re Factoring 332072

    2/20

    S un M ic ro sy ste m s, I nc .

    Tab le o f Conte ntsIntroduction 1Benefits of cloud computing 1Risks of cloud computing 2Reduci ng risk 3Definitions 4Compatible with the cloud 4Runs in the cloud 4Optim ized for the cloud 5Patterns 6Methodology 8Process overview 8Example: two-tier Web service 10Initial assessment 10Optimize through refactoring 10Optimize further 11Summary 12

    Example: enterprise database cluster 13Initial assessment 13Optimize through refactoring 15Optimize further 16

    Summary 17Acknowledgments 17

  • 8/4/2019 44034 Cloud Re Factoring 332072

    3/20

    Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    Chapter 1IntroductionC loud com puting is inform ation technology - including server, storage, netw ork ,and even softw are technology - that is prov ided as a serv ice or application overthe network. The technology m ost often takes the form of infrastructure, p latform ,or software as a service. One of the m ore prom inent features of cloud com putingenvironm ents is that they include an A PI for m anipulating them . This is a powerfu lfeature that prom otes a level o fflexib ility far beyond what is typically prov ided byen terprise datacen ters. T he ab ility to program infrastructure itself is one of thecapabilities that allows the developm ent of dynam ic environm ents that can becreated, scaled, updated, or destroyed in m inutes rather than the hours, weeks, orm onths that the sam e tasks in a physical in frastructu re w ould require.The program mable nature of cloud infrastructure itself makes it useful forapplications ranging from overn igh t batch jobs that use a large number of serverresources in parallel to solve a problem in a short tim e, to fam iliar m ulti-tier W ebserver env ironments that persist for long periods oftim e. C loud computing givesIT organizations m ore flexib ility in term s of w here applications run . T his is due inpart to the standard platforms that cloud providers offer and also to the packagingd iscipline that cloud com puting im poses on developers. N ow a company m ight runits applications in an enterprise datacenter, in the cloud , in m ultiple clouds, or in ahybrid architecture that uses bo th.L ikew ise, there is a spectrum of cloud computing im plem entations. C louds m aybe im plem ented b y serv ice providers (p ublic cloud s) o r in enterprise datacenters(private clouds) that allocate a large num ber of resources and capabilities so thatapplications can scale from one to thousands of servers in a short tim e. E mergingm odels such as virtual datacenters allow custom ers to reserve capacity and workw ith dedicated resources w ithin a cloud, increasing the ability to m anage costsand serv ice levels. H ybrid clouds can further optim ize benefits to an organizationby com bining the needed elem ents of pub lic clouds, private clouds, and en terprised atacen ter tech no log y.

    Bene fits o f c loud computingCloud computing can offer many long-term benefits. D epending on the use case, ITorganizations using cloud computing have the potential to capture some or all ofthe benefits o f reduced cost, reduced cap ital risk, increased flexib ility , and greaterb u si ne ss a gi li ty .

  • 8/4/2019 44034 Cloud Re Factoring 332072

    4/20

    2 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    R educed costthrough a pay-by-the-sip m odel where the custom er is b illed only forthe com pute cycles, network traffic, or storage actually used. The cloud can beused to process a workload surge, or to prototype a new application, all w ithouthaving to justify and purchase dedicated new equipm ent. O ther factors cancontribu te to lo wer cost, including the b enefits of standardizatio n, op eration alin tegrity, con sistency , an d elasticity that clo ud com puting enviro nm entsencourage.

    R educed cap ita l risk because the cloud provider purchases the actual equipm ent,not the custom er. This shifts the risk away from the organ izations using the cloudand onto the cloud prov ider. In the case of private clouds, risk shifts from thein div id ual c lien t o rg an iz atio ns to th e c en tra l IT o rg an iz atio n.

    I nc re as ed f le xib il ity due to the fact that te m po r a ry and tra nsient needs ca n besatisfied w ithou t making new investm ents in hardware .

    G rea ter bu sin ess a gility due to the fact that cloud com puting is a lightw eightm echanism for dep loy ing new and existing applications quick ly. It is the perfectp latform for deploying new applications, augm enting existing ones by provid ingthem w ith hig her capacity, o r com pletely re-h osting existing app lication s.

    These benefits are not absolute or guaranteed . R ealizing these benefits requiresa full understanding of the cloud com puting environm ent, m aking appropriatechoices, and correctly optim izing applications to run in it. Failing to op tim ize forthe cloud can turn the benefits into disadvan tages or even risks. For example, anapplication that is built to autom atically scale up but not to scale down can endup increasing costs under the pay-per-use m odel employed by the cloud . A lso, thepay-by-use model itself does not always m ean low er costs: purchasing and hostingphysical hardware, o r reserving portions of a cloud, may yield a low er price than ap ure p ay -b y- us e o ff eri ng .

    R is kso f c lo ud computingW ith the advan tages of cloud com puting com es risk that must be carefu lly evaluatedand m itigated. Not all applications can run in the cloud , or run well in the cloud . Itis im portant to m ake an inform ed assessm ent as to how appropriate the applicationis fo r cloud com puting, the effort involved in optim izing it for the cloud, and therelative m erits o f the specific cloud provider being considered. The risks include: Business risk of m oving an application into the cloud , where, for exam ple, service-

    level agreem ents are not com mon today A rch itectu ra l o r te chn ica l ro ad blo cks that m ay preven t an app lication from

    running in the cloud ; for example, file system access vs. representational statetra nsfe r (R E ST ), clu ste r v s. re plic ate d relia bility m od els, a nd lim ite d o bse rv ab ility

  • 8/4/2019 44034 Cloud Re Factoring 332072

    5/20

    Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    C om pliance and regula tory issues, includ ing the con trol over and security ofbusiness-specific, custom er, or perso nal d ata

    L ack o j visib ility into cloud prov iders' security policies and processes; the level o ftransp arency v aries from provider to p rovider

    A thorough risk assessm ent m ight result in a decision not to m ove an applicationinto the cloud , or not to optim ize it for the cloud, because of the cost o r the risk. Thegreater the risk, the more care should be taken to help determ ine the applicab ility ofcloud com puting and the approach for m igrating the application to the cloud .For exam ple, a database m anagem ent system that con tains business-critical datam ay not be worth the business risk of moving it from an enterprise datacenter intothe cloud. E ven if such a m ove were desirable, techn ical roadb locks m ight m akeit impossib le to do so . And in the face of governm ent and industry regu lations, anorganization m ay put its compliance at risk by m aking such a move. For example, if asto rage cloud can store custom er data from the European Union in a country w ithou tthe sam e stringent controls over personal data, the business m ay fail to conform tolocal law s protecting that data.

    Reducing riskThis white paper discusses an approach for m aking an inform ed decision on w hetherto move an application , service, or com ponent into a public, private, o r hybrid cloud.This approach helps determ ine whether to simply port an app lication to run in thecloud , or to take one of many steps to refactor an application to use som e of thecloud 's unique characteristics, including elasticity. The paper concentrates on thepublic cloud, however the same techn iques apply regardless of the type of cloud .Through the use of examples, the paper illustrates how datacenter services m ight beoptim ized to run in the cloud while helping to address the risks.

  • 8/4/2019 44034 Cloud Re Factoring 332072

    6/20

    4 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    Chapter 2Defin i t ionsThe methodology described in this paper addresses the question of taking anexisting, or even a legacy application or service, and moving it to the cloud. Thisapproach can be used for existing applications and existing patterns, and theexamples can help developers new to the cloud make similar decisions as theyconstruct new applications.

    C om patib le w ith the cloudAn application, service, or pattern is considered to be compatible with the cloudif no business, architectural, technical, or compliance roadblock would prevent itfrom being moved to the cloud. The important characteristic is that no architecturalchanges are necessary for the entity to run in the cloud.Note that this definition is not absolute. A MySQL'" database management systemis compatible with the cloud because a virtual machine instance can be configuredwith the software and connected to a storage service containing the databasecontents. But if the database management system contains, for example, customercredit card information, the service may not be compatible with the cloud becausethe security around the storage service may not be sufficient to satisfy industryregulations.

    R uns in the cloudAn application, service, or pattern runs in the cloud if it can be packaged to run inthe cloud without any impact on its functionality. Packaging requires a minimalamount of optimization but it is not architectural in nature. Making an applicationrun in the cloud involves managing some of the following issues: P ac ka gin g. Many cloud environments today provide infrastructure as a service(laaS), supporting virtual machines as the deployment model. Applicationsoftware can be installed on running virtual machines, or be packaged withina virtual machine image as dictated by the cloud platform. Formats in usetoday include Amazon Web Services' Amazon Machine Image (AMI), or ProjectOpenSolaris" Dynamic Service Container payloads .

    S elf-s er vic e m o de l. Cloud computing uses a self-service model that deploysservices under programmable control. Applications can modify themselves overtime, or completely redeploy themselves as needed. To enable an application torun in the cloud, the developer must leverage the self-service model either at thecommand line or using the cloud provider's APls.

  • 8/4/2019 44034 Cloud Re Factoring 332072

    7/20

    Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    B ind ing tim e. The software w ith in the virtual m achine package must be able tobind itself to a dynam ic infrastructure so that any given instance of the virtualm achine can discover its environm ent and configure itselfappropriately .

    V irtu al a pp lia nc es. Cloud com puting puts a focus on rapid development, andappliances help to turn application developm ent into m ore of an assem blyexercise. A ppliances com e in m any form s, ranging from a sim ple operating systeminstalled in a v irtual m achine im age to a p latform for creating social netw orkingsites (fo r ex am ple, a D rup al appliance).

    F igure 1 illustrates an application packaged for the cloud w ith a b inding tim e issuethat m ust be reso lved . The application is packaged in a virtual m achine im agestarting from an appliance that in tegrated the OpenSolaris operating system w iththe Sun Glass+ish" app lication server. The developer installed a W eb server into thevirtual m ach ine and set up its configuration files. Inside the configuration file is astatic reference to an IP address 192.168 .8 .8 , a private IP address that m ayor m aynot exist in the dep loym ent environm ent. To be able to run this packaged applicationin the cloud , the developer must adap t the static IP address b ind ing to one that canbe established when the v irtual machine boots.

    [W E B S E R V E R

    C U S T O M IZ A T IO N . . . C - O - N - F I - G U - R - A T - I O - N . . . . .L....192.168.8.8

    A P P L IA N C E [

    Figure 1.An app lica tion incorrectly packaged for the cloud due to a sta tic IP addressbinding.

    Op tim ized fo r th e c lo udA n application, service, or pattern is optim ized to run in the cloud when it takesadvantage of the unique characteristics of the cloud, m aking a functionality orserv ice-level improvem ent as a result. The am ount of optim ization is driven by acost/benefit analysis. The unique characteristics of the cloud include: A high ly parallel in frastructure that can help horizontally scaled , o r "scale ou t"

    application arch itectures achiev e m assive scale. M any tradition al enterp riseapplications are built using a vertically scaled architecture that scales on ly to apoint. The cloud supports a horizon tally scaled model in w hich an application can

  • 8/4/2019 44034 Cloud Re Factoring 332072

    8/20

    6 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    use literally thousands of servers in order to accelerate a job . The challenge forthose op tim izing a p plications for the cloud is to most effectively tra nsition to am ore parallel, ho rizon tally scaled m od el.

    The on-dem and, pay-by-the-sip m odel enab les im plem entations that would beim possib le w ith physical infrastructure, fo r exam ple scaling to thousands ofservers in a m atter of days. This infrastructure can be d ismantled as quick ly as itis created, helping to cu t costs when the workload requ irem ents do not require afully scaled infrastructure. T he m odel also g ives organ izatio ns m ore flex ibility, forexam ple, to perform large batch-style tasks in the cloud w ithout affecting existingapplications or having to re-allocate dedicated servers fo r the task.

    The more that applications can be decom posed and refactored at a functional level,the more they have the potential to benefit from running in the cloud. For example,an application com ponent that includes a M ySQ L database running on the Solaris"O perating System can be m igrated directly to the cloud . U sing an SQ L cloud serviceinstead is an example of a functional decom position and m igration that can yieldad dition al benefits (dep en din g on the circum stance).

    Pat ternsPatterns describe the relationship am ong the com ponents used to deliver anapplication or service. There are a num ber of different patterns used throughout thea pp li ca tio n li fe cy cl e, i nc lu din g: S olu tio n a rc hite ctu re p atte rn s that are used in the initial arch itectu re phase.

    T hey take application requirem ents as inpu t, and produce a serv ice-orienteda rch itec tu re a s o utp ut.

    M ic ro ar ch ite ctu re p atte rn s that assem ble services (described by patterns) intohigher-level com ponents that can be used to im plem ent the application. Forexam ple, em ail, m essaging , D om ain N am e Service (D NS), and directory servicesare all m icroarch itecture patterns that com bine to m ake a larger service prov iderarchitecture.

    B uild p atte rn s that transform the logical description to the physical. In the realworld, they take the list o f components and produce a bill of m aterials. In thecloud world , they specify the resources that are requ ired, along w ith how theresources are bound into an infrastructure that is bu ilt at run tim e. B uild patternsof particu lar use in the cloud are W eb functional patterns and cloud provision ingpatterns .

    O ptim iza tion and m anagem en t pa tte rn s that help once an application isdeployed. They use policies, such as serv ice-level agreem ents, and producechanges to patterns and instances of them .

  • 8/4/2019 44034 Cloud Re Factoring 332072

    9/20

    7 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    Optimization and management patterns are among the most important for cloudcomputing because they provide guidance on how to best utilize the cloud'selastici ty, helping business organizations increase flexibility and agility whilereducing costs.

    F or m o re in fo rm a tio n o n S un 's c lo udp atte rn s w or k, p le ase r efe r to th e w ik iat : ht tp:/ /wikis .sun.com/display/cloud/Pat t e rns

    Sun has undertaken the challenge of creating a set of cloud patterns that are openfor community use and review. Focusing on optimization and management patternsand leveraging the experience of others, these cloud patterns help architects savetime and resources, avoid pitfal ls, reduce maintenance costs, increase re-use, andincrease business flexibility and agility by shortening development time.The cloud computing patterns that appear on Sun's wiki include a significant amountof detail including diagrams of the components and their interactions, a sequencediagram that illustrates the relative timing of the interactions, and a flow diagramthat illustrates how the pattern might be implemented using pseudo-code.The patterns discussed in the context of this paper are build patterns that illustratevirtual machines and their logical relationships. For example, a simpl ified two-tierWeb service pattern is il lustrated in Figure 2.

    Figure 2. Two -tie r W eb s erv ic e p atte rn .

    Superposition is the way in which larger patterns are built by combining smallermicroarchitecture patterns. For example, the two-tier Web service pattern uses bothhorizontal scaling for its Web servers, and vertical scaling for its database server.Each of these aspects are their own patterns. Likewise, larger patterns such as amessaging service, email service, and Domain Name Service (DNS) can be combinedinto an even larger service provider pattern.

    http://wikis.sun.com/display/cloud/http://wikis.sun.com/display/cloud/
  • 8/4/2019 44034 Cloud Re Factoring 332072

    10/20

    A pa ch e H ad oo p is a f ra me wo rk b uilt tos up p or t d is tr ib u te d a pp lic at io n s t ha tp ro ces s la rg e a mo un ts o f d ata . It co mb in esid ea s fr om th e G o og le M a pR eu du cea lg orith m a nd th e G oo gle F ile S y stem (G FS )

    8 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    Chapter 3MethodologyThe m ethodology described in th is chap ter helps to dete rm ine w hether an ex istingapp lication is com patib le w ith the c loud , can run in the cloud, o r can be optim izedfor the cloud . The m ethodology focuses on patterns, w here a pattern m igh t m odela ll o r part o f an ex isting app lication . The m ethodology helps to devise strateg ies form oving applications in to the cloud and understand ing the benefits that resu lt. A sthe exam ples of using the m ethodology w ill show , applications can be decom posedinto the ir essen tial patterns. Then the patte rns, ra ther than the app lica tion, can beassessed.

    Process overviewT he m ethodology invo lves first evaluating w here a pattern falls in the spectrumof categories illustrated in F igure 3 , and then assessing w hether it is practicalto optim ize the pattern and move it to the right. The first step in the processis assessing the ex isting instance; the subsequen t steps invo lve assessing thepattern 's functions and whether they can be decom posed and perhaps recom posed(re factored) to m ore fu lly op tim ize the pattern for use in the cloud .The farther right in the figure that a pa ttern can be moved , the m ore that it isop tim ized for the cloud and can explo its the c loud's benefits . F igure 3 illustrates thatthere are severa l possibilities fo r how patterns m ove along the spectrum : A dashed black line illustrates where the pattern lands afte r an in itia l assessm ent,

    w ith no structura l changes m ade. The pa ttern instance m ay have operationalchanges m ade to allow it to run in the cloud , including packag ing it as a virtua lm ach ine, possib ly basing it on an appliance, chang ing b ind ing to be dynam ic, andutilizing the self-serv ice dep loym ent natu re of the cloud .

    A s o lid green line ind icates the case w here a pa ttern can be optim ized so thatit can m ore fu lly utilize the benefits o f the cloud . O ptim ization often involvesdecom posing a pattern or app lica tion at a functional level and then recom posingit in a new way tha t m ore fu lly exp lo its the nature of cloud com puting .There are m any levels at w hich a pattern can be optim ized for the cloud . It canbe adap ted to use the m assive parallelism of the cloud . It can very closely m atchits resource consum ption characteristics to its w orkload , op tim izing around thepay-by-the-sip b illing m odel. I t can be refactored to au tom atically deploy and scaleitse lf, and to com pletely redep loy itse lf (rather than patch) when changes arem ade to th e ap plicatio n.F inally , o ther patterns can be substituted where appropriate, fo r exam ple the useof H adoop rather tha n a trad itiona l d ata base m a n agem ent system .

  • 8/4/2019 44034 Cloud Re Factoring 332072

    11/20

    9 Optimizing Applications for Cloud Computing Environments

    S T A R TA S S E S S

    T R A D I T I O N A LI N C O M P A T I B L E

    C L O U DO P T I M I Z E DU N S

    Sun Microsystems, Inc.

    Figure 3. The more tha t a pa ttern can be m oved to the righ t in the spectrum , them ore tha t it can exp lo it th e benefits o f c loud com pu ting .

    The spectrum illustrated in F igure 3 is con tinuous, not d iscrete: the more that apatte rn can be optim ized for the cloud, the further it m oves to the right in thefigure . A pattern that reaches a "cloud nirvana" m igh t use m any instances ofthe pattern across m any clouds, scaling itself dynam ically and solv ing the dataphysics issues that presen t them selves. The resu lt is geograph ic scalab ility w ithinheren t high availability and like ly low er cost than a traditiona l deploym ent .

    A dotted red line indicates an an ti-pattern , illustrating the fact that there is som eroadblock that p reven ts a m ovem ent to the righ t, specifica lly one that shouldb e resp ected . T he p ossib ilities inclu de: b usine ss risk, arch itec tu ral o r tech nic alro ad blo ck s, re gu lato ry or co mp lia nce issues.

    In the example noted as 1, a pattern is dete rm ined to run in the cloud w ith on lysom e packag ing changes, and it can be refac to red further to op tim ize its use of thec loud. In the example no ted as 2, a pattern that is initially assessed as incom patiblew ith the cloud can la ter be refacto red so that it can run in the cloud. In the examplenoted as 3, a patte rn that is assessed as incom patible w ith the cloud is preven tedfrom running in the cloud and noted w ith an an ti-patte rn. An example of th issituation is a governm ent or industry regu lation that p laces restrictions on the use ofdata. If a c loud provider cannot prov ide a serv ice-level agreem ent that satisfies theregu lato ry requ irem ents, then tha t data cannot be sto red by the prov ider.A n anti-pattern is not absolu te because of the changing offerings of cloud serv icep rov ide rs. S om e pro vid ers, for ex am ple, are offering v isibility in to their data-h an dlingpolicies so tha t data-hand ling standards can be m et. A f urther step cou ld be taken

  • 8/4/2019 44034 Cloud Re Factoring 332072

    12/20

    F or a d is cu ss io n o f th is p atte rn , p le as e r efe rto ht tp://wikis.sun.com/display/c loud/Po l l+Watch+Moni t or i ng

    10 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    b y o fferin g a P ay men t C ard In dustry (P CI) D ata S ecu rity S tan dard (D SS )-co mp lian tp latfo rm as a ded icated, no t virtualized , cloud serv ice in order to enab le custom ersto bu ild cloud applications that can be PC I D SS com pliant.

    E xam ple: tw o-tie r W eb serv iceC onsider how we m ight apply the m ethodology to the sim plified tw o-tier W eb serviceillu stra te d in F ig ure 2. To sim plify the d iscussion , the load-balanc ing m echan ism thatwould m anage incom ing traffic is om itted from the pattern .

    Initial assessmentAn in itial assessm ent of the pattern show s that it can run in the c loud. Indeed , thepattern as illustrated show s a horizontally scaled set o f W eb servers all accessing aM ySQ L d atabase, w ith each of the components deployed as v irtual m ach ines in anin fra stru ctu re a s a se rv ic e (la aS ) e nv iro nm en t.This is the po in t at w hich it is usefu l to assess the role of data in the pattern. D atais no t on ly sto red by the M ySQL database - it also m oves from the database to theW eb servers. D epending on the organization 's da ta-hand ling policies that app ly tothe data, the assessm ent m ight change to " incom patib le:'

    Optimize through refactoringN ow assess whether the pattern can be optim ized and sym bolica lly moved tothe righ t in the m odel. A s shown, the two-tier W eb serv ice has a fixed num ber ofW eb servers and a single back-end database. Its sca lab ility is lim ited , and so is thework load that it can ha ndle. O ne of the benefits o f the cloud is the elasticity tha ta llow s applications to scale up and dow n as needed, all program matically.The pattern can be optim ized for the cloud by enabling it to take advan tage of thec loud's elasticity . A n external m onito ring service can w atch each virtua l m achine'sresource consum ption and /or response tim e characteristics to he lp decide w hetherthe W eb server tier or the database server tier shou ld scale up (F igure 4). Th ispattern is called "po ll w atch-driven e lasticity:' and is one of the patterns that Sunhas articu la ted as one of its com munity-based c loud patte rns.The application , o r the agen t causing the scaling to occur, would have to taked ifferen t criteria in to account depending on the tier to be scaled : The W eb server tie r can scale up and down as needed so long as the W eb servers

    have m inim al state. Th is ability to sca le up and down uses the cloud 's elastic ity tom eet serv ice levels. W hen it scales up, it increases cost on ly for the tim e tha t thenum ber of W eb server instances has increased . A s it scales dow n, the pay-by-usecosts a r e shed. The W eb server tier needs to be aw a re of w hether the data basetier has scaled , as it m ay have to change how it m akes queries.

    http://wikis.sun.com/display/cloud/http://wikis.sun.com/display/cloud/
  • 8/4/2019 44034 Cloud Re Factoring 332072

    13/20

    11 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    R E S O U R C EM O N I T O R I N G

    A N D M A N A G EM E N T

    " '- -

    R E P L I C A T E D

    S H A R D E D

    A -I J -Q R -ZFigure 4- The two-tier W eb service can be op tim ized for the cloud by enabling it toscale up and down based on resource consum ption and/o r perfo rm ance m etrics.E ac h tier u se s a d ifferen t te ch niq ue fo r sc alin q.

    The database server tier w ould scale up as either the size of the database or thew orkload dem ands on it cause a perform ance lim it to be reached. Perform ancecould be lim ited by saturating resources including C PU utilization or storagesystem throughput. W hile an enterprise database m ight be hosted on acom mercial database m anagement system on a server offering a high degree ofvertical scalability , an open-source database m anagem ent system hosted in thecloud can be lim ited in vertical scalability and m ight need to address bottlenecksth ro ug h ho riz on tal sca lin q,D atabase m anagem ent system s can be scaled in the cloud by partitioning,or sharding their data so that it is d is tributed across a num ber of databasem anagem ent system instances. For exam ple , a single database m anagem entsystem hosting data for custom ers whose last nam es begin w ith letters from A -Zcould be partitioned into three instances, one each hosting nam es from A-I, J - Q ,and R -Z _T his partitioning could repeat to reduce granularity as needed. Shardingrequires effort (C PU , elapsed tim e, possib le data m ovem ent), and it can increasean en viro nm en t's c om ple xity ,

    Op t im i ze f ur th e rN ow assess whether additional features of the cloud could be exploited to furtherenhance the application 's characteris tics including perform ance, scalability , cost, orrisk,In the case of th is application, the complexity of the database server tier could beoutsourced to a third-party cloud database service (F igure 5)- This w ould allow athird party to handle the com plexity of storing the data and potentially sim plify thedeploym ent and im prove perform ance.

  • 8/4/2019 44034 Cloud Re Factoring 332072

    14/20

    12 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    R E S O U R C EM O N I T O R I N G

    A N D M A N A G E M E N T

    - - - - ~

    Figure 5. R efactoring further to use a cloud-based data base m anagem ent service.

    Another optimization that could be considered is to use Hadoop to add a massiveamount of horizontal scalability to the database query process. This represents afunctional refactoring from a typical database management system to a parallelized,tree-structured approach using a dynamic infrastructure.

    Summa r yThe assessment path for this application can be summarized as shown in Figure 6.The two-tier Web service pattern can run in the cloud unchanged, however it canfurther be refactored to be optimized for the cloud. It could then be optimizedfurther by using a cloud database service or the Hadoop model.

    S T A R TA S S E S S

    T R A D I T I O N A LIN C O M P A T I B L E R U N S

    C L O U DO P T I M I Z E D

    ~ .~

    H A D O O P

    Figure 6. T he assessm ent path for a two-tier W eb service.

  • 8/4/2019 44034 Cloud Re Factoring 332072

    15/20

    13 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    Example : e nte rp ris e d ata ba se c lu ste rE nterprise app lica tions often depend on a cen tra l database that con tains m uchof a business organ ization 's operational data. E ach application uses the databasem anagem ent system to store all of its da ta, and a conten t-de livery netw ork provideseffic ien t access to those app lications (F igure 7). T his exam ple exp lores w hether andhow the cen tral database functions cou ld be moved to the cloud .

    Figure 7. E nterp rise a pplica tion s are b ased o n a centra l da tab ase m ana gem en tsys tem

    Because of the workload placed on the database m anagem ent system and theim portance of the data to business operations, the software is often hosted on a pairo f h ig hly scalable, sym m etric m ultip ro cesso r serv ers in a c lu stere d co nfigu ratio n.In the case of h igh ly sta tefu l database softw are, the cluste r uses an ac tive/standbyconfiguration such as that supported by Sun" C luster softw are. A s F igure 8 illustrates,the tw o servers are connected by a redundan t pair of heartbeat connections, andboth servers access a shared storage dev ice that is som etim es refe rred to as aq uo ru m d ev ic e. The quorum device is used as a decid ing vote to avo id split-b rainsyndrom e so that, in the even t that the ac tive server in the c luster fails, the backupserv er ca n tak e o ve r w ith m in im al in terru ption .

    Initial assessmentThere are a num ber of reasons why such a core database should not and cannot bem ov ed in to a clou d en viro nm en t.Bus iness roadb locksT he goa l of using a clustered database is to m axim ize data availability. A ny m igrationto a cloud environm ent shou ld assess whether the sam e level of availab ility can beprov ided. U nless the cloud im plem entation satisfies the business requ irem ents fo ra vailability , th is m ig ratio n sh ou ld no t occ ur.

  • 8/4/2019 44034 Cloud Re Factoring 332072

    16/20

    14 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    Q U O R U MD E V I C E

    Figure 8. The core database that supports m any en terprise applications runs on aclustered pair of servers and it uses a quorum device .

    It can be argued that the business risk of putting a company's most precious datainto a cloud environment is too high. Not only is the data in someone else's hands,it is not as easy to verify that the cloud provider can and does protect its customer'sdata to the same extent that the business itself does. Today, many cloud providersdo not provide transparency into the security aspects of their business. Do theyexercise strict physical control over their datacenters, disk drives in storage systems,backup tapes, and networks? When customers delete data, do they also scrub itfrom their disks? The answers to these questions are not clear, so the risk cannot beassessed accurately. An equal risk is the business viability of the cloud provider itself:if the cloud provider suddenly files for bankruptcy, what happens to its customers'business-critical data? Or what if the business wants to change cloud providers?Techn ica l roadb lock sThere are numerous technical roadblocks that would prevent the cluster patternfrom operating in a cloud environment, whether a public or private cloud: T ra ditio na l c lu ste rin g m od el. A traditional clustered system needs shared storageto use as a quorum device. This shared storage must have semantics that includelocking. This is a specific requirement that prevents traditional clusters fromrunning in the cloud. While some cloud providers may offer services that wouldallow specific cluster im plementations to work, it is likely that clustering softwarewill adapt to the cloud before providers offer the special features they need.

    H ig h-sp ee d in te rc on ne ct. A cluster needs to have a dedicated, high-speed, low-latency interconnect between its members. Two virtual machines in a cloud couldbe interconnected using separate VLANs, but latency can be variable becausecustomers have no control over the physical placement of their virtual machines.Nor do they have control over the nature of the network link between them.

    S ca la bility . The standard virtual machine supported by cloud environments istypically limited to a fixed maximum number of CPUs. When moving an enterprisedatabase management system currently running on a Sun server with 64 quad-core SPARC64processors, a direct movement to a virtualized, x86-architectureenvironment could mean a dramatic loss in performance.

  • 8/4/2019 44034 Cloud Re Factoring 332072

    17/20

    15 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    A v aila b ilit y. The connectiv ity be tw een an enterprise datacen te r and a publiccloud prov ider needs to be considered . If a com pany 's operations depend onconnectivity over the In te rne t to a public cloud provider, and connec tivity is losto r im paired , so is the com pany's operations. Th is level of ava ilab ility is likely to beinsufficien t, especially given that connectiv ity on the In terne t can be im paired dueto conditions beyond any prov ider's con trol, inc lud ing cab le cuts and denial-o f-s er vi ce a tt ac k s.

    In com p atib le w ith th e c lo udThe assessm ent's bo ttom line is that, as the problem is defined, and the databasem anagem ent system structured , m oving a database cluster to a cloud w ill no tdeliver benefits , especially if t he com pany 's business operations depend on it.B ut suppose that the en terprise is consolidating m ultiple app lication silos in favorof a shared environm ent that depends on the cen tral database. M ore and moreapp lications now depend on the database m anagem ent system - but it has reachedthe a scalab ility lim it. The com pany has a budget fo r the pay-by-the-sip cloudcom puting m odel, bu t no t fo r the cap ita l cost o f a new , larger server.

    Optimize through refactoringIf the database m anagem ent system cannot run in the cloud or be op tim ized forthe cloud due to bo th business and technical issues, is there a w ay to refacto r thepattern to address the scalability prob lem ?

    W hen a centralized system is lim ited in its transactional th roughput, cach ing is astandard approach for offload ing and decentraliz ing the w ork load . If the app licationsusing the cen tral da tabase perfo rm many m ore reads than w rites, then read cach ingis a solu tion, and the cache can be im plem ented in the cloud desp ite the lim itedscalab ility of each v irtual m ach ine. In order to use a cache for an en terprise databasem anagem ent system , a business decision m ust be m ade regard ing what data canbe rep lica ted , cached , and poten tially allow ed to be stale. For exam ple, an on linem erchan t m ight cache product availab ility in form ation , taking the risk that w hen apurchase transaction is com mitted the produc t m ay no longer be available.The solu tion presen ted in F igure 9 illustrates how a cache for the enterprise databasecan be m oved in to the c loud, and a vertical scaling prob lem turned in to a horizon talscaling cha llenge. T he basic arch itectu re leaves the database cluster in theenterprise datacen te r, but it reduces the dem and on the database by estab lish inga c loud-based cache that contains data rep licated from the database on a period icbasis. E nte rprise app lications can access the cloud-based cache from the en terprisedatacen ter (if t he specific app lication is no t hosted in the c loud), o r from the clouditself (if t he app lication has been m oved in to the cloud).

  • 8/4/2019 44034 Cloud Re Factoring 332072

    18/20

    16 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    IIII+ + C L O U DR E P L I C A T I O N

    E N T E R P R I S ED A T A C E N T E R

    Figure 9. A cloud-based cache can so lve the scalab ility problem withou t m oving theen terprise d ata base clu ster in to the clo ud .

    The cloud-based cache shards, o r partitions, the database operations so the cachecan be horizon tally scaled and thus adap ted w ell fo r dep loym ent in the c loud : R ea d/w rite sh ard ing . F irst, read s are separated from w rites. O ne o r m ore w rite

    prox ies in te rac t w ith the clien t app lica tions and pass on w rite requests to theda tabase c luste r, possib ly asynchronously . R ead transactions are h andled by a se to f read caches tha t ho ld rep licated data from the database .

    D ata sha rdin g. There is no benefit to hav ing a unifo rm se t of read prox ies, eachof w hich m ust have a coheren t cache of recen tly used records from the database.T his approach a lone does no t reduce the num ber of transac tions that theda tabase m anagem ent system m ust support. W hen the da tabase da ta is shardedacross a num ber of caches, how ever, then each one can serve m any requests fo rthe sam e data based on a sing le tran saction w ith the database m anagem entsystem . T his allow s the cache to be sca led horizon tally to handle increasin glyla rge w ork loads w hile m in im iz ing the load on the source database .D atabase records can be sharded across the read caches in a num ber of w ays thatshou ld be de term ined based on database access patte rns. D ata cou ld be shardedon the basis o f tab les, o r ranges of data w ith in tab les, o r bo th .

    Op t im i ze f ur th e rIf the po in t o f the refacto ring perfo rm ed in the prev ious step is to in crease scalab ility ,then sca lab ility can be increased further by using the cloud 's e lasticity to scale upand dow n the number of read cache instances as needed to efficien tly serv ice theneeds of en te rprise app lications w hile red ucing the overa ll load on the en te rpriseda tabase m anagem ent system .

  • 8/4/2019 44034 Cloud Re Factoring 332072

    19/20

    17 Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    Chapter 4SummaryCloud computing is a model that organizations can exploit in order to reduce costs,increase flexibility, and reduce risk. It can be used to host applications ranging fromthose which are business critical to those which are needed to satisfy a short-term ortransient need, including running a single large job in the cloud.There are a number of considerations to make when deciding whether and how tomove an existing application or service into the cloud. First consider whether it isfeasible at all, or whether a technical roadblock might prevent such a move. Alsoconsider whether cost or risk considerations might make the move impractical. Thendetermine whether the application can run in the cloud, or whether it is, or can be,optimized to run in the cloud. Following the methodology presented in this papershould help cloud architects make informed decisions and follow strategies that willhelp them make the fullest use of cloud computing with the least risk.

    AcknowledgmentsThis paper was made possible through the efforts of Jason Carolan and Steve Gaede.The authors would like to thank Glenn Brunette, Grant Holland, John Stanford,and Hal Stern of Sun Microsystems, and Michael Rulf of AT&T Hosting, for theircareful review of the paper and helpful suggestions for improvement. Thanks to LouSpringer of Baumeister Corporation for the inspiration for the second example.

  • 8/4/2019 44034 Cloud Re Factoring 332072

    20/20

    Optimizing Applications for Cloud Computing Environments Sun Microsystems, Inc.

    Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA95054 USA Phone 1-650-960-1300 or 1-800-555-9SUN (9786) Web sun.com S un .microsystems

    2 009 Sun M icrosys tem s, Inc . A ll r igh ts rese rved . Sun , S un M icrosystem s, th e S un logo , S ola ris logo , G lassF ish , M ySQ L, M yS QL logo , O penS ola ris , So la ris, and "T he N etw ork is the C om put-er" ar e trademarks or regi stered tr ademar ks of Sun Micr osyst ems, Inc. or it s subsidiaries in the United States and other countr ies. All SPARe trademarks are used under li cense and are t rade-marks o r registered t rademarks of SPARe Interna tiona l, Inc. in the US and othe r count ries . P roduc ts bea ring SPARe t rademarks a re based upon an archi tec ture deve loped by Sun Microsystems, Inc.Information subject to change without notice. SunWin # 571825 GNWP15083-0 Printed in USA 11/09