SlideShare a Scribd company logo
1 of 8
Download to read offline
.




.




             Raemon
               @yinhm

               June 7, 2010




    .                 .
    @yinhm   Raemon           1/8
.




             Daemon libs
.




             • daemons
             • servolux
             • daemon kit




    .                                .
    @yinhm                  Raemon       2/8
.




             Raemon
.




             • base on unicorn
             • master -> multi-work(preforked) model




    .                                     .
    @yinhm                       Raemon                3/8
.




             Unicorn
.




             • it is UNIX
             • fork
             • IO::pipe, selfpipe
             • socket
             • tmpio




    .                                        .
    @yinhm                          Raemon       4/8
.




             example: consume queue
.
             #!/ u s r / b i n / env ruby
             r e q u i r e ' rubygems '
             r e q u i r e ' raemon '
             r e q u i r e ' b e a n s t a l k−c l i e n t '

             ENV[ " RAILS_ENV " ] ||= " development "
             r e q u i r e F i l e . dirname (__FILE__) + " / . . / . . / c o n f i g / environment "
             A c t i o n C o n t r o l l e r : : Base . perform_caching = f a l s e

             c l a s s FooJobWorker
                 TIMEOUT = 10
                 i n c l u d e Raemon : : Worker
                 def before_start
                     @ b e a n s t a l k = B e a n s t a l k : : Pool . new ( [ ' l o c a l h o s t : 1 1 3 0 0 ' ] , ' foo ' )
                 end
                 d e f before_shutdown
                     @beanstalk . c l o s e
                 end
                 def execute
                     ...
                 end
             end
             Raemon : : Master . s t a r t u p ( 2 , FooJobWorker , {
                                                           : detach          = true ,
                                                                              >
                                                           : logger          = Logger . new (RAILS_ROOT + '/ l o g / foo_queue . log ' ) ,
                                                                              >
                                                           : p i d _ f i l e = RAILS_ROOT + '/tmp/ p i d s / foo_queue . pid ' ,
                                                                              >
                                                           : timeout = 120    >
                                                       }). join
    .                                                                        .
    @yinhm                                                     Raemon                                                                        5/8
.




             example: execute
.
             c l a s s FooJobWorker
                 ...

                def execute
                  begin
                    j o b = @ b e a n s t a l k . r e s e r v e (TIMEOUT)

                      i f job
                         l o g g e r . i n f o "(#{ P r o c e s s . pp id }:#{ P r o c e s s . p i d }) got j o b : #{j o b . i n s p e c t }"

                           A c t i v e R e c o r d : : Base . c o n n e c t i o n . uncached do
                               f o o = Foo . f i n d ( j o b . ybody )
                               i f foo . process
                                   job . d e l e t e
                               else
                                   j o b . r e l e a s e ( j o b . p r i , 60)
                               end
                           end
                       end
                   r e s c u e B e a n s t a l k : : TimedOut
                   rescue StandardError
                       l o g g e r . e r r o r " Got e x c e p t i o n : #{$ ! . i n s p e c t }"

                   i f job
                      job . d e l e t e
                      job = n i l
                   end
                 end
    .          end
    @yinhm   end                                                      Raemon           .                                                         6/8
.




             References
.




             • Raemon
             • Unicorn
             • I like Unicorn because it's Unix




    .                                       .
    @yinhm                         Raemon         7/8
.




             About
.




                     Created in A E using the beamer class, TeX Live and Emacs.
                                L X
                                 T


                     Published under the Creative Commons Attribution 3.0 License
                           http://creativecommons.org/licenses/by/3.0/

                                             by @yinhm
                                     http://yinhm.appspot.com


                                   Document version June 7, 2010




    .                                              .
    @yinhm                             Raemon                                       8/8

More Related Content

Viewers also liked

Dart intro
Dart introDart intro
Dart introyinhm .
 
