SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
Introduction to
Resque
Nov. 20, 2009 (Fri.)
Feedforce, Inc.
suzuki@feedforce.jp
Resque
GitHub

Ruby

          Ruby

  JobObj.perform(*args)
                  Redis

git://github.com/defunkt/resque.git
                  WEB
Redis
 Key-Value Store

 http://code.google.com/p/redis/
 ANSI C

   POSIX

                                   String, List, Set
Redis
$telnet localhost 6379
SET keyname 3
bar
+OK
GET keyname
$3
bar
Redis
 http://w.koshigoe.jp/study/
GitHub
                                (run/fin)




               fat, old, too long



    push/pop
O(1)   push/pop



Ruby
Resque + Redis
A. Resis


           Redis
Resque

                    WEB

             fork



 Hoptoad

     Redis
DEMO
$ sudo gem install redis redis-namespace yajl-ruby 
 --source=http://gemcutter.org
$ sudo gem install sinatra
$ git clone git://github.com/defunkt/resque.git
$ cd resque/examples/demo
$ rackup config.ru
$ open http://localhost:9292/
DEMO
$ VERBOSE=true QUEUE=default rake resque:work
DEMO
$ VVERBOSE=true QUEUE=default rake resque:work
DEMO
$ open http://localhost:9292/resque/
class Archive
  @queue = :file_serve

 def self.perform(repo_id, branch = 'master')
  repo = Repository.find(repo_id)
  repo.create_archive(branch)
 end
end
class Repository
  def async_create_archive(branch)
   Resque.enqueue(Archive, self.id, branch)
  end
end
klass, args = Resque.reserve(:file_serve)
klass.perform(*args) if klass.respond_to? :perform
$ cd app_root
$ QUEUE=file_serve rake resque:work
JSON
{
    'class': 'Archive',
    'args': [ 44, 'masterbrew' ]
}
Resque::Failure

      Redis

Resque     Hoptoad

http://www.hoptoadapp.com/pages/home
Resque vs DelayedJob
Resque


Ruby




Redis
RAM
DelayedJob




Redis
GitHub     (                 )

Ruby           (        )

Redis                        (         )

                   → http://w.koshigoe.jp/study/

  Resque
  Redis
Introduction to Resque and Using Redis as a Queue

Mais conteúdo relacionado

Mais procurados

DevOps in PHP environment
DevOps in PHP environmentDevOps in PHP environment
DevOps in PHP environmentEvaldo Felipe
 
agri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertoragri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertorToshiaki Baba
 
37562259 top-consuming-process
37562259 top-consuming-process37562259 top-consuming-process
37562259 top-consuming-processskumner
 
The Art of Command Line (2021)
The Art of Command Line (2021)The Art of Command Line (2021)
The Art of Command Line (2021)Kenta Yamamoto
 
Commit2015 kharchenko - python generators - ext
Commit2015   kharchenko - python generators - extCommit2015   kharchenko - python generators - ext
Commit2015 kharchenko - python generators - extMaxym Kharchenko
 
Gogo shell
Gogo shellGogo shell
Gogo shelljwausle
 
Using rbenv in Production
Using rbenv in ProductionUsing rbenv in Production
Using rbenv in ProductionNic Benders
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialGagah Arifianto
 
Clojure + MongoDB on Heroku
Clojure + MongoDB on HerokuClojure + MongoDB on Heroku
Clojure + MongoDB on HerokuNaoyuki Kakuda
 
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...More than Applications: (Ab)using Docker to Improve the Portability of Everyt...
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...Dexter Horthy
 
Apache Hadoop for System Administrators
Apache Hadoop for System AdministratorsApache Hadoop for System Administrators
Apache Hadoop for System AdministratorsAllen Wittenauer
 
Building and Testing Puppet with Docker
Building and Testing Puppet with DockerBuilding and Testing Puppet with Docker
Building and Testing Puppet with Dockercarlaasouza
 
Ceph Korean Documentation
Ceph Korean DocumentationCeph Korean Documentation
Ceph Korean DocumentationJunyoung Sung
 
What's Special About Elixir
What's Special About ElixirWhat's Special About Elixir
What's Special About ElixirNeven Rakonić
 
File Space Usage Information and EMail Report - Shell Script
File Space Usage Information and EMail Report - Shell ScriptFile Space Usage Information and EMail Report - Shell Script
File Space Usage Information and EMail Report - Shell ScriptVCP Muthukrishna
 

Mais procurados (19)

DevOps in PHP environment
DevOps in PHP environmentDevOps in PHP environment
DevOps in PHP environment
 
agri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertoragri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertor
 
EC2
EC2EC2
EC2
 
37562259 top-consuming-process
37562259 top-consuming-process37562259 top-consuming-process
37562259 top-consuming-process
 
The Art of Command Line (2021)
The Art of Command Line (2021)The Art of Command Line (2021)
The Art of Command Line (2021)
 
Commit2015 kharchenko - python generators - ext
Commit2015   kharchenko - python generators - extCommit2015   kharchenko - python generators - ext
Commit2015 kharchenko - python generators - ext
 
Gogo shell
Gogo shellGogo shell
Gogo shell
 
