Php resque

5,672 views

Published on

This talk presents php-resque which is a php port of resque which was built by the cool folks @ github.

Published in: Technology
1 Comment
8 Likes
Statistics
Notes
  • IT Pathshala, Noida-Sector-63, offers Guaranteed JOB with PHP Training Programs.

    PAY US ONLY IF YOU GET A JOB!

    CALL US - +91-9871350999 or +91-8800394970

    Technology Centre Address: H-110, Sector-63, Noida (UP)

    Program Takeaways:

    - GUARANTEED JOB in your technology domain
    - Live Major Project development
    - Experience Letter on Training Completion
    - Certification on Training Completion
    - Project Source Code available in CD

    Program Highlights:

    - 100% Guaranteed Job – Don’t pay us if you don’t get a JOB!
    - Industry Ready Courses
    - LIVE International Project Experience
    - Exposure to corporate culture at our IT services facility
    - Networking & Interaction with Industry Experts
    - Training Provided by a reputed IT Company
    - Live Project Source Code made available in CD
    - Technology certification and experience letter at program completion
    - Online Study Content

    CALL US - +91-9871350999 or +91-8800394970

    Our website: www.itpathshala.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
5,672
On SlideShare
0
From Embeds
0
Number of Embeds
74
Actions
Shares
0
Downloads
37
Comments
1
Likes
8
Embeds 0
No embeds

No notes for slide
  • hello and welcome to my talk on php-resque\nbefore we proceed i have to tell you all that php-resque was developed by chris boulton\nmy name is chaitanya kuber and can be contacted via twitter\n
  • hello and welcome to my talk on php-resque\nbefore we proceed i have to tell you all that php-resque was developed by chris boulton\nmy name is chaitanya kuber and can be contacted via twitter\n
  • hello and welcome to my talk on php-resque\nbefore we proceed i have to tell you all that php-resque was developed by chris boulton\nmy name is chaitanya kuber and can be contacted via twitter\n
  • standing here and doing this presentaiton is a little strange because i know everyone in the audience is smarter than myself\nthat said, i want to provide a little bit of context about our world\ntalk about what resque is and how it works\nthe move to php\nwhat we use it for @ bigcommerce\n\n
  • standing here and doing this presentaiton is a little strange because i know everyone in the audience is smarter than myself\nthat said, i want to provide a little bit of context about our world\ntalk about what resque is and how it works\nthe move to php\nwhat we use it for @ bigcommerce\n\n
  • standing here and doing this presentaiton is a little strange because i know everyone in the audience is smarter than myself\nthat said, i want to provide a little bit of context about our world\ntalk about what resque is and how it works\nthe move to php\nwhat we use it for @ bigcommerce\n\n
  • standing here and doing this presentaiton is a little strange because i know everyone in the audience is smarter than myself\nthat said, i want to provide a little bit of context about our world\ntalk about what resque is and how it works\nthe move to php\nwhat we use it for @ bigcommerce\n\n
  • context, it really is everything\nin engineering web applications its all about the milliseconds\ntasks like …. take time\nthey not only take time, often they are supporting tasks\nthings that do not directly impact servicing a request form the user\n
  • context, it really is everything\nin engineering web applications its all about the milliseconds\ntasks like …. take time\nthey not only take time, often they are supporting tasks\nthings that do not directly impact servicing a request form the user\n
  • context, it really is everything\nin engineering web applications its all about the milliseconds\ntasks like …. take time\nthey not only take time, often they are supporting tasks\nthings that do not directly impact servicing a request form the user\n
  • context, it really is everything\nin engineering web applications its all about the milliseconds\ntasks like …. take time\nthey not only take time, often they are supporting tasks\nthings that do not directly impact servicing a request form the user\n
  • context, it really is everything\nin engineering web applications its all about the milliseconds\ntasks like …. take time\nthey not only take time, often they are supporting tasks\nthings that do not directly impact servicing a request form the user\n
  • users are fickle\ni like to think that a web application should focus on responding as fast possible to the request form its user\nif not they will leave\nso, any operation thats not directly related to the request can and probably should go elsewhere\n\n
  • where ?\nbackground jobs … whats that\nthink asynchronous\nsupermarket shelves are stacked in the night to ensure shoppers can walk in get there things and walk out\nit would be a sucky experience to walk in and wait for them to stock the milk before you could buy it\n
  • where ?\nbackground jobs … whats that\nthink asynchronous\nsupermarket shelves are stacked in the night to ensure shoppers can walk in get there things and walk out\nit would be a sucky experience to walk in and wait for them to stock the milk before you could buy it\n
  • there are various systems to do background/async processing\nbackgroundjob is a zero admin background priority queue for rails\ndelayedjob is similar with the advantage that it doesn’t load the entire rails env into memory\nbeanstalk is a simple, fast work queue. its interface is generic, was designed for increase response times for high-volume web apps\ngearman is quite similar to resque as it supports persistant queues, is open source, fault tolerant and is distributed\n
  • there are various systems to do background/async processing\nbackgroundjob is a zero admin background priority queue for rails\ndelayedjob is similar with the advantage that it doesn’t load the entire rails env into memory\nbeanstalk is a simple, fast work queue. its interface is generic, was designed for increase response times for high-volume web apps\ngearman is quite similar to resque as it supports persistant queues, is open source, fault tolerant and is distributed\n
  • there are various systems to do background/async processing\nbackgroundjob is a zero admin background priority queue for rails\ndelayedjob is similar with the advantage that it doesn’t load the entire rails env into memory\nbeanstalk is a simple, fast work queue. its interface is generic, was designed for increase response times for high-volume web apps\ngearman is quite similar to resque as it supports persistant queues, is open source, fault tolerant and is distributed\n
  • there are various systems to do background/async processing\nbackgroundjob is a zero admin background priority queue for rails\ndelayedjob is similar with the advantage that it doesn’t load the entire rails env into memory\nbeanstalk is a simple, fast work queue. its interface is generic, was designed for increase response times for high-volume web apps\ngearman is quite similar to resque as it supports persistant queues, is open source, fault tolerant and is distributed\n
  • there are various systems to do background/async processing\nbackgroundjob is a zero admin background priority queue for rails\ndelayedjob is similar with the advantage that it doesn’t load the entire rails env into memory\nbeanstalk is a simple, fast work queue. its interface is generic, was designed for increase response times for high-volume web apps\ngearman is quite similar to resque as it supports persistant queues, is open source, fault tolerant and is distributed\n
  • there are various systems to do background/async processing\nbackgroundjob is a zero admin background priority queue for rails\ndelayedjob is similar with the advantage that it doesn’t load the entire rails env into memory\nbeanstalk is a simple, fast work queue. its interface is generic, was designed for increase response times for high-volume web apps\ngearman is quite similar to resque as it supports persistant queues, is open source, fault tolerant and is distributed\n
  • it was developed by the cool folks @github, it was inspired by delayedjob\nresque is written in ruby which is a redis backed library for creating background jobs, placing them in queues and processing them later\nworkers can process one or multiple queues\nworkers can be run on different servers\n
  • it was developed by the cool folks @github, it was inspired by delayedjob\nresque is written in ruby which is a redis backed library for creating background jobs, placing them in queues and processing them later\nworkers can process one or multiple queues\nworkers can be run on different servers\n
  • it was developed by the cool folks @github, it was inspired by delayedjob\nresque is written in ruby which is a redis backed library for creating background jobs, placing them in queues and processing them later\nworkers can process one or multiple queues\nworkers can be run on different servers\n
  • it was developed by the cool folks @github, it was inspired by delayedjob\nresque is written in ruby which is a redis backed library for creating background jobs, placing them in queues and processing them later\nworkers can process one or multiple queues\nworkers can be run on different servers\n
  • it was developed by the cool folks @github, it was inspired by delayedjob\nresque is written in ruby which is a redis backed library for creating background jobs, placing them in queues and processing them later\nworkers can process one or multiple queues\nworkers can be run on different servers\n
  • it was developed by the cool folks @github, it was inspired by delayedjob\nresque is written in ruby which is a redis backed library for creating background jobs, placing them in queues and processing them later\nworkers can process one or multiple queues\nworkers can be run on different servers\n
  • it was developed by the cool folks @github, it was inspired by delayedjob\nresque is written in ruby which is a redis backed library for creating background jobs, placing them in queues and processing them later\nworkers can process one or multiple queues\nworkers can be run on different servers\n
  • resque supports prioritising jobs by prioritising queues against each other\njobs are persisted to queues as JSON objects and the queues are stored in redis as lists\na nice web interface, a sinatra app, is also included for monitoring the workers\nplugin system using a event framework for events like after_fork, before_fork etc \n
  • resque supports prioritising jobs by prioritising queues against each other\njobs are persisted to queues as JSON objects and the queues are stored in redis as lists\na nice web interface, a sinatra app, is also included for monitoring the workers\nplugin system using a event framework for events like after_fork, before_fork etc \n
  • resque supports prioritising jobs by prioritising queues against each other\njobs are persisted to queues as JSON objects and the queues are stored in redis as lists\na nice web interface, a sinatra app, is also included for monitoring the workers\nplugin system using a event framework for events like after_fork, before_fork etc \n
  • resque supports prioritising jobs by prioritising queues against each other\njobs are persisted to queues as JSON objects and the queues are stored in redis as lists\na nice web interface, a sinatra app, is also included for monitoring the workers\nplugin system using a event framework for events like after_fork, before_fork etc \n
  • resque supports prioritising jobs by prioritising queues against each other\njobs are persisted to queues as JSON objects and the queues are stored in redis as lists\na nice web interface, a sinatra app, is also included for monitoring the workers\nplugin system using a event framework for events like after_fork, before_fork etc \n
  • this is a little tangent, but i quickly want to talk about redis\nit’s a key-value store, all its operations are atomic and O(1) meaning they will always complete in a constant amount of time\nthis means speed and its really important when you want to set and forget\n\n
  • this is a little tangent, but i quickly want to talk about redis\nit’s a key-value store, all its operations are atomic and O(1) meaning they will always complete in a constant amount of time\nthis means speed and its really important when you want to set and forget\n\n
  • this is a little tangent, but i quickly want to talk about redis\nit’s a key-value store, all its operations are atomic and O(1) meaning they will always complete in a constant amount of time\nthis means speed and its really important when you want to set and forget\n\n
  • this is a little tangent, but i quickly want to talk about redis\nit’s a key-value store, all its operations are atomic and O(1) meaning they will always complete in a constant amount of time\nthis means speed and its really important when you want to set and forget\n\n
  • this is a little tangent, but i quickly want to talk about redis\nit’s a key-value store, all its operations are atomic and O(1) meaning they will always complete in a constant amount of time\nthis means speed and its really important when you want to set and forget\n\n
  • this is a little tangent, but i quickly want to talk about redis\nit’s a key-value store, all its operations are atomic and O(1) meaning they will always complete in a constant amount of time\nthis means speed and its really important when you want to set and forget\n\n
  • they use it for a whole host of things\n
  • they use it for a whole host of things\n
  • they use it for a whole host of things\n
  • they use it for a whole host of things\n
  • they use it for a whole host of things\n
  • they use it for a whole host of things\n
  • around 2009 when they released this library they had already processed over 10 million jobs\nwow … right\n
  • around 2009 when they released this library they had already processed over 10 million jobs\nwow … right\n
  • so, how does it do what it does ?\nas a user of the resque library in your app you essentially interact with redis\nwhen you ask resque to queue up a job, it will push it onto the queue in redis\na resque worker comes along at some point in time and pops a job of the queue and forks that into its own process and runs the job\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • but it can also have a setUp and tearDown method if there are pre and post actions you wish to do or conditions you wish to check etc\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Php resque

    1. 1. php-resque
    2. 2. php-resqueauthor: @surifchris
    3. 3. php-resque author: @surifchrisspeaker: @chaitanyakuber
    4. 4. introduction
    5. 5. introduction context
    6. 6. introduction context what & how
    7. 7. introduction context what & how move to php
    8. 8. introduction context what & how move to php @bigcommerce
    9. 9. context
    10. 10. contextit’s about ms
    11. 11. context it’s about mscreate a thumbnail
    12. 12. context it’s about mscreate a thumbnail upload videos
    13. 13. context it’s about mscreate a thumbnail upload videosdownload a tarball
    14. 14. context it’s about mscreate a thumbnail upload videosdownload a tarball send an email
    15. 15. purpose
    16. 16. purpose
    17. 17. where ?
    18. 18. where ?background jobs
    19. 19. where ? background jobsasynchronous processing
    20. 20. how ?
    21. 21. how ?fork :)
    22. 22. how ? fork :)backgroundjob
    23. 23. how ? fork :)backgroundjob delayedjob
    24. 24. how ? fork :)backgroundjob delayedjob beanstalkd
    25. 25. how ? fork :)backgroundjob delayedjob beanstalkd gearman
    26. 26. how ? fork :)backgroundjob delayedjob beanstalkd gearman others ?
    27. 27. resque
    28. 28. resquedeveloped by github
    29. 29. resquedeveloped by github ruby
    30. 30. resque developed by github rubymemory leak resistant
    31. 31. resque developed by github rubymemory leak resistant multiple queues
    32. 32. resque developed by github ruby memory leak resistant multiple queuesqueues processed by workers
    33. 33. resque developed by github ruby memory leak resistant multiple queuesqueues processed by workers distributed processing
    34. 34. resque https://github.com/defunkt/resque developed by github ruby memory leak resistant multiple queuesqueues processed by workers distributed processing
    35. 35. resque
    36. 36. resquepriorities
    37. 37. resque prioritiesstored in redis
    38. 38. resque priorities stored in redispersistent queues
    39. 39. resque priorities stored in redispersistent queues web interface
    40. 40. resque priorities stored in redispersistent queues web interface plugins
    41. 41. redis
    42. 42. rediskey value store
    43. 43. redis key value storeatomic operations
    44. 44. redis key value storeatomic operations O(1)
    45. 45. redis key value store atomic operations O(1)strings, hashes, lists
    46. 46. redis key value store atomic operations O(1)strings, hashes, listssets and sorted sets
    47. 47. redishttp://redis.io/topics/introduction key value store atomic operations O(1) strings, hashes, lists sets and sorted sets
    48. 48. resque @ github
    49. 49. resque @ github warming a cache
    50. 50. resque @ github warming a cache counting disk usage
    51. 51. resque @ github warming a cache counting disk usage building tarballs, rubygems
    52. 52. resque @ github warming a cache counting disk usage building tarballs, rubygems firing off web hooks
    53. 53. resque @ github warming a cache counting disk usage building tarballs, rubygems firing off web hooks building graphs
    54. 54. resque @ github warming a cache counting disk usage building tarballs, rubygems firing off web hooks building graphs deleting users
    55. 55. does it scale ?
    56. 56. does it scale ?> 10 million jobs
    57. 57. does it scale ?> 10 million jobs November 3, 2009
    58. 58. what’s resque?
    59. 59. what’s resque?
    60. 60. php-resque
    61. 61. php-resque interface parity
    62. 62. php-resque interface parity queues
    63. 63. php-resque interface parity queues workers
    64. 64. php-resque interface parity queues workers persistence
    65. 65. php-resque interface parity queues workers persistence resilience
    66. 66. php-resque interface parity queues workers persistence resiliencephp @ bigcommerce
    67. 67. php-resquehttps://github.com/chrisboulton/php-resque/ interface parity queues workers persistence resilience php @ bigcommerce
    68. 68. php-resque
    69. 69. php-resque in addition
    70. 70. php-resque in additionsetUp and tearDown
    71. 71. php-resque in additionsetUp and tearDownmarks jobs as failed
    72. 72. php-resque in addition setUp and tearDown marks jobs as failedability to track job status
    73. 73. how ?
    74. 74. how ?jobs are queued as follows
    75. 75. how ? jobs are queued as followsrequire_once lib/Resque.php; // Required if redis is located elsewhere Resque::setBackend(localhost:6379); $args = array( name => Chris ); Resque::enqueue(default, My_Job, $args);
    76. 76. job class
    77. 77. job classclass My_Job { public function setUp() { // ... Set up environment for this job } public function perform() { // .. Run job } public function tearDown() { // ... Remove environment for this job } }
    78. 78. house keeping
    79. 79. house keeping part of your app
    80. 80. house keeping part of your appresque loads app into memory
    81. 81. house keeping part of your appresque loads app into memory instantiates the job class
    82. 82. house keeping part of your appresque loads app into memory instantiates the job class runs it
    83. 83. @bigcommerce
    84. 84. @bigcommerce email
    85. 85. @bigcommerce email uploads/downloads
    86. 86. @bigcommerce email uploads/downloads statsd
    87. 87. @bigcommerce email uploads/downloads statsd totango
    88. 88. @bigcommerce email uploads/downloads statsd totango monitoring
    89. 89. @bigcommerce email uploads/downloads statsd totango monitoring ….
    90. 90. thanks for listening
    91. 91. Questions?

    ×