Your SlideShare is downloading. ×
0
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Magento's Imagine eCommerce Conference: Do You Queue?

1,538

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,538
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
15
Comments
0
Likes
1
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
  • We released Zend Server and Zend Server Community Edition in April this year Products written from scratch based on our very extensive experience with Platform technologies Full integrated stack, native installer, ZF and Studio integration, software updates, all new UI, … Both editions have been very well received by users (love performance boost, ease of use, deployment) Great fit to our partners – we’re working with Varien/Magento, KnowledgeTree, MCS, … Next step will round up web app server offering to support high availability and scalability – more on this in the next few months
  • Transcript

    • 1. Do you queue? Characteristics of scalability<br />Kevin Schroeder<br />Technology Evangelist<br />Zend Technologies<br />
    • 2. About me<br /> Past: Programming/Sys Admin<br /> Current: Technology Evangelist/Author/Composer<br /> @kpschrade<br />
    • 3. I blog at eschrade.com<br />Follow us!<br />(good things will happen to you)<br />Zend Technologies<br />http://twitter.com/zend<br />http://twitter.com/kpschrade (me!)<br />
    • 4. Twtpoll results<br />Could your PHP apps benefit from being able to process data or execute asynchronously?<br />
    • 5. Why would you want to queue?<br />Performance<br />Execute logic apart from the main request (asynchronicity)<br />Scalability<br />The ability to handle non-immediate logic as resources are available<br />
    • 6. Typical anatomy of a PHP Application<br />Bad for scala-bility!<br />Presentation<br />Application Control<br />Database Access<br />Business Logic<br />Presentation<br />Application Control<br />Business Logic<br />Presentation<br />| 6<br />
    • 7. Good for Scalability<br />Presentation<br />Something.phtml<br />Something.phtml<br />Something.phtml<br />Something.phtml<br />Something.phtml<br />Something.phtml<br />Something.phtml<br />Something.phtml<br />Application Control<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Business Logic<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Database Access<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />Something.php<br />| 7<br /> | 2-Mar-11<br />
    • 8. What helps make software scalable?<br />Defined tasks<br />Loose coupling<br />Resource discovery<br />
    • 9. The Golden Rule of Scalability<br />“It can probably wait”<br />
    • 10. Asynchronous execution uses<br />Pre-caching data<br />Data analysis<br />Data processing<br />Pre-calculating (preparing data for the next request)<br />Data is “out of date” once it leaves the web server<br />Immediacy is seldom necessary<br />
    • 11. Considerations<br />Waste disk space<br />Control usage (don’t let users do anything they want)<br />Pre-calculate as much as possible<br />Calculate and cache/store<br />Keep data processing off the front end servers<br />Don’t just cache<br />Don’t let it substitute for thought<br />Cache hit rates can be meaningless if you have hundreds of cache hits for a request<br />
    • 12. Considerations<br /><ul><li>Build a deployment mechanism with NO hardcoded values like directory or resource locations
    • 13. Make as much as possible configurable/discoverable</li></ul>Decouple/Partition<br />Don’t tie everything (relationships and such) into the database<br />Use queues/messaging<br />Stomp interfaces are really good for PHP – Can also use Java Bridge<br />Zend_Queue has several interfaces<br />Try to use stateless interfaces<br />(polling is more scalable than idle connections)<br />
    • 14. Options<br />Use Cron /w PHP CLI (not the best idea)<br />People mostly use cron simply due to availability<br />It’s an available option, not necessarily the best option.<br />Use Gearman<br />Use home-grown (don’t do this)<br />Use pcntl_fork() (NEVER do this)<br />Use Zend Server Job Queue<br />
    • 15. Your only real options<br />Very cloud friendly<br />* I am not an expert on Gearman. Corrections will be taken in the spirit that they are given.<br />For obvious reasons, I will focus on Zend Server<br />
    • 16. Zend Framework<br />Zend Server<br />PHP<br />Application<br />Performance<br />Reliability &<br />Management<br />Scale-Out<br />Business-grade<br />PHP<br />Acceleration<br />Monitoring<br />Clustering<br />Hot Fixes<br />Optimization<br />Root-Cause<br />Job Queue<br />Support<br />Caching<br />Downloads<br />Java Bridge<br />Configuration<br />Linux<br />(rpm/web repositories)<br />IBM i<br />(PTF)<br />Windows<br />(MSI)<br /> What the heck is Zend Server?<br />15<br />Zend Server<br />
    • 17. Job Queue Architecture – Elastic Backend<br />Web Server /w JQ<br />Web Server<br />Users!<br />Web Server /w JQ<br />Web Server<br />Load Balancer<br />Web Server /w JQ<br />Web Server<br />Pros<br />Scale the backend as necessary<br />Default (easy) mechanism<br />Cons<br />Getting the job status requires using a DB<br />
    • 18. Job Queue Architecture – Elastic Frontend<br />Web Server<br />Web Server /w JQ<br />Users!<br />Web Server<br />Web Server /w JQ<br />Load Balancer<br />Web Server<br />Web Server /w JQ<br />Pros<br />Easy to communicate with the Job Queue server handling the job<br />Cons<br />Requires you to build your own interface (or just use mine!)<br />
    • 19. Kevin’s favorite way to implement it<br />Create a task-handling controller<br />Create an abstract task class<br />Understands the Job Queue<br />Self contained<br />If Elastic Backend: connects to localhost<br />If Elastic Frontend: connects to load balancer (my preferred), load balanced JQ servers manage themselves<br />Execute the task, have it serialize itself and send it to send to the task handler<br />
    • 20. Classes involved in the demo<br />Manager<br />Handles connecting to the queue and passing results back and forth<br />JobAbstract<br />Abstract class that a job would be based off of<br />Response<br />The response from the manager when a job is queued. Contains the server name and job number<br />GetRemoteLinks<br />Scans a given web page and reports back a list of all the links on the page<br />
    • 21. Execution Flow<br />Create job and set data<br />Execute job<br />Job passes itself to the queue manager<br />Manager serializes job<br />Manager uses HTTP call through a load balancer to queue the job<br />The queue on the other end returns the job id and server name<br />Job ID and server name is passed to the client<br />Client polls the manager to get a completed job<br />When the job is returned pass the serialized version of the executed job<br />
    • 22. Demo<br />
    • 23. Neato, but how in the world does this pertain to Magento?<br />
    • 24. How?<br />Long running front-end requests kill front-end responsiveness which kills the user experience<br />40% will wait no more than 4 seconds for a website (Forrester)<br />Calculating cache data on-the-fly can lead to bad user experiences (abruptly slow page load times) and consistency problems<br />Long running page requests can push up against max_execution_time<br />For example, handling payments from a slow CC API<br />Simply setting it to run longer is a band-aid on a broken bone<br />
    • 25. Solution?<br />Build Zend Server integration extensions<br />Zendserver_Jobqueue<br />Zendserver_Monitor<br />Utilize the event system to intercept actions<br />Async_Payment (for payments, in this case)<br />Profit! (scalability AND performance, actually)<br />
    • 26. Building a job<br />Install the Zend Server Magento extension<br />Create a class that extends Zendserver_Jobqueue_JobAbstract<br />Call $job->execute();<br />
    • 27. Payment as an example<br />Hooks an observer into controller_action_predispatch_checkout_onepage_saveOrder, core_block_abstract_to_html_after<br />Checks if a defined template is being rendered<br />Injects JavaScript that changes the review.save() method<br />Injects a new URL for submitting the transaction which creates a job<br />Passes POSTed data to a job<br />Job executes by submitting the payment URL on behalf of the browser, storing the result<br />Browser pings the server to see if the job has completed executing yet<br />
    • 28. Scaling the solution<br />Webserver<br />Job Queue/ Webserver<br />Webserver<br />Load Balancer<br />Job Queue/ Webserver<br />Webserver<br />Job Queue/ Webserver<br />* Duplicate deployments on ALL machines<br />Database or Session Clustering<br />
    • 29. Downloads<br />Zend Server<br />http://www.zend.com/server<br />Zendserver_Jobqueue<br />https://github.com/kschroeder/Magento-ZendServer-JobQueue<br />Zendserver_Monitor<br />https://github.com/kschroeder/Magento-ZendServer-Monitor<br />Async_Payment<br />https://github.com/kschroeder/Magento-Async-Payment<br />Job Queue library & demo<br />https://github.com/kschroeder/ZendServer-JobQueue-Job-API<br />http://bit.ly/hWJBYw<br />
    • 30. Magento/Zend Case Study - http://bit.ly/horpFF<br />Follow us!<br />Zend Technologies<br />http://twitter.com/zend<br />http://twitter.com/kpschrade (me!)<br />
    • 31. Get this information and all the examples at eschrade.com…<br />

    ×