Using Queues and Offline Processing
We're all familiar with the standard request cycle - a web request comes in, our scripts do something, and a response is returned. This happens whether we're talking about standard websites, or APIs or even CLI applications. There are many things that may need to happen in response to a request - charging a credit card, sending an email or text message, building a report and others need to happen, but they don't need to happen in order to give back a response to the user. By utilizing queues and making part of your site do its processing in an asynchronous or ""offline"" way, you can greatly increase the perceived speed of your site and allow for more easy scaling of aspects of your site or application that may be processing intensive without worrying about negatively affecting your site's users.
David Stockton (@dstockto)
David Stockton has been writing PHP code professionally since 1998. He is Vice President of Technology at i3logix in Denver, CO. He is very passionate about source control, TDD, APIs and PHP development. He is married and has two daughters who he is teaching to program and build circuits with Arduino and a five-year-old son who has a Master's degree in annoying his sisters, and has been seen studying calculus and recursive algorithms. He created zendtutorials.com and tddftw.com.