Fabric for fun_and_profit
Fabric for fun_and_profitFabric for fun_and_profit
Fabric for fun_and_profit
 
Using rbenv in Production
Using rbenv in ProductionUsing rbenv in Production
Using rbenv in Production
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline Tutorial
 
Clojure + MongoDB on Heroku
Clojure + MongoDB on HerokuClojure + MongoDB on Heroku
Clojure + MongoDB on Heroku
 
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...More than Applications: (Ab)using Docker to Improve the Portability of Everyt...
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...
 
Apache Hadoop for System Administrators
Apache Hadoop for System AdministratorsApache Hadoop for System Administrators
Apache Hadoop for System Administrators
 
Building and Testing Puppet with Docker
Building and Testing Puppet with DockerBuilding and Testing Puppet with Docker
Building and Testing Puppet with Docker
 
Ceph Korean Documentation
Ceph Korean DocumentationCeph Korean Documentation
Ceph Korean Documentation
 
Laravel Day / Deploy
Laravel Day / DeployLaravel Day / Deploy
Laravel Day / Deploy
 
What's Special About Elixir
What's Special About ElixirWhat's Special About Elixir
What's Special About Elixir
 
earthquake.gem
earthquake.gemearthquake.gem
earthquake.gem
 
File Space Usage Information and EMail Report - Shell Script
File Space Usage Information and EMail Report - Shell ScriptFile Space Usage Information and EMail Report - Shell Script
File Space Usage Information and EMail Report - Shell Script
 

Semelhante a Introduction to Resque and Using Redis as a Queue

Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby CoreHiroshi SHIBATA
 
Rush, a shell that will yield to you
Rush, a shell that will yield to youRush, a shell that will yield to you
Rush, a shell that will yield to youguestdd9d06
 
Puppet at GitHub
Puppet at GitHubPuppet at GitHub
Puppet at GitHubPuppet
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2rubyMarc Chung
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Andres Almiray
 
solving little problems
solving little problemssolving little problems
solving little problemsAustin Ziegler
 
URL Mapping, with and without mod_rewrite
URL Mapping, with and without mod_rewriteURL Mapping, with and without mod_rewrite
URL Mapping, with and without mod_rewriteRich Bowen
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers StealBen Scofield
 
Introducing PHP Latest Updates
Introducing PHP Latest UpdatesIntroducing PHP Latest Updates
Introducing PHP Latest UpdatesIftekhar Eather
 
Pourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentPourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentNicolas Ledez
 
Docker in Action
Docker in ActionDocker in Action
Docker in ActionSimon Su
 
Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014Pini Reznik
 
Serializing Ruby Objects in Redis
Serializing Ruby Objects in RedisSerializing Ruby Objects in Redis
Serializing Ruby Objects in RedisBrian Kaney
 
BSDM with BASH: Command Interpolation
BSDM with BASH: Command InterpolationBSDM with BASH: Command Interpolation
BSDM with BASH: Command InterpolationWorkhorse Computing
 
Mastering Namespaces in PHP
Mastering Namespaces in PHPMastering Namespaces in PHP
Mastering Namespaces in PHPNick Belhomme
 
Capistrano - automate all the things
Capistrano - automate all the thingsCapistrano - automate all the things
Capistrano - automate all the thingsJohn Cleary
 
Build-a-Gem Workshop
Build-a-Gem WorkshopBuild-a-Gem Workshop
Build-a-Gem WorkshopBrian Kaney
 

Semelhante a Introduction to Resque and Using Redis as a Queue (20)

Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby Core
 
Rush, a shell that will yield to you
Rush, a shell that will yield to youRush, a shell that will yield to you
Rush, a shell that will yield to you
 
Puppet at GitHub
Puppet at GitHubPuppet at GitHub
Puppet at GitHub
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2ruby
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
DevOps with Fabric
DevOps with FabricDevOps with Fabric
DevOps with Fabric
 
solving little problems
solving little problemssolving little problems
solving little problems
 
URL Mapping, with and without mod_rewrite
URL Mapping, with and without mod_rewriteURL Mapping, with and without mod_rewrite
URL Mapping, with and without mod_rewrite
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers Steal
 
Introducing PHP Latest Updates
Introducing PHP Latest UpdatesIntroducing PHP Latest Updates
Introducing PHP Latest Updates
 
Pourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentPourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirent
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014
 
Serializing Ruby Objects in Redis
Serializing Ruby Objects in RedisSerializing Ruby Objects in Redis
Serializing Ruby Objects in Redis
 
BSDM with BASH: Command Interpolation
BSDM with BASH: Command InterpolationBSDM with BASH: Command Interpolation
BSDM with BASH: Command Interpolation
 
Ruby 2.0
Ruby 2.0Ruby 2.0
Ruby 2.0
 
Mastering Namespaces in PHP
Mastering Namespaces in PHPMastering Namespaces in PHP
Mastering Namespaces in PHP
 
Capistrano - automate all the things
Capistrano - automate all the thingsCapistrano - automate all the things
Capistrano - automate all the things
 
Php resque
Php resquePhp resque
Php resque
 
Build-a-Gem Workshop
Build-a-Gem WorkshopBuild-a-Gem Workshop
Build-a-Gem Workshop
 

Introduction to Resque and Using Redis as a Queue