No matter how many virtual machines you throw at a problem you always have the physical limitations of hardware. Memory, CPU, and even your NIC's throughput have finite limits. Are you trying to load that 5 GB csv into memory to process it? No really, you shouldn't!

PHP has many built in features to deal with data in more efficient ways that pumping everything into an array or object. Using PHP stream and stream filtering mechanisms you can work with chunked data in an efficient matter, with sockets and processes you can farm out work efficiently and still keep track of what your application is doing. These features can help with memory, CPU, and other physical system limitations to help you scale without the giant AWS bill.

Comments

Comments are closed.

Eye-opening inside view into streams in PHP. I never knew how useful they were until now thanks Elizabeth!

More practical examples of stream usage would be great!

awesome and very funny, more examples would be fine

Eric Poe at 23:21 on 3 Feb 2017

This was a great reminder of things that I have forgotten. Presentation flow was good. I've hit some of the same errors and growing pains, so I appreciated the humor in which Liz dealt with these. I'm always amazed at the deep core PHP knowledge that she gives away freely. Well done!

Ron Emaus at 07:39 on 4 Feb 2017

There were several meaty topics covered and Elizabeth could have gone into more detail on each one. She sure motivate me to look into streams, lazy fetch, generators and the like to manage memory usage and never assume the size of anything. She alluded to other data structures and recommended not using arrays unless they are small (and you checked they're small. Don't assume so.)

Eric Morris at 11:18 on 4 Feb 2017

This talk was very informative to me. A good engineer is only made better when he/she understands the underpinned and inner workings of the languages and technologies they are working in. For example, I never know that every IO, not just some, in PHP are streams. I also did not know you could write and hook stream filters and such into streams with ease. I suspect, as Ms. Smith stated, that most PHP developers probably don't consider these mechanisms, largely because they don't know about them. Thank you for the very informative talk.

Liviu Ifrim at 17:42 on 4 Feb 2017

I liked, I've found it very helpful, thank you.

Symeon Quimby at 12:14 on 6 Feb 2017

I've used streams from time to time in rare cases. Your talked opened my eyes to all the places I should be using them, but aren't. I loved the bits about the various callbacks we can attach/hook to our streams. Would of loved to see a few concrete examples of this.

James Fuller at 14:29 on 6 Feb 2017

Excellent info about streams! I'm a little less afraid now.

David W. at 13:37 on 7 Feb 2017

Streams. Guess I better jump in! Thanks for showing us where. Good job!