php[architect] logo

Want to check out an issue? Sign up to receive a special offer.

Editor Bytes – Parallel Running

Editor-in-chief Oscar Merida looks into the October 2020 issue, Parallel Running.

Listen

Transcript

While we think of our scripts running for one request at a time, PHP web applications handle multiple, simultaneous requests at a time. In this issue, we look at asynchronous programming using Swoole, handling serverless file uploads, implementing security headers, dealing with race conditions, and more.

Serial execution fits readily into our mental models for how things operate. I suspect because most of us learned how computers work using an imperative approach, where each line of code executes one after another. I know it took me no small effort to grok event-driven programming, especially how to debug code dealing with nested callbacks. PHP programs usually leverage message queues and workers to scale, as it complements our architectures nicely. However, if you need to scale up significantly, and without incurring the costs associated with simply getting more raw computing power, you need another approach. Swoole provides an asynchronous programming API built for speed since it’s implemented as a PHP extension. I need to make time to investigate further how it works; the possibilities are intriguing.

To get us started, Demin Yin shows how to Build An All-In-One Application Server Using Swoole. He covers how you can implement cron scripts, job queues, and custom servers using its API. It’s a worthy option if you want to keep as much of your architecture in PHP. In More Than Asynchronous I/O, Introduction To Swoole PHP, Bruce Duo writes about using coroutines with Swoole and points out what to consider when dealing with concurrency and variable scope. Practically every web site deals with file uploads. Volodymyr Khvorostiankin has a new take that leverages Serverless File Uploading to move files to cloud storage without needing a server running 24×7 to process uploads.

In PHP Puzzles: Improved Directions, Sherri Wheeler shares her solutions for cleaning up extraneous directions from a list. She’s also looking for more participation and feedback, so try your hand at a puzzle and let her know how you did. In Education Station, Chris Tankersley examines Race Conditions and Dead Locks. Both of these can be tricky to identify and debug. Read up to be prepared when you encounter one. In Security Corner: Configurable Security, Eric Mann follow up on last month’s article and shows how you can configure your application to improve your Mozilla Observatory score. In The Workshop: PHP Development with Homestead in WSL, Joe Ferguson continues putting Windows 10 through its paces. If you’re thinking of making it your development environment, see how you can use Homestead to get up and running quicker. Eric Van Johnson interviews Zuzana Kunckova, the founder of Larabelles in Community Corner. She’s started a community to support women Laravel developers. In Sustainable PHP: Refactor to Competitive Advantage, Edward Barnard explains how to be prepared for change and the changing roles of your code and its tests when you’re refactoring one or the other. finally{}, Beth Tucker Long returns to the magazine and is taking over the column from Eli White. In Async Life, she reminds us that while computing advances have opened up new ways for us to work where and when we want, it’s critical that we establish boundaries to manage the separation between work and other responsibilities.

Take the OSMI Mental Health in Tech Survey for 2020. Visit http://phpa.me/osmi-survey-2020 to add your responses.

Air date October 8, 2020
Hosted by Oscar Merida
Guest(s)

Leave a comment

Use the form below to leave a comment: