ID: 48403 User updated by: gregor at hostgis dot com Reported By: gregor at hostgis dot com -Status: Feedback +Status: Open Bug Type: Performance problem Operating System: Linux PHP Version: 5.2.9 New Comment:
> Perhaps you can provide me the same image to test with The file is available for a short time at this URL: http://www.cartograph.com/images.tmp/2043.tif.gz It's a 3 GB TIFF, but gzipped for faster download. > Apart from different file, I did exactly same as you. I find the result of 0.04 seconds fishy, though. I assume that you have GDAL installed when you run the test? > You didn't specify whether you run that test under > some webserver or using PHP CLI? Here's where we get into how I narrowed it down to being something about PHP and Apache. run from shell - 14 seconds PHP on CLI - 14 seconds PHP as Apache DSO - 84 seconds Perl CGI - 14 seconds I would have to set up a dedicated test server in order to test other scenarios, such as disabling Zend Optimizer or running PHP as CGI. On our production server, those are not an option. Note that the 14/84 test is for a shp2img using this same TIFF and a mapfile -- the gdal_translate was <1 second to 4 seconds. I will be glad to provide those as needed, if the gdal_translate test fails to replicate our results on your environment. Previous Comments: ------------------------------------------------------------------------ [2009-05-27 18:49:35] [email protected] Perhaps you can provide me the same image to test with, I tried with some file I had available. Apart from different file, I did exactly same as you. You didn't specify whether you run that test under some webserver or using PHP CLI? ------------------------------------------------------------------------ [2009-05-27 18:43:37] gregor at hostgis dot com Hi, Jani. Thanks for looking into this so quickly. I will reciprocate by staying on top of this with equal eagerness; we have paying customers who would be very keen to see this fixed. I doubt that my problem is using only 1 decimal place, as the difference between 14 seconds and 84 seconds is not a subtle one. ;) I find your result surprising, 0.04 seconds -- do you in fact have GDAL installed and are you manipulating a TIFF? The slowdown is with a task that takes some time; something like "ls" is trivial. I would be glad to provide instructions on the installation of GDAL, as well as our test data and some other commands exhibiting this effect. I may be able to provide a server and root access as well. ------------------------------------------------------------------------ [2009-05-27 10:26:34] [email protected] Works fine for me. You should really use 2 decimals for the time. I got 0.044s without PHP, 0.04s with PHP.. ------------------------------------------------------------------------ [2009-05-27 07:37:57] gregor at hostgis dot com Description: ------------ Commands executed via shell_exec() take a lot longer to run than when run directly from the Unix shell. In the example code below, a task that takes 0.5-0.7 seconds takes 5 seconds. This effect is reliable, and a given task's "how much longer it takes than it should" ratio seems constant. In the simple case below, it takes 8-10 times longer than it should. For a specific more complex test case at our side, the task consistently takes 14 seconds from shell and 83 seconds from shell_exec() This effect is apparently identical for the entire family of process-handling functions: passthru, exec, shell_exec, and popen all show the exact same "slowness multipliers" as described above. This report may be similar to http://bugs.php.net/bug.php?id=15746 However, this is for Linux systems and not specific to Windows NT or NETPBM. Reproduce code: --------------- <?php // gdal_translate converts GIS data // in this case, simply copy a GeoTIFF with no transforms $command = 'gdal_translate /tmp/in.tif /tmp/out.tif'; $t0 = microtime(true); exec($command); $t1 = microtime(true); printf("%.1f seconds", $t1 - $t0); ?> Expected result: ---------------- When run from the shell, this takes 0.5 to 0.7 seconds. Actual result: -------------- This takes 5.0-5.5 seconds. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48403&edit=1
