RE: [PATCH] suppressing realpath() with APC + tiny patches

php.internals

BUSTARRET, Jean-Francois

22 years ago
I know the location is not the best one (IMHO, the PEAR default is not much metter). You can't always have the fastest setup, because there are many other factors to consider (security, ease of management, number of servers/apps to handle, ...). My point was to evaluate the impact of the patch. Wherever you put your files, it has a dramatic impact on performance, and I wish it (or any similar patch) was part of the standard PHP distribution. Let's get rid of this useless (when using a cache) realpath call, without having to migrate to PHP5 ! JFB
> -----Message d'origine----- > De : Sterling Hughes [mailto:sterling@php.net] > Envoyé : vendredi 7 mai 2004 00:15 > À : BUSTARRET, Jean-Francois > Cc : internals@lists.php.net > Objet : Re: [PHP-DEV] [PATCH] suppressing realpath() with APC + tiny > patches > > > the first thing you would optimize is your code location - > not your php > installation... > > > On May 6, 2004, at 6:46 PM, BUSTARRET, Jean-Francois wrote: > > > > > > > I just did a quick stress test of the patch. > > > > My config is : Xeon 2GHz/512MB/IDE drive, apache 1/PHP > 4.2.3/APC 2.0.3. > > I did change the patch in order to apply it on PHP 4.2.3. > > > > The test template is : > > <?php > > for ($i = 1; $i <= 20; $i++) { > > include_once("include/include$i.php"); > > echo "-"; > > } > > ?> > > It is located on a NFS server and is 5 directories deep (2 local/3 > > NFS). > > > > The include/include$1.php template only does an echo. > > > > Here are the results : > > > > plain PHP : 296 req/s (TTFB : 260ms) > > + APC : 355 req/s (TTFB : 33ms) > > + delayed write : 766 req/s (TTFB : 21ms) > > > > Looks good ! > > > > I can forward the 4.2.3 patches if someone's interested. > > > > Jean-François Bustarret > > eTF1 - Architecte > > > > ------------------------------------- > > Le present message (y compris tous les elements attaches) est > > confidentiel et est destine a ses seuls destinataires. Si vous > > l'avez recu par erreur, merci de l'indiquer a son expediteur par > > retour et de proceder a sa destruction dans vos systemes. > > Toute utilisation ou diffusion non autorisee de son contenu, en > > totalite ou en partie, est strictement interdite. Les idees et > > opinions presentees dans ce message sont celles de son > auteur, et ne > > representent pas necessairement celles de TF1 (et/ou des > > entites membres du Groupe TF1). > > > > This message (including any attachments) is confidential and may be > > privileged. If you have received it by mistake please notify > > the sender by return email and delete this message from > your system. > > Any unauthorised use or dissemination of this message in > > whole or in part is strictly prohibited. Any views or opinions > > presented are solely those of its author and do not necessarily > > represent those of TF1 (and/or its group companies). > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > >
------------------------------------- Le present message (y compris tous les elements attaches) est confidentiel et est destine a ses seuls destinataires. Si vous l'avez recu par erreur, merci de l'indiquer a son expediteur par retour et de proceder a sa destruction dans vos systemes. Toute utilisation ou diffusion non autorisee de son contenu, en totalite ou en partie, est strictement interdite. Les idees et opinions presentees dans ce message sont celles de son auteur, et ne representent pas necessairement celles de TF1 (et/ou des entites membres du Groupe TF1). This message (including any attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return email and delete this message from your system. Any unauthorised use or dissemination of this message in whole or in part is strictly prohibited. Any views or opinions presented are solely those of its author and do not necessarily represent those of TF1 (and/or its group companies).

Rasmus Lerdorf

22 years ago
On Fri, 7 May 2004, BUSTARRET, Jean-Francois wrote:
> Let's get rid of this useless (when using a cache) realpath call, without having to migrate to PHP5 !
Well, the realpath call's usefulness doesn't have anything to do with the cache. It is there to provide a canonicalized absolute pathname to be stored in the included_files list and on every include another realpath is done to check against this list. This means that if the same file is included via different paths, the include_once/require_once will still catch that fact. Now, I do agree with you that the cost for this convenience is way too high which is why I turn this off for my use and tell people they get what they deserve if they include the same file via different paths. Of course, turning this off also messes up any open_basedir checks as it becomes trivial to work around an open_basedir restriction with a symlink or some creative path walking. I did try your patch and it crashed my build. Granted, my tree is quite hacked up and doesn't ever call realpath, but still. Haven't had time to track down exactly why it caused problems. -Rasmus

Masaki Fujimoto

22 years ago
Hello, All of your point is acceptable for me, too. Of cource I do not think APC has something to do with realpath calls, and as I wrote in another mail, APC is just a way to make skipping realpath() calls more easy (to be exact, it's the way to suppress realpath() only once for each script through all the process. So this patch can identify the same script in different path). I tried some other ways to skip realpath (like realpath caching), and then concluded that my previous patch was the simplest, smallest, and most effective one. Anyway, I think Andi's realpath cache which mentioned in another mail will be the great help of most of people, and I'm happy if it'll be committed in php-src (of course I'm happier if I can commit my patch, too:), but if you want to enhance your PHP more (especially in PHP 4, which will not have realpath cache), and if you could arbitrarily build your PHP, I believe my patch should be the great help, too. Finally, an attacehd patch will prevent your crash, but if you already turned all the realpath calls off, my patch will not affect any performance... Masaki Fujimoto The Message From Rasmus Lerdorf: