Slide 1

Slide 1 text

© All rights reserved. Zend Technologies, Inc. Do you queue? An introduction to the Zend Server Job Queue Slavey Karadzhov Senior Consultant Zend Technologies Credits: Eric Ritchie, Kevin Schroeder

Slide 2

Slide 2 text

© All rights reserved. Zend Technologies, Inc. About me • Senior Technical Consultant and Trainer at Zend Technologies • Zend Framework and PHP 5.3 ZCE • Many years of PHP (v3,4 & 5), ZF 1 and galaxy of programming languages (Python, Perl, Java, JavaScript,…). • Hobbies: Travelling, sampling exotic dishes, outdoor sports, testing hype technologies. (in no particular order) 2

Slide 3

Slide 3 text

© All rights reserved. Zend Technologies, Inc. Agenda • Asynchronous operations in PHP • Performance and Scalability • Zend Server Job Queue • Benchmarks • Use Cases • Implementation with Zend Server Job Queue • Questions & Answers 3

Slide 4

Slide 4 text

© All rights reserved. Zend Technologies, Inc. Asynchronous operations in PHP Meaning and implications

Slide 5

Slide 5 text

© All rights reserved. Zend Technologies, Inc. Asynchronous operations in PHP • PHP is a sequential language  Step by step execution (synchronous)  Time consuming tasks delay the complete execution  Pro: Simplicity  Con: Performance and scalability issues 5

Slide 6

Slide 6 text

© All rights reserved. Zend Technologies, Inc. Asynchronous operations in PHP Could your PHP apps benefit from being able to process data or execute asynchronously? 6

Slide 7

Slide 7 text

© All rights reserved. Zend Technologies, Inc. Asynchronous operations in PHP • Why would you want to use them?  Performance • Execute logic apart from the main request  Scalability • The ability to handle non-immediate logic as resources are available 7

Slide 8

Slide 8 text

© All rights reserved. Zend Technologies, Inc. Performance & Scalability

Slide 9

Slide 9 text

© All rights reserved. Zend Technologies, Inc. Performance & Scalability • Performance is the speed by which a request is executed • Scalability is the ability of that request to maintain its performance as load/infrastructure increases Scalability can be improved by better performance but they are not the same 9

Slide 10

Slide 10 text

© All rights reserved. Zend Technologies, Inc. Performance & Scalability • Improving the performance can mean  Make the PHP run faster  Make the PHP use less resources (hardware, network bandwidth ) • Improving the scalability can mean  Be able to handle more users  Be able to handle more data  Be able to handle more operations 10

Slide 11

Slide 11 text

© All rights reserved. Zend Technologies, Inc. Performance & Scalability • What helps make software scalable?  Defined tasks  Loose coupling  Resource discovery 11

Slide 12

Slide 12 text

© All rights reserved. Zend Technologies, Inc. Zend Server Job Queue

Slide 13

Slide 13 text

© All rights reserved. Zend Technologies, Inc. Zend Server Job Queue 13

Slide 14

Slide 14 text

© All rights reserved. Zend Technologies, Inc. Zend Server Job Queue • Facilitates the PHP developers in executing asynchronous tasks • Benefits  Reduce application bottlenecks  Improve the end-user experience  Intelligently distribute load across multiple servers  Appropriately schedule non-time-sensitive tasks 14

Slide 15

Slide 15 text

© All rights reserved. Zend Technologies, Inc. Zend Server Job Queue • Perfect integration with  Management  Monitoring 15

Slide 16

Slide 16 text

© All rights reserved. Zend Technologies, Inc. Demonstration >>

Slide 17

Slide 17 text

© All rights reserved. Zend Technologies, Inc. Zend Server Job Queue 17

Slide 18

Slide 18 text

© All rights reserved. Zend Technologies, Inc. Zend Server Job Queue • Put certain tasks into a separate execution queue  Off-load to new process (or defer to a later time)  Off-load to a different server • Schedule jobs in the future  Distribute processing load to off-hours • Set recurring jobs • Execute immediately, as resources are available • Utilize ZendJobQueue() 18

Slide 19

Slide 19 text

© All rights reserved. Zend Technologies, Inc. Zend Server Job Queue • Jobs are created using the createHttpJob() method • Pass parameters  Simple ones, via query string $_GET  Complex ones, as an associative array of key => value pairs • Set job options  Name, priority, schedule, etc.  Create deferred or recurring jobs • •Or… create from the UI 19

Slide 20

Slide 20 text

© All rights reserved. Zend Technologies, Inc. Benchmarks Why using Zend Job Queue matters?

Slide 21

Slide 21 text

© All rights reserved. Zend Technologies, Inc. Benchmarks • Sending Emails 22

Slide 22

Slide 22 text

© All rights reserved. Zend Technologies, Inc. Benchmarks • Image conversion using ImageMagick 23

Slide 23

Slide 23 text

© All rights reserved. Zend Technologies, Inc. Use Cases In which situations you can get the most of out of Zend Server Job Queue

Slide 24

Slide 24 text

© All rights reserved. Zend Technologies, Inc. Use Cases • Pre-caching data • Data analysis • Data processing • Pre-calculating (preparing data for the next request) Data is “out of date” once it leaves the web server Immediacy is seldom necessary 25

Slide 25

Slide 25 text

© All rights reserved. Zend Technologies, Inc. Implementation with Zend Server Job Queue The time for coding comes …

Slide 26

Slide 26 text

© All rights reserved. Zend Technologies, Inc. Implementation with Zend Server Job Queue • Execute single job • Execute recurring job • Execute job on all Zend Server clustered nodes 27

Slide 27

Slide 27 text

© All rights reserved. Zend Technologies, Inc. Thanks you! And now time for questions. Or write me at [email protected]

Slide 28

Slide 28 text

© All rights reserved. Zend Technologies, Inc. Follow us!  http://www.facebook.com/ZendTechnologies  http://twitter.com/zend