Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Architecting for the Cloud
- The Netflix Way!
Codemash PreCompiler Workshop
- Jan 8th 2014

Sudhir Tonse
Manager, Cloud Pl...
NETFLIX
Netflix is the world’s leading Internet television
network with more than 40 million members in >40
countries enjo...
NETFLIX SCALE
•  100s of Mid-tier services and applications
•  Billions of Requests per day
•  ~70 Billion Events per day
...
I am PaaS (and so can You!)

Your Cloud PaaS

@stonse
Presentation & Workshop

@stonse
Agenda
• 

PaaS? What is it good for?

• 

NetflixOSS -> Build your own PaaS the Netflix Way!
•  What you need to build, d...
PaaS? What is it?

Libraries, Tools and Frameworks that enable
one to Build, Deploy and Manage Software
Services on Epheme...
@stonse
Netflix Cloud Stack (IaaS, PaaS, SaaS, Cloud Management)

@stonse

Virtualization Technologies
Netflix Cloud Stack
Clients
Browsers, Mobile, Televisions …

Applications/Web Services

PaaS
Execution Env (JVM), Web/App ...
@stonse
You can too!

@stonse

Virtualization Technologies
Build Your Own PaaS

@stonse
Build Your Own PaaS
• 

Yes you can!
•  Others have done it
•  Yes, on non-AWS environments too!!

@stonse
Cloud Native Architecture
The Netflix Way!?
Bus +

Freedom

Dev

+ Ops

Responsibility

Culture

@stonse

BusDevOps
Think …

Cloud Native Architecture

@stonse

More at http://www.siia.net/presentations/software/
AATC2013/OpenSourceAtNetf...
Fine-Grained Reliable, Available, Distributed Service
Oriented Architecture
- that supports Rapid Iteration/innovation

@s...
Architectural Insights

@stonse

Slide courtesy @adrianco
Architectural Insights

@stonse

Courtesy @adrianco
TYPICAL DEPLOYMENT
• 

Multiple Availability Zone

• 

Multiple Regions

@adrianco
Active: Active Deployment

@stonse
Active: Active Deployment

@stonse
•  RPS
•  Load Average

Slow Growth

Predictable Bursts

Compute

•  …

Time

Time

Compute

•  Use CloudWatch

Time
Perio...
Instance

Instance
Instance
Instance

Instance
Instance

Instance

Instance

Scale Up
Instance

Instance
Instance
Instance...
Scale Down
Instance
Instance

Instance
Instance

Instance

Instance

Instance
LIFECYCLE
• 

Think, Implement, Deploy, Test, Operate
AWS SERVICES (IAAS)

As of Jan 2014
@stonse
Platform Services + Application Framework
Libraries + Operational Tools
Your Cloud PaaS!!

OR

@stonse

Other IaaS
Platform Runtime Services
Metadata
Registry
Eureka

Monitoring
Services
Turbine

Distributed
Coordinator/Registry
(Zookeep...
Platform Libraries - Application Container/Framework
Function

NetflixOSS Library

REST Framework/Bootstrapping/DI

Karyon...
Platform Big Data/Caching & Services
Cassandra NoSQL

@stonse

Astyanax
Priam
CassJMeter

Hadoop Platform As a Service

Ge...
Platform Tools & Services
Deployment/Workflow

@stonse

Asgard

Frigga

Glisten

Aminator

Availability, Resiliency, Costi...
Soon ….

@stonse
How do I get Started?
Workshop Session …
How do I create an App/Service?

Instructions at http://bit.ly/1dlDyVC
@stonse
Sample Application – RSS Reader

http://techblog.netflix.com/2013/03/introducing-first-netflixoss-recipe-rss.html
@stonse
STEP 1
Choice A: Bare bones Web Service Template
$git clone https://github.com/Netflix/karyon.git
$cd karyon
$./gradlew cl...
STEP 2
• 

Customize your App using .war of previous step as a template
•  TIPS (optional)
•  Use Ribbon for RPC calls
•  ...
STEP 3
• 

@stonse

Bake an AMI (Amazon Machine Image) using NetflixOSS Aminator
STEP 4
• 

Deploy to EC2 using Asgard

Deploy & Manage AWS
Applications/Infrastructure

•  TIP: Employ Simian Army to test...
Building Apps and AMIs

@stonse
Building Apps and AMIs

App

Karyon

Build

WAR
Deploy

Aminator

Asgard

ASG /Cluster
Launch Instances
App
AMI
ASG/Cluste...
Your Cloud!

Metadata
Registry
Eureka
App
AMI
Billing ASG

@stonse

Ribbon (RPC)

App
AMI

Credit P ASG

App
AMI
Order P A...
Libraries and Services in (some) Detail ...
Eureka: Metadata Registry as a Service

@stonse
Eureka: Metadata Registry as a Service
Ribbon: RPC Library (with Software Load Balancers)

@stonse
RIBBON (RPC) CALL
try {

RestClient client = (RestClient)
ClientFactory.getNamedClient("FlixmashClient");

HttpRequest req...
Archaius: Configuration (properties) as a Service
• 

Property Driven Development

for (int i=0; I < numRowsProperty.get()...
Archaius: Configuration (properties) as a Service

@stonse
Archaius: Configuration (properties) as a Service

@stonse
Curator + Exhibitor: Distributed Sync & Coordination
Services
(Zookeeper)

http://curator.incubator.apache.org/

@stonse
Hystrix: Defend your App

@stonse
Hystrix: Defend your App

@stonse
Libraries/Services/Framework for Operations
Deploy ..

@stonse
Asgard: Deployment

@stonse
Glisten: Orchestration/Workflow

@stonse
Observe/Monitor …

@stonse

Insights
Servo (+ AWS CloudWatch): Metrics as a Service

JMX

CloudWatch

@stonse
Turbine: Hystrix Dashboard (Real Time Metrics
Aggregator)
• 
• 

@stonse

Low Latency, High Throughput Stream
Processing E...
Edda: Lifecycle (AWS resource) Blogger as a Service

@stonse
ICE : AWS Resource Usage (Cost)

@stonse
Are you Resilient?

@stonse
Simian Army: Availability/Resiliency as a Service
• 

Chaos Monkey
•  Kills instances

• 

Janitor Monkey
•  Clean up unus...
Monkeys Contd …

@stonse
Advanced Topics …

Predictive Auto Scaling Engine

http://techblog.netflix.com
@stonse
Genie: Hadoop Platform as a Service

@stonse

Jeff Magnusson: Tomorrow at
QConSF
Other Open Source Components (you can use)

+ Many Many More ….

@stonse
Further Reading …
• 

http://techblog.netflix.com

• 

http://slideshare.net/netflix

• 

http://netflix.github.io

• 

ht...
Workshop …
Hands On: Building Hello Netflix OSS application
• 

Concepts
• 
• 

Configuration

• 

Build Script (gradle)

...
Workshop …
Hands On: Building Hello Netflix OSS application
• 

@stonse

Instructions at http://bit.ly/1dlDyVC
Project Layout

@stonse
Project Layout
Application Container /Bootstrap
Located at https://netflix.box.com/s/suk5qlis3sn9f2sz44dl
public class HelloWorldBootstra...
JSR-311 Web Resource
1. Hello World Resource -> https://netflix.box.com/s/
nyspqi1an095d4p5xd7k
2. Flixmash Resource -> ht...
ARCHAIUS: PROPERTIES
flixmash.popularMovieList=Lord of the Ring,Matrix,Harry Potter,Gravity
private static final DynamicSt...
SERVO METRICS
// JMX: com.netflix.servo.COUNTER.FlixMash.getMovies
private static final Counter getMoviesCounter = new
Bas...
SERVO METRICS IN JMX
KARYON’S ADMIN CONSOLE
Takeaways …
• 

Cloud Computing and Cloud based Services requires embracing Cloud Native

- Adrian Cockroft (@adrianco)
• ...
CODEMASH
NETFLIX
SESSIONS
Architecting for the Cloud using NetflixOSS - Codemash Workshop
Architecting for the Cloud using NetflixOSS - Codemash Workshop
Prochain SlideShare
Chargement dans…5
×

Architecting for the Cloud using NetflixOSS - Codemash Workshop

19 189 vues

Publié le

Cloud development is inherently different than data center development. Understanding those differences, and architecting for them is critical to successful cloud solutions. In this workshop, we will both describe Netflix OSS platform components and show you how you can piece them together to build your own fault-tolerant REST services. These include: Hystrix, Ribbon, Eureka, and Archaius. In this hands-on lab, you will both learn the benefits of each of these services and use them in a sample application (in a test account). If you want to get things running in your own account, you may want to attend the afternoon session (Setting up your environment for the AWS cloud).

Publié dans : Technologie, Business

Architecting for the Cloud using NetflixOSS - Codemash Workshop

  1. 1. Architecting for the Cloud - The Netflix Way! Codemash PreCompiler Workshop - Jan 8th 2014 Sudhir Tonse Manager, Cloud Platform Infrastructure @stonse
  2. 2. NETFLIX Netflix is the world’s leading Internet television network with more than 40 million members in >40 countries enjoying more than one billion hours of TV shows and movies per month, including original series.
  3. 3. NETFLIX SCALE •  100s of Mid-tier services and applications •  Billions of Requests per day •  ~70 Billion Events per day •  10,000s of Ec2 Instances in use in multiple AWS Regions/ Zones •  Cassandra NoSQL database in a Global Ring spanning regions: Terabytes of data •  At peak consumes ~1/3 of US Internet Bandwidth
  4. 4. I am PaaS (and so can You!) Your Cloud PaaS @stonse
  5. 5. Presentation & Workshop @stonse
  6. 6. Agenda •  PaaS? What is it good for? •  NetflixOSS -> Build your own PaaS the Netflix Way! •  What you need to build, deploy and operate a Cloud Native set of applications •  Cloud Native Architecture •  Platform Services -> Application Services on top of IaaS •  Platform Libraries -> Application Framework Libraries •  Platform Tools/Operational Utilities -> Helps deploy and manage your Cloud Apps •  @stonse Build your own Web Service using NetflixOSS libraries
  7. 7. PaaS? What is it? Libraries, Tools and Frameworks that enable one to Build, Deploy and Manage Software Services on Ephemeral, On Demand Virtual Machines (IaaS) @stonse
  8. 8. @stonse
  9. 9. Netflix Cloud Stack (IaaS, PaaS, SaaS, Cloud Management) @stonse Virtualization Technologies
  10. 10. Netflix Cloud Stack Clients Browsers, Mobile, Televisions … Applications/Web Services PaaS Execution Env (JVM), Web/App Servers, Frameworks, Tools IaaS Virtual Machines, Networking, Load Balancers … @stonse Netflix Apps/Services
  11. 11. @stonse
  12. 12. You can too! @stonse Virtualization Technologies
  13. 13. Build Your Own PaaS @stonse
  14. 14. Build Your Own PaaS •  Yes you can! •  Others have done it •  Yes, on non-AWS environments too!! @stonse
  15. 15. Cloud Native Architecture
  16. 16. The Netflix Way!? Bus + Freedom Dev + Ops Responsibility Culture @stonse BusDevOps
  17. 17. Think … Cloud Native Architecture @stonse More at http://www.siia.net/presentations/software/ AATC2013/OpenSourceAtNetflix.pdf - Adrian Cockroft (@adrianco)
  18. 18. Fine-Grained Reliable, Available, Distributed Service Oriented Architecture - that supports Rapid Iteration/innovation @stonse
  19. 19. Architectural Insights @stonse Slide courtesy @adrianco
  20. 20. Architectural Insights @stonse Courtesy @adrianco
  21. 21. TYPICAL DEPLOYMENT •  Multiple Availability Zone •  Multiple Regions @adrianco
  22. 22. Active: Active Deployment @stonse
  23. 23. Active: Active Deployment @stonse
  24. 24. •  RPS •  Load Average Slow Growth Predictable Bursts Compute •  … Time Time Compute •  Use CloudWatch Time Periodic Jobs Compute Scale UP & Down based on Demand Compute •  Compute ON DEMAND AUTO SCALING! Time Unpredictable Bursts Time Steady State
  25. 25. Instance Instance Instance Instance Instance Instance Instance Instance Scale Up Instance Instance Instance Instance Instance Scale Up
  26. 26. Scale Down Instance Instance Instance Instance Instance Instance Instance
  27. 27. LIFECYCLE •  Think, Implement, Deploy, Test, Operate
  28. 28. AWS SERVICES (IAAS) As of Jan 2014 @stonse
  29. 29. Platform Services + Application Framework Libraries + Operational Tools
  30. 30. Your Cloud PaaS!! OR @stonse Other IaaS
  31. 31. Platform Runtime Services Metadata Registry Eureka Monitoring Services Turbine Distributed Coordinator/Registry (Zookeeper) Distributed Cache Exhibitor EVCache Metrics Services Servo + AWS Resources Lifecycle Service AWS CloudWatch Edda SQS @stonse
  32. 32. Platform Libraries - Application Container/Framework Function NetflixOSS Library REST Framework/Bootstrapping/DI Karyon/Governator Functional Reactive Programming RxJava Resiliency/Fallback Hystrix RPC (Routing/LB) Ribbon/Eureka Distributed Co-ordination (Zookeeper) Curator Distributed Caching EVCache NoSQL (Cassandra) Persistence Data Access/Caching Astyanax Monitoring Turbine Metrics Servo Logging Blitz4J Properties/Configuration @stonse Service Requests Archaius Config/Insights
  33. 33. Platform Big Data/Caching & Services Cassandra NoSQL @stonse Astyanax Priam CassJMeter Hadoop Platform As a Service Genie Lipstick
  34. 34. Platform Tools & Services Deployment/Workflow @stonse Asgard Frigga Glisten Aminator Availability, Resiliency, Costing, Monitoring (Ops Tools) SimianArmy ICE
  35. 35. Soon …. @stonse
  36. 36. How do I get Started? Workshop Session …
  37. 37. How do I create an App/Service? Instructions at http://bit.ly/1dlDyVC @stonse
  38. 38. Sample Application – RSS Reader http://techblog.netflix.com/2013/03/introducing-first-netflixoss-recipe-rss.html @stonse
  39. 39. STEP 1 Choice A: Bare bones Web Service Template $git clone https://github.com/Netflix/karyon.git $cd karyon $./gradlew clean build $./gradlew :karyon-examples:hello-netflixoss:jettyRun Choice B: Full blown Recipe (RSS Reader Recipe) $git clone https://github.com/Netflix/recipes-rss.git $cd recipes-rss $./gradlew clean build @stonse
  40. 40. STEP 2 •  Customize your App using .war of previous step as a template •  TIPS (optional) •  Use Ribbon for RPC calls •  Use Hystrix/RxJava for wrapping concurrent calls/RPC calls (Latency/Fault Tolerance) @stonse
  41. 41. STEP 3 •  @stonse Bake an AMI (Amazon Machine Image) using NetflixOSS Aminator
  42. 42. STEP 4 •  Deploy to EC2 using Asgard Deploy & Manage AWS Applications/Infrastructure •  TIP: Employ Simian Army to test Resiliency @stonse
  43. 43. Building Apps and AMIs @stonse
  44. 44. Building Apps and AMIs App Karyon Build WAR Deploy Aminator Asgard ASG /Cluster Launch Instances App AMI ASG/Cluster @stonse
  45. 45. Your Cloud! Metadata Registry Eureka App AMI Billing ASG @stonse Ribbon (RPC) App AMI Credit P ASG App AMI Order P ASG
  46. 46. Libraries and Services in (some) Detail ...
  47. 47. Eureka: Metadata Registry as a Service @stonse
  48. 48. Eureka: Metadata Registry as a Service
  49. 49. Ribbon: RPC Library (with Software Load Balancers) @stonse
  50. 50. RIBBON (RPC) CALL try { RestClient client = (RestClient) ClientFactory.getNamedClient("FlixmashClient"); HttpRequest request = HttpRequest.newBuilder().uri(new URI("/ flixmash/rest/v1/movies/popularMovies")).build(); response = client.executeWithLoadBalancer(request); String movies = response.getEntity(String.class); return movies; } catch (Exception exc) { throw new RuntimeException("Exception", exc); } finally { if (response!=null){ //hand the connection back to the pool response.close(); } }
  51. 51. Archaius: Configuration (properties) as a Service •  Property Driven Development for (int i=0; I < numRowsProperty.get(); i++){ fetchMovieForRow(i, numMoviePerRowProperty.get()); } @stonse
  52. 52. Archaius: Configuration (properties) as a Service @stonse
  53. 53. Archaius: Configuration (properties) as a Service @stonse
  54. 54. Curator + Exhibitor: Distributed Sync & Coordination Services (Zookeeper) http://curator.incubator.apache.org/ @stonse
  55. 55. Hystrix: Defend your App @stonse
  56. 56. Hystrix: Defend your App @stonse
  57. 57. Libraries/Services/Framework for Operations
  58. 58. Deploy .. @stonse
  59. 59. Asgard: Deployment @stonse
  60. 60. Glisten: Orchestration/Workflow @stonse
  61. 61. Observe/Monitor … @stonse Insights
  62. 62. Servo (+ AWS CloudWatch): Metrics as a Service JMX CloudWatch @stonse
  63. 63. Turbine: Hystrix Dashboard (Real Time Metrics Aggregator) •  •  @stonse Low Latency, High Throughput Stream Processing Engine Real Time Metrics Dashboard
  64. 64. Edda: Lifecycle (AWS resource) Blogger as a Service @stonse
  65. 65. ICE : AWS Resource Usage (Cost) @stonse
  66. 66. Are you Resilient? @stonse
  67. 67. Simian Army: Availability/Resiliency as a Service •  Chaos Monkey •  Kills instances •  Janitor Monkey •  Clean up unused Resources •  Conformity Monkey •  Confirms adherence to Best Practices •  Others (yet to be open sourced) •  Latency Monkey •  Chaos Kong •  … @stonse
  68. 68. Monkeys Contd … @stonse
  69. 69. Advanced Topics … Predictive Auto Scaling Engine http://techblog.netflix.com @stonse
  70. 70. Genie: Hadoop Platform as a Service @stonse Jeff Magnusson: Tomorrow at QConSF
  71. 71. Other Open Source Components (you can use) + Many Many More …. @stonse
  72. 72. Further Reading … •  http://techblog.netflix.com •  http://slideshare.net/netflix •  http://netflix.github.io •  http://fluxcapacitor.com •  https://github.com/cfregly/fluxcapacitor/wiki/NetflixOSS-FAQ @stonse
  73. 73. Workshop … Hands On: Building Hello Netflix OSS application •  Concepts •  •  Configuration •  Build Script (gradle) •  Application Container/Bootstrap •  JSR-311 Web Resource •  Properties via Archaius •  Metrics via Servo •  Dependency Injection via Governator/Guice •  RPC calls via Ribbon/Eureka •  Resiliency via Hystrix (wrappers on top of Ribbon) •  Invoking a Mid-tier Web Service •  @stonse Project Layout AdminConsole (port 8077)
  74. 74. Workshop … Hands On: Building Hello Netflix OSS application •  @stonse Instructions at http://bit.ly/1dlDyVC
  75. 75. Project Layout @stonse
  76. 76. Project Layout
  77. 77. Application Container /Bootstrap Located at https://netflix.box.com/s/suk5qlis3sn9f2sz44dl public class HelloWorldBootstrap extends ServerBootstrap { @Override protected void beforeInjectorCreation(LifecycleInjectorBuilder builderToBeUsed) { builderToBeUsed.withAdditionalModules(new JerseyServletModule() { @Override protected void configureServlets() { Map<String, String> params = Maps.newHashMap(); params.put(PackagesResourceConfig.PROPERTY_PACKA GES, "com.netflix.hellonoss, com.netflixoss.workshop"); serve("/rest/v1/ *").with(GuiceContainer.class, params); binder().bind(GuiceContainer.class).asEagerSingleton(); } }); } }
  78. 78. JSR-311 Web Resource 1. Hello World Resource -> https://netflix.box.com/s/ nyspqi1an095d4p5xd7k 2. Flixmash Resource -> https://netflix.box.com/s/ nb1nd7bqk7qcmxnwuol0 @Path("/flixmash") public class FlixmashResource { @GET @Path("popularMovies") @Produces({MediaType.APPLICATION_JSON}) public Response movies() { // Start timer Stopwatch stopwatch = getMoviesTimer.start(); JSONObject response = new JSONObject(); try { getMoviesCounter.increment(); response.put("Movies", flixmashManager.getPopularMovies()); // obtain movies from our flixMovies component return Response.ok(response.toString()).build(); } catch (JSONException e) { getMoviesErrorCounter.increment(); logger.error("Error creating json response.", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build (); } finally { stopwatch.stop(); } }
  79. 79. ARCHAIUS: PROPERTIES flixmash.popularMovieList=Lord of the Ring,Matrix,Harry Potter,Gravity private static final DynamicStringListProperty popularMovieList = new DynamicStringListProperty("flixmash.popularMovieList", (List<String>) null); List<String> movies = popularMovieList.get();
  80. 80. SERVO METRICS // JMX: com.netflix.servo.COUNTER.FlixMash.getMovies private static final Counter getMoviesCounter = new BasicCounter(MonitorConfig.builder("FlixMash.getMoviesCounter").build ()); DefaultMonitorRegistry.getInstance().register(getMoviesCounter); @GET @Path("popularMovies") @Produces({MediaType.APPLICATION_JSON}) public Response movies() { try { getMoviesCounter.increment(); … }catch (Exception e){ } }
  81. 81. SERVO METRICS IN JMX
  82. 82. KARYON’S ADMIN CONSOLE
  83. 83. Takeaways … •  Cloud Computing and Cloud based Services requires embracing Cloud Native - Adrian Cockroft (@adrianco) •  NetflixOSS is here to help! •  You can build your own custom PaaS the Netflix Way! http://netflix.github.io @stonse Yes, we are Hiring!
  84. 84. CODEMASH NETFLIX SESSIONS

×