PHP Internals News: Episode 77: fsync: Buffers All The Way Down – Derick Rethans

PHP Internals News: Episode 77: fsync: Buffers All The Way Down

In this episode of “PHP Internals News” I chat with David Gebler (GitHub) about his suggestion to add the fsync() function to PHP, as well as file and output buffers.

The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode’s MP3 file, and it’s available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news

Transcript

Derick Rethans 0:13

Hi, I’m Derick. Welcome to PHP internals news, a podcast dedicated to explaining the latest developments in the PHP language. This is Episode 77. In this episode I’m talking with David Gebler about an RFC that he’s written to add a new function to PHP called fsync. David, would you please introduce yourself?

David Gebler 0:35

Hi, I’m David. I’ve worked with PHP professionally among other languages as a developer of websites and back end services. I’ve been doing that for about 15 years now. I’m a new contributor to PHP core, fsync is my first RFC.

Derick Rethans 0:48

What is the reason why you want to introduce fsync into the PHP language?

David Gebler 0:52

It’s an interesting question. I suppose in one sense, I’ve always felt that the absence of fsync and some interface to fsync is provided by most other high level languages, has always been something of an oversight in PHP. But the other reason was that it was an exercise for me in familiarizing myself with PHP’s core getting to learn the source code, and it’s a very small contribution, but it’s one that I feel is potentially useful, and it was easy for me to do as a learning exercise.

Derick Rethans 1:16

How did you find learning about PHP’s internals?

David Gebler 1:19

Quite the roller coaster. The PHP internals are very arcane I suppose I would say, it’s it’s something that’s not particularly well documented. It’s quite an interesting challenge to get into it. I think a lot of it you have to pick up from digging through the source code, looking at what’s already been done, putting together the pieces, but there is a really great community on the internals list, and indeed elsewhere online, and I found a lot of people very helpful in answering questions and again giving feedback when I first opened my initial proof of concept PR

Derick Rethans 1:48

Did you manage to find room 11 on Stack Overflow chat as well?

David Gebler 1:52

I did not, no.

Derick Rethans 1:53

I’ll make sure to add a link in the show notes and it’s where many of the PHP core contributors hang out quite a bit.

David Gebler 2:00

Sounds good to know for the future.

Derick Rethans 2:02

I read the RFC earlier today. And it talks about fsync, but it also talks about flush, or f-flush. What is the difference between them and what does fsync actually do?

David Gebler 2:14

That’s the question that will be on everyone’s lips when they hear about this feature being introduced into the language, hopefully. What does fsync do and what does fflush do? To understand that we have to understand the concept of the different types of buffering, an application runs on a system. So we have the application or sometimes called the user space buffer, and we have the operating system kernel space buffer,

Derick Rethans 2:36

And we’re talking a

Truncated by Planet PHP, read more at the original (another 22440 bytes)