Portafolio de servicios Enlaces Asesoria Empresarial en Recursos Humanos
Portafolio de servicios Enlaces Asesoria Empresarial en Recursos HumanosPortafolio de servicios Enlaces Asesoria Empresarial en Recursos Humanos
Portafolio de servicios Enlaces Asesoria Empresarial en Recursos HumanosClaudia Lambraño
 
git svn workflow
git svn workflowgit svn workflow
git svn workflowyinhm .
 
Write a Google Closure Editor Plugin
Write a Google Closure Editor PluginWrite a Google Closure Editor Plugin
Write a Google Closure Editor Pluginyinhm .
 
Ruby的类和对象模型
Ruby的类和对象模型Ruby的类和对象模型
Ruby的类和对象模型yinhm .
 
Emacs入门
Emacs入门Emacs入门
Emacs入门yinhm .
 

Viewers also liked (7)

Dart intro
Dart introDart intro
Dart intro
 
Portafolio de servicios Enlaces Asesoria Empresarial en Recursos Humanos
Portafolio de servicios Enlaces Asesoria Empresarial en Recursos HumanosPortafolio de servicios Enlaces Asesoria Empresarial en Recursos Humanos
Portafolio de servicios Enlaces Asesoria Empresarial en Recursos Humanos
 
git svn workflow
git svn workflowgit svn workflow
git svn workflow
 
Write a Google Closure Editor Plugin
Write a Google Closure Editor PluginWrite a Google Closure Editor Plugin
Write a Google Closure Editor Plugin
 
Ruby的类和对象模型
Ruby的类和对象模型Ruby的类和对象模型
Ruby的类和对象模型
 
Emacs入门
Emacs入门Emacs入门
Emacs入门
 
Heroku
HerokuHeroku
Heroku
 

Similar to Raemon

Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009Jan Wedekind
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011tobiascrawley
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of GoFrank Müller
 
Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Robert Lemke
 
Stop Reinventing The Wheel - The Ruby Standard Library
Stop Reinventing The Wheel - The Ruby Standard LibraryStop Reinventing The Wheel - The Ruby Standard Library
Stop Reinventing The Wheel - The Ruby Standard LibraryBrian Hogan
 
How to discover the Ruby's defects with web application
How to discover the Ruby's defects with web applicationHow to discover the Ruby's defects with web application
How to discover the Ruby's defects with web applicationHiroshi SHIBATA
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends旻琦 潘
 
Active Support Core Extensions (1)
Active Support Core Extensions (1)Active Support Core Extensions (1)
Active Support Core Extensions (1)RORLAB
 
Integrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby AmfIntegrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby Amfrailsconf
 
To Batch Or Not To Batch
To Batch Or Not To BatchTo Batch Or Not To Batch
To Batch Or Not To BatchLuca Mearelli
 
File & Exception Handling in C++.pptx
File & Exception Handling in C++.pptxFile & Exception Handling in C++.pptx
File & Exception Handling in C++.pptxRutujaTandalwade
 

Similar to Raemon (20)

Having Fun Programming!
Having Fun Programming!Having Fun Programming!
Having Fun Programming!
 
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009
 
儲かるドキュメント
儲かるドキュメント儲かるドキュメント
儲かるドキュメント
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of Go
 
Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0
 
Stop Reinventing The Wheel - The Ruby Standard Library
Stop Reinventing The Wheel - The Ruby Standard LibraryStop Reinventing The Wheel - The Ruby Standard Library
Stop Reinventing The Wheel - The Ruby Standard Library
 
How to discover the Ruby's defects with web application
How to discover the Ruby's defects with web applicationHow to discover the Ruby's defects with web application
How to discover the Ruby's defects with web application
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends
 
Active Support Core Extensions (1)
Active Support Core Extensions (1)Active Support Core Extensions (1)
Active Support Core Extensions (1)
 
Unit-4 PPTs.pptx
Unit-4 PPTs.pptxUnit-4 PPTs.pptx
Unit-4 PPTs.pptx
 
Integrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby AmfIntegrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby Amf
 
Flex With Rubyamf
Flex With RubyamfFlex With Rubyamf
Flex With Rubyamf
 
Git::Hooks
Git::HooksGit::Hooks
Git::Hooks
 
Introduction to c part 4
Introduction to c  part  4Introduction to c  part  4
Introduction to c part 4
 
To Batch Or Not To Batch
To Batch Or Not To BatchTo Batch Or Not To Batch
To Batch Or Not To Batch
 
File & Exception Handling in C++.pptx
File & Exception Handling in C++.pptxFile & Exception Handling in C++.pptx
File & Exception Handling in C++.pptx
 
Symfony 4 & Flex news
Symfony 4 & Flex newsSymfony 4 & Flex news
Symfony 4 & Flex news
 
earthquake.gem
earthquake.gemearthquake.gem
earthquake.gem
 

Recently uploaded

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Recently uploaded (20)

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

Raemon

  • 1. . . Raemon @yinhm June 7, 2010 . . @yinhm Raemon 1/8
  • 2. . Daemon libs . • daemons • servolux • daemon kit . . @yinhm Raemon 2/8
  • 3. . Raemon . • base on unicorn • master -> multi-work(preforked) model . . @yinhm Raemon 3/8
  • 4. . Unicorn . • it is UNIX • fork • IO::pipe, selfpipe • socket • tmpio . . @yinhm Raemon 4/8
  • 5. . example: consume queue . #!/ u s r / b i n / env ruby r e q u i r e ' rubygems ' r e q u i r e ' raemon ' r e q u i r e ' b e a n s t a l k−c l i e n t ' ENV[ " RAILS_ENV " ] ||= " development " r e q u i r e F i l e . dirname (__FILE__) + " / . . / . . / c o n f i g / environment " A c t i o n C o n t r o l l e r : : Base . perform_caching = f a l s e c l a s s FooJobWorker TIMEOUT = 10 i n c l u d e Raemon : : Worker def before_start @ b e a n s t a l k = B e a n s t a l k : : Pool . new ( [ ' l o c a l h o s t : 1 1 3 0 0 ' ] , ' foo ' ) end d e f before_shutdown @beanstalk . c l o s e end def execute ... end end Raemon : : Master . s t a r t u p ( 2 , FooJobWorker , { : detach = true , > : logger = Logger . new (RAILS_ROOT + '/ l o g / foo_queue . log ' ) , > : p i d _ f i l e = RAILS_ROOT + '/tmp/ p i d s / foo_queue . pid ' , > : timeout = 120 > }). join . . @yinhm Raemon 5/8
  • 6. . example: execute . c l a s s FooJobWorker ... def execute begin j o b = @ b e a n s t a l k . r e s e r v e (TIMEOUT) i f job l o g g e r . i n f o "(#{ P r o c e s s . pp id }:#{ P r o c e s s . p i d }) got j o b : #{j o b . i n s p e c t }" A c t i v e R e c o r d : : Base . c o n n e c t i o n . uncached do f o o = Foo . f i n d ( j o b . ybody ) i f foo . process job . d e l e t e else j o b . r e l e a s e ( j o b . p r i , 60) end end end r e s c u e B e a n s t a l k : : TimedOut rescue StandardError l o g g e r . e r r o r " Got e x c e p t i o n : #{$ ! . i n s p e c t }" i f job job . d e l e t e job = n i l end end . end @yinhm end Raemon . 6/8
  • 7. . References . • Raemon • Unicorn • I like Unicorn because it's Unix . . @yinhm Raemon 7/8
  • 8. . About . Created in A E using the beamer class, TeX Live and Emacs. L X T Published under the Creative Commons Attribution 3.0 License http://creativecommons.org/licenses/by/3.0/ by @yinhm http://yinhm.appspot.com Document version June 7, 2010 . . @yinhm Raemon 8/8