473,598 Members | 3,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
3 3229
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*******@attgl obal.net
=============== ===

Nov 25 '07 #3
On Nov 25, 11:19 am, Jerry Stuckle <jstuck...@attg lobal.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
38326
by: the wonderer | last post by:
This is an elementary question, but I've not been able to find the answer, so here goes: I am developing a site using php. I have the html header information in a file that I include in all the pages using the require_once function. That is, each page includes the line <?require_once('PageStart.php')?>
7
3315
by: Lars Plessmann | last post by:
I hava several php files in different folders. I tried to use relative paths. But when I call a script from another folder that has another depth, it cannot find the files that are embedded via require once within the included file. sample: fileA.php (in the root dir!) -----
6
5331
by: Nik Coughin | last post by:
Say I have a script: http://www.mydomain.com/test/admin/foo.php That looks like this: <?php $baseDir = "http://" . $_SERVER . "/test"; require_once( $baseDir . '/helpers/helper.php' );
1
1780
by: superoni | last post by:
Hello, I use require_once() in all my code that includes a separate class declared inside there. However, there are times in certain cases where I will still get a class redeclaration error. The php error log says I'm FATAL ERROR, can't redeclare class or something to that extent. ph34r.gif Are there any other cases where this error might occur even while using require_once()?
3
2877
by: Justin L. Kennedy | last post by:
I am having a problem with multiple includes. A.php require_once on two files: B.php then C.php C.php require_once on B.php again Then I get a message: Warning: main(../../B.php): failed to open stream: No such file or directory in
5
2091
by: mostof | last post by:
I'm facing a problem with require_once... Instead of actually including the file i'm requiring, it just dumps it out as text... other functions are working quite well... the code look like this: $forum_version = 'SMF 1.0 RC2';
11
41069
by: Kimmo Laine | last post by:
I'm flipping my wig here, people. I'm using classes and making each class a file. when I'm including dependet classess, I use require_once to avoid multiple declarations - yet they happen. I put debug_print_backtrace in the file to see how it is included, and here's the output: #0 require_once() called at #1 require_once(\eKirje.textGrid.class.php) called at #0 require_once() called at #1 require_once(\eKirje.kanava.class.php)...
8
4336
by: David T. Ashley | last post by:
Hi, Does require_once() treat "file.inc" and "subdirectory/file.inc" as the same things or different? The reason for my question is that I'd like to organize my PHP library into subdirectories, and if I accidentally have a naming collision, I'm curious how require_once() will behave. Thanks.
6
2071
by: Shelly | last post by:
Here is a crazy question that has happend to me once before. I have an include file for the connection information to the server. It is like this: $hostname= "the_server_location"; $database = "the_database_name"; $dbUsername = "the_username"; $dbPassword = "the_password"; $dbCon = mysql_pconnect($hostname, $dbUsername, $dbPassword) or
7
1782
by: Ronald Raygun | last post by:
I have been struggling with this all afternoon and I'm, well lats just say, very pissed off ... I have a require once in a file. I am passing the fully qualified (i.e. absolute pathname) to a file that exists on my machine (I'm looking ath the file now). I am evaluating the pathname like this (see below) Contents of app_config.php
0
7899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8397
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8050
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6718
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5850
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3897
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2412
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1504
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.