Introduction to Resque

  • 3,165 views
Uploaded on

社内勉強会での発表に使ったスライドです。 …

社内勉強会での発表に使ったスライドです。
GitHub で使われているジョブキューシステムの Resque について、簡単に説明しています。

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,165
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
27
Comments
0
Likes
6

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Introduction to Resque Nov. 20, 2009 (Fri.) Feedforce, Inc. suzuki@feedforce.jp
  • 2. Resque GitHub Ruby Ruby JobObj.perform(*args) Redis git://github.com/defunkt/resque.git WEB
  • 3. Redis Key-Value Store http://code.google.com/p/redis/ ANSI C POSIX String, List, Set
  • 4. Redis $telnet localhost 6379 SET keyname 3 bar +OK GET keyname $3 bar
  • 5. Redis http://w.koshigoe.jp/study/
  • 6. GitHub (run/fin) fat, old, too long push/pop
  • 7. O(1) push/pop Ruby
  • 8. Resque + Redis A. Resis Redis
  • 9. Resque WEB fork Hoptoad Redis
  • 10. 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/
  • 11. DEMO $ VERBOSE=true QUEUE=default rake resque:work
  • 12. DEMO $ VVERBOSE=true QUEUE=default rake resque:work
  • 13. DEMO $ open http://localhost:9292/resque/
  • 14. class Archive @queue = :file_serve def self.perform(repo_id, branch = 'master') repo = Repository.find(repo_id) repo.create_archive(branch) end end
  • 15. class Repository def async_create_archive(branch) Resque.enqueue(Archive, self.id, branch) end end
  • 16. klass, args = Resque.reserve(:file_serve) klass.perform(*args) if klass.respond_to? :perform
  • 17. $ cd app_root $ QUEUE=file_serve rake resque:work
  • 18. JSON { 'class': 'Archive', 'args': [ 44, 'masterbrew' ] }
  • 19. Resque::Failure Redis Resque Hoptoad http://www.hoptoadapp.com/pages/home
  • 20. Resque vs DelayedJob
  • 21. Resque Ruby Redis RAM
  • 22. DelayedJob Redis
  • 23. GitHub ( ) Ruby ( ) Redis ( ) → http://w.koshigoe.jp/study/ Resque Redis