Author: Manuel Lemos
Updated on: 2014-02-15
Posted on: 2010-11-30
Categories: PHP Performance, Lately in PHP Podcast, PHP community
They also comment on the upcoming release of PHP 5.3.4 expected for mid-December, as well the PHP 5.4 hold off debate that has been going on due mostly to the lack of consensus between core developers.
Download Size: 20MB Listeners: 7221
Introduction music: Harbour by Danilo Ercole, Curitiba, Brazil
RSS 2.0 feed compliant with iTunes:
In iTunes, use the Subscribe to Podcast... item of the Advanced menu, and then enter the URL above to subscribe to this podcast.
- PageSpeed Firefox extension
- PHP GPU Acceleration discussion thread
CUDA - NVIDIA parallel computing architecture using graphic boards' GPUs
- PHP 5.3.4 in mid-December
Accelerate Web pages with mod_PageSpeed (1:00)
XMLHttpRequest Level 2 (8:00)
Hardware Accelerated PHP (14:34)
PHP 5.3.4 in December and PHP 5.4 hold off (21:02)
PHP Programming Award nominees of September 2010 (30:14)
Introduction (0:20)Manuel Lemos: Hello, welcome to the Lately in PHP Podcast. I am Manuel Lemos and as always I have here with me Ernani Joppert. Hello Ernani, how are you doing?
Ernani Joppert: Hello Manuel. It's very hot here but I'm doing great.
Manuel Lemos: By coincidence it's also hot here. Oh, I remember we are both in Brazil. ;-) Well, it's not summer already and we are already suffering a lot with the heat. I suppose in the North hemisphere it's probably as cold as it is hot here, so let's not complain.
Ernani Joppert: Very true.
Accelerate Web pages with mod_PageSpeed (1:00)Manuel Lemos: Well, in this program of this episode of the Lately in PHP Podcast we have several interesting topics to talk about. First I'm going to talk about a subject not specific of PHP but is of the general interest of web developers.
I have published just a few days ago an article about mod_PageSpeed. Basically this is module, an extension for the Apache 2 Web server written by Google that allows to implement some built in acceleration of the pages that are served by Apache, and it can be configured to work automatically.
Basically what this module does is it implements at least a good part of these same optimizations that PageSpeed propose. PageSpeed in this case I mean the Firefox extension for evaluating the performance aspects by which Web pages are being served and point some aspects that could be optimized in order to make the page being served faster and eventually provide a better user experience to whoever accesses the site.
And mod_PageSpeed implements several of these suggested optimizations automatically. This means that instead of the developers having to reconfigure their scripts that generate the pages in order to serve them in a more optimized way, Google mod_PageSpeed module for Apache 2 does it automatically for you, and personally I think that is great.
I have written an article about it and it is very good for those people that do not have the time or maybe the skills to actually implement the suggested optimizations, and it would save a lot of time and effort to actually implement those optimizations. Ernani, are you familiar with this module?
Ernani Joppert: Yes, I've heard it on news groups, on our Google Technology User Group, and also I read your article and I've been digging into that as well, and it seems a very powerful solution bundled with other techniques that were already available like gzip for compression and it does also some cache handling, better cache handling, and other techniques.
Manuel Lemos: Yes, well, it basically tries to do its best implementing those optimizations, those same that are suggested by PageSpeed Firefox extension, but there are some that it is not able to implement in practice because it depends a lot on the context of the pages, but overall it is a very good solution to help those that want to implement those optimizations but probably don't have the time or the skills to do it.
For me the only concern that I have towards using this kind of extension is basically the fact that in spite this is considered a stable release obviously it has bugs. And those bugs will add up to the eventual bugs that you have already in your site.
So if you encounter a problem in your site using this kind of automatic optimization extension will add an additional level of complexity in your effort to try to determine what is causing the eventual bugs that you have in your site.
And ideally you would actually implement those optimizations by tweaking your code or web server configuration, but since that may be quite a difficult process I think that developers will benefit a lot from implementing this extension, and the main thing I have to recommend is that they test their sites a lot before putting this extension in production servers.
But other than that I think it's a great idea from Google. Google keeps coming with more and more interesting ideas to optimize the Web in general. They are not just trying to optimize the services that they provide but they are also helping developers of other servers to make their sites better by eventually making them faster, and I think that is very good initiative, yet another great initiative from Google.
XMLHttpRequest Level 2 (8:00)Manuel Lemos: And another topic of interest, also not exactly about PHP, is related with an article that I wrote just a few days ago about XMLHttpRequest.
And there is this new article that was published in the JSClasses.org blog, I will publish obviously a link in the show notes of this podcast so you can read about it, but basically in that article I talk about what are the most important enhancements that the new specification provides to overcome limitations of the prior revision, as I mentioned, and implement things that the developers have been wanting to implement in their AJAX applications.
In the prior specification that is not possible but in this specification that is one of the things that is made possible also thanks to another specification.
Ernani Joppert: Is this similar to what Flash does? Does it require some sandbox security?
Manuel Lemos: Well, I'm not sure what Flash does, you probably are more familiar with it. I can give you just a brief idea so we don't take too much time on this topic. Basically now you are able to specify... for instance your page may be served with special headers that describe which domains you are allowed to send XMLHttpRequests besides the current browser domain. Is it similar to what Flash allows?
Ernani Joppert: Flash has a different way. You have to specify an XML file, a cross domain .xml file, and it has some specific entries but most users as well specify an asterisk so it's pretty much a security flaw if you don't look at it.
Manuel Lemos: Right. Well, in this case in the XHR specification Level 2 it uses another specification that defines specific headers that you may look up later when you are reading the other article, and it just defines not just domains but other restrictions, what you can do or not do with this object.
Well, for those interested to learn more about this topic they can read the article.
Hardware Accelerated PHP (14:34)Manuel Lemos: But now we are going to move on with a more directly related subject to PHP. I would like to start to comment with a topic that was briefly discussed in the PHP Internals list from somebody that proposed using the GPU, which is the processor in the graphics board that you may have in your computer, to actually accelerate PHP code.
And all this comes because some other languages support that possibility. There are some libraries that are linked with extensions of other languages that allow you to interface with the CUDA library of NVIDIA. So if you have an NVIDIA card, video card, you can take advantage of the GPU or multiple GPUs that a card may have.
And somebody posted a suggestion in the internals list to eventually use that possibility to perform some actions, some features that could be executed faster using GPU. And the discussion in the list was brief because first some people questioned what could be the uses of real PHP applications for this hardware acceleration based on GPU's in a graphics card of NVIDIA, in this case.
And then the whole topic ended basically by somebody asking for some code that would implement any feature that could be taking advantage. Since nobody provided any code the topic practically ended, but I just thought it would be interesting to comment here in this podcast because despite nobody came with a real world application for this I have a few ideas that could probably take advantage of this hardware acceleration.
One would be to accelerate the GD, graphics image manipulation functions, in order to eventually make them faster. And another possibility would be to implement any complicated calculations probably using matrix manipulations to use this eventual hardware acceleration to take advantage of a GPU. Ernani, have you thought of any other possible applications for this supposed hardware acceleration?
And it may be in the case that the server side needs to perform such calculations as well to interface with OpenGL, OpenCL or DirectX or someone may have a 3D application that requires some background processing.
In some areas like gaming development this is really mature, but it's hard to get a slight idea to use this in a server side processing, but if there is a possibility others may have those ideas and eventually come up with a solution based on that.
Manuel Lemos: Well, I had these ideas but then I remembered the fact that PHP runs mostly on servers. We know that PHP can run on desktop applications but that is not obviously the most common use. And thinking about server machines, most of them do not come with accelerated graphics boards, most of them do have graphic boards but they are very basic, they just have on motherboard graphic ships and that's all, it would be hard to find an NVIDIA card on a server on which PHP runs.
Ernani Joppert: Especially in the cloud, right, which they are mostly based on virtual boxes, so it may be even more complicated in that specific portion.
Manuel Lemos: Right. Well, even if you control the whole hardware, if you have a dedicated server it will be hard to actually take advantage of this eventual hardware acceleration.
But, well, I just thought I would mention this topic because it's curious, it's unusual, and we never know maybe somebody thinks about this further and comes up with better ideas that actually make this idea feasible somehow. Well, we'll see, because for now it doesn't seem to be feasible at all.
PHP 5.3.4 in December and PHP 5.4 hold off (21:02)Manuel Lemos: But moving on with our podcast, now I'd just like to comment on just a few topics that also took place on the PHP internals list that refer to basically the latest versions that are being planned for PHP 5.3 and also 5.4.
I read a topic that suggested that around mid-December there will be a release of PHP 5.3.4 that will basically include certain security bug fixes because it has been a while since the last version of PHP 5.3 was released and there are quite a few bug fixes that will be important to release. So the latest estimation for release of PHP 5.3 is to be around mid-December if nothing else happens that delays this release.
Another topic of interest that was discussed regarding future PHP versions this time related with PHP 5.4. There was a big discussion with a title PHP 5.4 hold off which was started by Filipe Pena, he is an active PHP core developer, and he basically raised some concerns regarding several features that are being planned or suggested for the next PHP major release which by now it was decided will be called PHP 5.4 and not PHP 6 as there was a doubt a few months ago between these two numbers.
And I think Filipe raised some interesting concerns, one of which refers to the lack of consensus regarding whether or not the suggested features should be implemented and how. We already mentioned in past episodes of this podcast what will be the features that are being planned.
And basically we know that it's not hard to get a decision that everybody agrees on, and at the same time if nothing is done every time somebody that disagrees, or at least a significant group of people that disagrees, I'm afraid that PHP will not move on. Ernani, do you have any comments regarding this stall of the next PHP major release?
Ernani Joppert: Basically the main thing is too many requests and a few people actually doing the job compared to the amount of requests, and sometimes it gets hard to get prioritized and sometimes it also involves so many changes and so many refactoring it may be complicated.
But I would, in the matter of strict typing and the other way, I would say that strict typing would benefit, I would vote for it because in my personal, and it's my only opinion, I would feel that PHP could benefit very much about this.
Manuel Lemos: Yeah, that's one of the hot topics of disagreement because as we mentioned before some people do not want to have PHP verifying the types of the values that are past two functions because it will cause a major slow down and it will not benefit... it will not be absolutely necessary.
Well, personally in my opinion I think that could be a debugging option. It could for instance turn on the checking of the types just for debugging purposes, but in production servers it could be disabled so it does not cause a major slow down.
But what I see in the discussions there are certain parties that would not like to give in for any middle ground solution that would be part what one side would like and part what the other side would prefer.
Ernani Joppert: Yes. The main thing about strict typing that I foresee is that most of the object oriented languages that are there require strict typing because it would benefit from later on from the reflection side which is automatic type checking and would cause some concerns. And by having a decent exception handling mechanism and you could pretty much design better object oriented API's.
Manuel Lemos: Yeah, it would probably be very helpful to detect bugs that cause programs to pass parameters of the wrong type because there are some that make program scripts pass the wrong values. And personally I am of that opinion, I understand both sides that oppose to have more strict typing, and my suggestion would be to agree on making that a runtime option, something that could be disabled so it could not affect the performance, but we'll see.
Another topic that is being discussed, I know you mentioned it before, is to have some form of annotations. As we've also talked about in last programs, some people prefer a more Java-like type of annotations, others seem to prefer something that extends the current PHPdoc syntax, and others simply are opposed to anything that changes PHP in that area because eventually it will make the PHP parser more complex.
Actually I noticed that some people that complain are actually from Zend, and Zend also develops their Zend Studio program. For Zend accepting this, in my opinion of course, I cannot speak for Zend, but I am trying to see why they would oppose, and in my opinion it seems that it will probably complicate also the parser that they have in Zend Studio to support PHPdoc, not just the parser but also eventually some completion that they implement there.
So, as Filipe Pena mentioned in this PHP 5.4 hold off topic, this will be tough to get a consensus. But we'll see because this discussion should not last forever, it would not be a benefit to anybody in the PHP community to keep discussing this forever, and if they cannot agree on everything at least let's move on with something that can be agreed, if any of the suggested enhancements for PHP 5.4 qualifies for that level of agreement. Well, we'll see.
PHP Programming Award nominees of September 2010 (30:14)Manuel Lemos: But moving on with our podcast now coming towards the end of this episode, as usual we discuss the latest classes that were nominated for the PHP Programming Innovation Award that PHPClasses site carries on since 2004 every month.
And we will be actually discussing the winners of September, they were voted during October and in November, in the beginning of the month they were actually awarded, so the results of the votes from the users were out. Ernani, what are the classes that you thought would be more relevant?
We actually have here 15 nominees, this has been a very busy month, August, it had many great innovative classes, but unfortunately we do not have time to comment on all of them, but let's just comment on a few that we think are worth mentioning. Ernani, what are your favorites for this month?
Ernani Joppert: Yes, basically I will try to be fair here and try to give my vote for the best creative class and the best useful one, but not demeaning both, most likely they are both very creative and very useful. But considering the most useful one I would vote for the DB Populator because...
Manuel Lemos: Oh, the first one.
Ernani Joppert: Yes, the winner, because I faced some situations where I had to generate some mass of data, not specifically using PHP in the project, but using MySQL as a database. So it's very useful for MySQL users all around, not even related with PHP, and they could benefit from using PHP for this functionality.
And I've seen some very, very expensive solutions to do this, and with PHP you can use a very simple way but a very useful way to generate a mass of data that you can pretty much check if your database is behaving as it should.
And the other one would be the First Person View class which pretty much interacts with images, so it can generate some kind of different perspective to browse two images, and it's a very creative one and this is something that I've never seen anywhere else.
Manuel Lemos: Right, it's very, very... I would never have thought PHP could be used in such a way. It's a very simple concept but it's great, as you said, it reveals a lot of imagination from the author, in this case Oscar Dias, and just so our listeners understand what this class does, basically it presents images to users that would be similar to what those games, so called first-person shooters, would show to the user basically a front view then a left view and a right view.
And this class transposes that concept to browsing a site with images, and you can decide to go ahead to see what's inside the image that is in your front, or you can turn right or turn left and see the images that are on your right or on your left, so it would sort of be giving a 3D navigation of a series of images. Then if you move on ahead, you move to a new virtual room where you would see a new set of images, and as you said it is very imaginative from Oscar to present this solution.
And also commenting on the first class that you mentioned, it is eventually useful for testing purposes; if you have an application that manipulates data and database records it will be interesting to test it with some real values.
And what this class does is to populate with some random data but is related with the type of fields that are being used. It looks at the names of the fields, for instance, if you name a field of database tables called for instance email it tries to fill that field with some random email addresses, and so on, for other types of data, integers, floating point values, and so on. And if you are into test driven development approach you will find this class useful.
But now commenting on those that I think that are more interesting, there is this Twitter Auto Publish class that does sort of an hack, a trick, to work around a limitation that Twitter imposed a few months ago. If you wanted to develop a Twitter application at least in the past you were able to pass that application your username and password, and it would eventually use those credentials to publish something on your behalf.
Let's say for instance one application that I use that would take advantage of this approach is TwitterFeed. Basically it takes the latest entries in RSS feed and publishes them as Twitter statuses, and what happened a few months ago is that Twitter disabled the possibility of doing that by disabling the Basic HTTP authentication, and from a certain point they only allowed using OAuth.
This means that applications that relied on having username and password stopped working, they would have to ask the users again to actually authorize them to use a token that is passed through OAuth protocol, and this actually broke many applications.
And what this class does is sort of provide a workaround to actually perform at least part of the Twitter API operations using the username and password, and this class written by Rochak Chauhan, an author that has been publishing many interesting classes, uses some other Twitter interface to actually perform this workaround. I'm not sure for how long it will work but for now it will provide a solution for those that needed to implement some application that just relies on the user and password.
Ernani Joppert: Yeah, and which is... not trying to go into a war here, but it's not nice that Twitter did this without letting the users know in advance so they could modify their code, right, so it's nice to see someone trying to involve this whole approach here.
Manuel Lemos: Yeah, from what I remember, maybe I'm wrong, but I did not see any warning from Twitter, a mean a warning wiith good advance to let applications adapt just to start using OAuth.
Ernani Joppert: Yeah, same with me.
Manuel Lemos: Yeah, for instance, I use Thunderbird, which is a Mozilla mail client, and also supports fetching RSS feeds, and I was using it to fetch the timeline of Tweets from my friends on Twitter. And when Twitter introduced this change it stopped working.
But in the case of Thunderbird they have to add support to OAuth because since it is an application that is not written in PHP could never benefit of this class, they have to use either a similar approach or adapt to use OAuth. So, whoever uses Thunderbird to fetch the private timelines that require authentication they could not use Thunderbird and other Twitter clients could not take advantage of the Twitter API's starting from this change.
Another class that I would also like to mention, actually I would like to mention more but we don't have time, we're already reaching the end of this podcast. And the other class I would like to mention is this 32-bit File Stats by Jamie Curnow of Australia, and this also overcomes a limitation in this case of PHP.
When PHP is running on 32-bit systems that have large file systems on which the files may have sizes that occupy more than 32-bit, PHP does not work there. If you want to list a file that has more than 4GB, I think that is the limit, it will not work at least for reading the actual file because it does not support more than 32-bits.
And what this class provides is a workaround for overcoming this limitation, at least for several types of operations of accessing directories and other operations that access files in large file systems that use more than 32 bits.
And this is an interesting workaround because it addresses a real need that many developers have because they are not yet running on a 64-bit system, and 64-bit operating systems this class actually uses the PHP functions directly. But if you are running 32-bits, an operating system with 32-bits, this class uses external commands or some other solution to provide this workaround.
And I thought it was a clever idea by Jamie, and once again this demonstrates that PHP developers are not less than others, they are pretty much capable of using their creativity to overcome limitations or solve non-trivial problems. And personally this makes me quite happy and pleased to have started this PHP Programming Innovation Award in order to stimulate people, developers, to contribute with great components such as all these that have been nominated. Ernani, what do you think?
Ernani Joppert: Yeah, I couldn't agree more than with you, you pretty much sum up everything.
Conclusion (44:24)Manuel Lemos: Right. Well, with this we have just reached the end of this podcast, and next month we will have more of this.
So for now that's all, bye.
Ernani Joppert: Bye, bye.
You need to be a registered user or login to post a comment
1,543,324 PHP developers registered to the PHP Classes site.
Be One of Us!
Login Immediately with your account on:
1. PHPClasses.org: Lately in PHP Podcast - Episode #7 (2010-12-01 06:41)
PHPClasses.org has posted the latest episode (episode #7) of their “Lately in PHP” podcast. In this new episode they touch on several recent technologies including mode_pagespeed, PHP 5.4 and Ajax 2...