467,180 Members | 1,097 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,180 developers. It's quick & easy.

require_once() with relative-path in Zend Framework causes so manyextra syscall.

Hi, all.

I recently encountered a very annoying problem while using Zend
Framework(ZF).

We use ZF in our web application, and it works fine at the
beginning, but later when concurrent requests goes high, we get very
high cpu load. when i trace the httpd using strace, i find so much
fstat64 syscalls, most of which failed, all these syscalls take more
than 60% of cpu usage. After i check our php code carefully, i find
all our require_once() was used with absolute-path, but require_once()
in ZF are all used with relative-path, so while a class in ZF was
used, php will search all directories in include_path, see if the
class file was exists and accessable. but most of them fails, utill
directory of zend framework was reached.

so how to stop php making so many meaningless tries. I guess
modified the zend framework make it do its require_once() with
absolute-path was not feasible.

another approach i guess is: use __autoload() to load classes when
it actually needed. but this also need to modify the Zend Framework.

any better advices? thank you.
Nov 25 '07 #1
  • viewed: 2955
Share:
3 Replies
On 25 Nov, 13:57, Peter Wang <ptr.w...@gmail.comwrote:
Hi, all.

I recently encountered a very annoying problem while using Zend
Framework(ZF).

We use ZF in our web application, and it works fine at the
beginning, but later when concurrent requests goes high, we get very
high cpu load. when i trace the httpd using strace, i find so much
fstat64 syscalls, most of which failed, all these syscalls take more
than 60% of cpu usage. After i check our php code carefully, i find
all our require_once() was used with absolute-path, but require_once()
in ZF are all used with relative-path, so while a class in ZF was
used, php will search all directories in include_path, see if the
class file was exists and accessable. but most of them fails, utill
directory of zend framework was reached.

so how to stop php making so many meaningless tries. I guess
modified the zend framework make it do its require_once() with
absolute-path was not feasible.

another approach i guess is: use __autoload() to load classes when
it actually needed. but this also need to modify the Zend Framework.

any better advices? thank you.
If require_once() really is using 60% of your cpu, your PHP code must
be **AMAZINGLY** fast or you've got real problems with your
filesystem. The latter is likely to show up elsewhere (kernel errors,
filesystem errors, hardware errors) so I suspect your analysis is
wrong or incomplete.

Sometimes you've just got to through more hardware at the problem.

C.
Nov 25 '07 #2
Peter Wang wrote:
Hi, all.

I recently encountered a very annoying problem while using Zend
Framework(ZF).

We use ZF in our web application, and it works fine at the
beginning, but later when concurrent requests goes high, we get very
high cpu load. when i trace the httpd using strace, i find so much
fstat64 syscalls, most of which failed, all these syscalls take more
than 60% of cpu usage. After i check our php code carefully, i find
all our require_once() was used with absolute-path, but require_once()
in ZF are all used with relative-path, so while a class in ZF was
used, php will search all directories in include_path, see if the
class file was exists and accessable. but most of them fails, utill
directory of zend framework was reached.

so how to stop php making so many meaningless tries. I guess
modified the zend framework make it do its require_once() with
absolute-path was not feasible.

another approach i guess is: use __autoload() to load classes when
it actually needed. but this also need to modify the Zend Framework.

any better advices? thank you.
How long is your include path, anyway? It's a very good reason not to
use it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 25 '07 #3
On Nov 25, 11:19 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
Peter Wang wrote:
Hi, all.
I recently encountered a very annoying problem while using Zend
Framework(ZF).
We use ZF in our web application, and it works fine at the
beginning, but later when concurrent requests goes high, we get very
high cpu load. when i trace the httpd using strace, i find so much
fstat64 syscalls, most of which failed, all these syscalls take more
than 60% of cpu usage. After i check our php code carefully, i find
all our require_once() was used with absolute-path, but require_once()
in ZF are all used with relative-path, so while a class in ZF was
used, php will search all directories in include_path, see if the
class file was exists and accessable. but most of them fails, utill
directory of zend framework was reached.
so how to stop php making so many meaningless tries. I guess
modified the zend framework make it do its require_once() with
absolute-path was not feasible.
another approach i guess is: use __autoload() to load classes when
it actually needed. but this also need to modify the Zend Framework.
any better advices? thank you.

How long is your include path, anyway? It's a very good reason not to
use it.
Very true. It might also help if you put the directory of the Zend
framework at the beginning of the include path so that it's found
immediately.

Nov 25 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Lars Plessmann | last post: by
6 posts views Thread by Nik Coughin | last post: by
3 posts views Thread by Justin L. Kennedy | last post: by
11 posts views Thread by Kimmo Laine | last post: by
8 posts views Thread by David T. Ashley | last post: by
6 posts views Thread by Shelly | last post: by
7 posts views Thread by Ronald Raygun | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.