Re: PHP script is running very slowly when using Apache PHP module

2011-10-20 Thread MATSUMOTO Ryosuke
Hi Fiona,

example

strace -f /etc/init.d/httpd restart

2011/10/20 Vincenzo D'Amore :
> Hello Fiona,
>
> have you tried to strace apache process ?
>
> Take a look at this:
>
> http://httpd.apache.org/dev/debugging.html
>
>
> On Mon, Oct 17, 2011 at 6:49 PM, Fiona Sisk wrote:
>
>> Hi,
>>
>> I have a problem with the Apache PHP module and am hoping for some pointers
>> on how to investigate it.
>>
>> I have written a PHP extension that is called by a PHP script.
>> I use PHP as a module of  Apache ( 1.3.37 or 2.2.19, I've tried both).
>> *
>> LoadModule php5_module        libexec/apache/libphp5.so*
>>
>> I'm getting very slow response times from my PHP script. (approx 1 minute)
>>
>> However it is only when I run it as an Apache module that the problem
>> manifests itself.
>> If I run the PHP script /PHP extension on the command-line i.e. not as a
>> module of Apache  the time it takes is negligible.
>>
>>
>> The  PHP (5.3.4) extension crunches a lot of data from a DB and eventually
>> produces one very large PHP array.
>> which is returned to the client as JSON in the HTTP $_POST response  ( Also
>> gzip compression of the HTTP contents is used.)
>> (In JSON format, the size of the array is 3.7M)
>>
>> I didn't have any problems with the application until recently when the
>> size
>> of the data I'm requesting has increased dramatically.
>>
>>  So it seems that I need to do some 'module' tuning of Apache but I don't
>> know how. I have already changed these parameters in
>> the php.ini to make the extension work.  I include some relevant looking
>> httpd.conf parameters also below. I haven't touched any of these.
>>
>> max_execution_time = 60 ( 'cos the PHP script execution was timing out
>> before the extension finished!)
>> memory_limit = 256M
>>
>>
>> Any suggestions.? Please bear in mind that I'm not trying to write a Apache
>> module, just figure out what my performance
>> problems are when using a very common one.
>>
>> Thanks in advance.
>> Fiona
>>
>> ScoreBoardFile /var/run/httpd.scoreboard ( doesn't exist on my Linux
>> machine)
>> Timeout 300
>> KeepAlive On
>> MaxKeepAliveRequests 100
>> KeepAliveTimeout 15
>> MinSpareServers 5
>> MaxSpareServers 10
>> StartServers 5
>> MaxClients 150
>> MaxRequestsPerChild 0
>> LoadModule vhost_alias_module libexec/apache/mod_vhost_alias.so
>> LoadModule env_module         libexec/apache/mod_env.so
>> LoadModule define_module      libexec/apache/mod_define.so
>> LoadModule config_log_module  libexec/apache/mod_log_config.so
>> LoadModule mime_magic_module  libexec/apache/mod_mime_magic.so
>> LoadModule mime_module        libexec/apache/mod_mime.so
>> LoadModule negotiation_module libexec/apache/mod_negotiation.so
>> LoadModule status_module      libexec/apache/mod_status.so
>> LoadModule info_module        libexec/apache/mod_info.so
>> LoadModule includes_module    libexec/apache/mod_include.so
>> LoadModule autoindex_module   libexec/apache/mod_autoindex.so
>> LoadModule dir_module         libexec/apache/mod_dir.so
>> LoadModule cgi_module         libexec/apache/mod_cgi.so
>> LoadModule asis_module        libexec/apache/mod_asis.so
>> LoadModule imap_module        libexec/apache/mod_imap.so
>> LoadModule action_module      libexec/apache/mod_actions.so
>> LoadModule speling_module     libexec/apache/mod_speling.so
>> LoadModule userdir_module     libexec/apache/mod_userdir.so
>> LoadModule alias_module       libexec/apache/mod_alias.so
>> LoadModule rewrite_module     libexec/apache/mod_rewrite.so
>> LoadModule access_module      libexec/apache/mod_access.so
>> LoadModule auth_module        libexec/apache/mod_auth.so
>> LoadModule anon_auth_module   libexec/apache/mod_auth_anon.so
>> LoadModule dbm_auth_module    libexec/apache/mod_auth_dbm.so
>> LoadModule digest_module      libexec/apache/mod_digest.so
>> LoadModule proxy_module       libexec/apache/libproxy.so
>> LoadModule cern_meta_module   libexec/apache/mod_cern_meta.so
>> LoadModule expires_module     libexec/apache/mod_expires.so
>> LoadModule headers_module     libexec/apache/mod_headers.so
>> LoadModule usertrack_module   libexec/apache/mod_usertrack.so
>> LoadModule log_forensic_module libexec/apache/mod_log_forensic.so
>> LoadModule unique_id_module   libexec/apache/mod_unique_id.so
>> LoadModule setenvif_module    libexec/apache/mod_setenvif.so
>> LoadModule php5_module        libexec/apache/libphp5.so
>>
>> GOS Networks Limited, National Software Centre, Mahon, Cork, Ireland.
>>
>> Registered company number: 445828
>>
>>
>> The information in this email is confidential and may be legally
>> privileged.
>> It is intended solely for the addressee. Access to this email by anyone
>> else
>> is unauthorised. If you are not the intended recipient, any disclosure,
>> copying, distribution or any action taken or omitted to be taken in
>> reliance
>> on it, is prohibited and may be unlawful. When addressed to our clients any
>> opinions or advice contained in this email are subject to the terms and
>> c

Re: PHP script is running very slowly when using Apache PHP module

2011-10-20 Thread Vincenzo D'Amore
Hello Fiona,

have you tried to strace apache process ?

Take a look at this:

http://httpd.apache.org/dev/debugging.html


On Mon, Oct 17, 2011 at 6:49 PM, Fiona Sisk wrote:

> Hi,
>
> I have a problem with the Apache PHP module and am hoping for some pointers
> on how to investigate it.
>
> I have written a PHP extension that is called by a PHP script.
> I use PHP as a module of  Apache ( 1.3.37 or 2.2.19, I've tried both).
> *
> LoadModule php5_modulelibexec/apache/libphp5.so*
>
> I'm getting very slow response times from my PHP script. (approx 1 minute)
>
> However it is only when I run it as an Apache module that the problem
> manifests itself.
> If I run the PHP script /PHP extension on the command-line i.e. not as a
> module of Apache  the time it takes is negligible.
>
>
> The  PHP (5.3.4) extension crunches a lot of data from a DB and eventually
> produces one very large PHP array.
> which is returned to the client as JSON in the HTTP $_POST response  ( Also
> gzip compression of the HTTP contents is used.)
> (In JSON format, the size of the array is 3.7M)
>
> I didn't have any problems with the application until recently when the
> size
> of the data I'm requesting has increased dramatically.
>
>  So it seems that I need to do some 'module' tuning of Apache but I don't
> know how. I have already changed these parameters in
> the php.ini to make the extension work.  I include some relevant looking
> httpd.conf parameters also below. I haven't touched any of these.
>
> max_execution_time = 60 ( 'cos the PHP script execution was timing out
> before the extension finished!)
> memory_limit = 256M
>
>
> Any suggestions.? Please bear in mind that I'm not trying to write a Apache
> module, just figure out what my performance
> problems are when using a very common one.
>
> Thanks in advance.
> Fiona
>
> ScoreBoardFile /var/run/httpd.scoreboard ( doesn't exist on my Linux
> machine)
> Timeout 300
> KeepAlive On
> MaxKeepAliveRequests 100
> KeepAliveTimeout 15
> MinSpareServers 5
> MaxSpareServers 10
> StartServers 5
> MaxClients 150
> MaxRequestsPerChild 0
> LoadModule vhost_alias_module libexec/apache/mod_vhost_alias.so
> LoadModule env_module libexec/apache/mod_env.so
> LoadModule define_module  libexec/apache/mod_define.so
> LoadModule config_log_module  libexec/apache/mod_log_config.so
> LoadModule mime_magic_module  libexec/apache/mod_mime_magic.so
> LoadModule mime_modulelibexec/apache/mod_mime.so
> LoadModule negotiation_module libexec/apache/mod_negotiation.so
> LoadModule status_module  libexec/apache/mod_status.so
> LoadModule info_modulelibexec/apache/mod_info.so
> LoadModule includes_modulelibexec/apache/mod_include.so
> LoadModule autoindex_module   libexec/apache/mod_autoindex.so
> LoadModule dir_module libexec/apache/mod_dir.so
> LoadModule cgi_module libexec/apache/mod_cgi.so
> LoadModule asis_modulelibexec/apache/mod_asis.so
> LoadModule imap_modulelibexec/apache/mod_imap.so
> LoadModule action_module  libexec/apache/mod_actions.so
> LoadModule speling_module libexec/apache/mod_speling.so
> LoadModule userdir_module libexec/apache/mod_userdir.so
> LoadModule alias_module   libexec/apache/mod_alias.so
> LoadModule rewrite_module libexec/apache/mod_rewrite.so
> LoadModule access_module  libexec/apache/mod_access.so
> LoadModule auth_modulelibexec/apache/mod_auth.so
> LoadModule anon_auth_module   libexec/apache/mod_auth_anon.so
> LoadModule dbm_auth_modulelibexec/apache/mod_auth_dbm.so
> LoadModule digest_module  libexec/apache/mod_digest.so
> LoadModule proxy_module   libexec/apache/libproxy.so
> LoadModule cern_meta_module   libexec/apache/mod_cern_meta.so
> LoadModule expires_module libexec/apache/mod_expires.so
> LoadModule headers_module libexec/apache/mod_headers.so
> LoadModule usertrack_module   libexec/apache/mod_usertrack.so
> LoadModule log_forensic_module libexec/apache/mod_log_forensic.so
> LoadModule unique_id_module   libexec/apache/mod_unique_id.so
> LoadModule setenvif_modulelibexec/apache/mod_setenvif.so
> LoadModule php5_modulelibexec/apache/libphp5.so
>
> GOS Networks Limited, National Software Centre, Mahon, Cork, Ireland.
>
> Registered company number: 445828
>
>
> The information in this email is confidential and may be legally
> privileged.
> It is intended solely for the addressee. Access to this email by anyone
> else
> is unauthorised. If you are not the intended recipient, any disclosure,
> copying, distribution or any action taken or omitted to be taken in
> reliance
> on it, is prohibited and may be unlawful. When addressed to our clients any
> opinions or advice contained in this email are subject to the terms and
> conditions expressed in the governing GOS Networks agreement.
>
>


-- 
Vincenzo D'Amore
email: v.dam...@gmail.com
msn: free...@hotmail.com
skype: free.dev
mobile: +39 349 8513251