Presentation is loading. Please wait.

Presentation is loading. Please wait.

Report Haiyong Wang. Outline A brief introduction to Chef A brief introduction to Ruby Latching VS Locking.

Similar presentations


Presentation on theme: "Report Haiyong Wang. Outline A brief introduction to Chef A brief introduction to Ruby Latching VS Locking."— Presentation transcript:

1 Report Haiyong Wang

2 Outline A brief introduction to Chef A brief introduction to Ruby Latching VS Locking

3 A brief Introduction to Chef Haiyong Wang

4

5 Outline What is chef Architecture and installing Using chef

6 What is Chef With Chef, you write abstract definitions as source code to describe how you want each part of your infrastructure to be built, and then apply those descriptions to individual servers.

7 Chef Provides Provisioning – Kickstart Jumpstart Configuration Management – Recipes, knife, cookbook Systems Integration

8 Chef Provides

9 Different Flavors of Chef Chef Solo Chef Client and Chef Server Hosted Chef

10 Chef Client and Chef Server

11 Installing Servers and Workstation – http://wiki.opscode.com/display/chef/Installing+C hef+Server+on+Debian+or+Ubuntu+using+Packag es http://wiki.opscode.com/display/chef/Installing+C hef+Server+on+Debian+or+Ubuntu+using+Packag es

12 Installing Clients – http://wiki.opscode.com/display/chef/Installing+C hef+Client+on+Ubuntu+or+Debian http://wiki.opscode.com/display/chef/Installing+C hef+Client+on+Ubuntu+or+Debian

13 Installing Important files – Validation.pem – client.pem – knife.rb – Client.rb

14 Using chef Important concepts – Git – Cookbook – Recipe – Run_list

15 Using chef cookbook Recipes configure bootstrap

16 Using Chef Useful links – Cookbook fast start http://wiki.opscode.com/display/chef/Cookbook+Fast+ Start+Guide http://wiki.opscode.com/display/chef/Cookbook+Fast+ Start+Guide – Github cookbook https://github.com/opscode-cookbooks https://github.com/infochimps-cookbooks – Cookbook community http://community.opscode.com/

17 Using Chef Hbase

18 Question ?

19 A brief introduction to Ruby

20 Check the syntax ruby –c rake test

21 Assignment #assigning a local variable #no type declaration #no semicolon x = 1 x, y, z = “100”, 200, 300 # global variable $amout = 1 #const variable Name = “Floydene Wallup” name = “Floydene Wallup”

22 Basic Arithmetic 5/2 #=> 2 5/2.0 #=> 2.5 (1+2)* 3 #=> 9 irb(main):001:0>3+4 #=> 7 irb(main):002:0> 7-3 #=>4 irb(main):005:0>3**4 #=> 81 irb(main):007:0> x= 12 #=> 12 irb(main):008:0> x+=1 irb(main):012:0> Math.sqrt(16) #=> 4

23 strings 'single quoted' # => "single quoted" "double quoted" # => "double quoted" 'It\'s alive' # => "It's alive!" "1 + 2 = 5" # => "1 + 2 = 5" th = "Hello world“ th[0..5] #=>Hello th[-5..-1] #=>world

24 Embedded x = "Bob" "Hi, #{x}" # => "Hi, Bob" 'Hello, #{x}' # => "Hello, #{x}"

25 Bool variables true # => true false # => false nil # => nil !true # => false !false # => true !nil # => true !!true # => true !!false # => false !!nil # => false !!0 # => true

26 Arrays x = ["a", "b", "c"]# => ["a", "b", "c"] x[0] # => "a" (zero is the first index) x.first # => "a" x.last # => "c" x + ["d"] # => ["a", "b", "c", "d"] x # => ["a", "b", "c"] x = x + ["d"] # => ["a", "b", "c", "d"] x # => ["a", "b", "c", "d"]

27 Hash # => { "first_name => "Bob", "last_name" => "Jones" } h = { "first_name" => "Bob", "last_name" => "Jones"} h.keys # => ["first_name", "last_name"] h["first_name"] # => "Bob" h["last_name"] # => "Jones" h["age"] = 23 h.keys # => ["first_name", "age", "last_name"] h.values # => ["Jones", "Bob", 23]

28 perl-style regular expressions "I believe" =~ /I/ # => 0 "I believe" =~ /lie/ # => 4 "I am human" =~ /bacon/ # => nil "I am human" !~ /bacon/ # => true /give me a ([0-9]+)/ =~ "give me a 7" # => 0

29 Conditional statement if false # this won't happen else if nil # this won't either else # code here will run end x = "dog" case x when "fish" # this won't happen when "dog", "cat", "monkey" # this will run else # the else is an optional catch-all end

30 Method def do_something_useless( first, second) puts "You gave me #{first} and #{second}" end do_something_useless( "apple", "banana") # => "You gave me apple and banana" do_something_useless 1, 2 # => "You gave me 1 and 2"

31 Function of the following code? n=120 primes = Array.new for i in 0..n-2 primes[i] = i+2 end index = 0 while primes[index]**2 <= primes.last prime = primes[index] primes = primes.select { |x| x == prime || x%prime != 0 } index += 1 end p primes

32 Question ?

33 Locking and Latching

34 Latching Purpose – exclusive access to memory structures Locking Purpose – share the same resource if compatible – enforce exclusive access if incompatible.

35 Locking and Latching Latching Jurisdiction – temporary memory objects – B-Tree index Locking Jurisdiction – database objects – tables, data blocks

36 Locking and Latching Latching Acquisition – willing-to-wait – no-wait Locking Acquisition – Null – row share – row exclusive – Share – share row exclusive – exclusive

37 Locking and Latching Latching Scope – instance level – Information kept in memory – visible to the local instance Locking Scope – database-level – Information kept in database – visible to all instances accessing the database

38 Locking and Latching Latching Complexity – Lightweight – Simple instructions – port specific Locking Complexity – Heavyweight – series of instructions with context switches

39 Locking and Latching Latching Duration – briefly – microseconds Locking Duration – an extended period of time – transactional duration

40 Locking and Latching Latching Queue – not queued Locking Queue – queued

41 Locking and Latching Latching Deadlock – No deadlocks Locking Deadlock – deadlocks

42 Thank you


Download ppt "Report Haiyong Wang. Outline A brief introduction to Chef A brief introduction to Ruby Latching VS Locking."

Similar presentations


Ads by Google