Performance Improvement on Calling C++ executable from PHP

From: Date: Sun, 19 Dec 2010 20:35:31 +0000
Subject: Performance Improvement on Calling C++ executable from PHP
Groups: php.general 
Request: Send a blank email to php-general+get-310151@lists.php.net to get a copy of this message
=============================================================================== Recently I my this php-general doesn't accept my mail for some reason. So I send it again from anther email =============================================================================== Hello Everybody, I am developing a php application that interfaces with an external executable binary. The program is written in C++. I open the program (say a.out) using proc_open. Write some command at its stdin and fetch data stdout. Then close the program. The timing of only "a.out" is real 490ms usr 160ms sys 290ms When I invoke it using proc_open in php-cli, the timing becomes real 530ms usr 50ms sys 450ms Look closely, the cpu time and the real elapsed time increases. I run the php version from command line. As an apache handler this will surly take more time. My question is, how can I improve invoking this a.out? Is there any best practice? The command is something like $ ./a.out --option value --option value < script.txt The program a.out can not be converted in php unless I write an extension. But this will need a lot of effort to write it in PHP. Some of my ideas are, 1. Create a standalone multi-threaded server that calls a.out and php calls that server. 2. Call a.out as a CGI and convert it that way. Any ideas? -- Shiplu Mokadd.im

« previous php.general (#310151) next »