Disk IO performance

Posted by diskio, 03-26-2008, 08:03 PM
From the Disk I/O performance is it better 1) to have main PHP file with 10 includes 2) all 11 files as one file 3) the difference is not big Suppose a) a low traffic site b) a high traffice site thanks

Posted by Tim Greer, 03-26-2008, 08:17 PM
As far as speed, if it's the same code, saving yourself from opening/reading in 10 other files is always going to be faster regardless of the situation (all things being equal otherwise). It's difficult to say if it would actually make an impact in a negative way at all though (it depends on too many factors).

Posted by supportmatrix, 03-27-2008, 02:31 AM
Thearatically thinking, If you open 11 files, it means kernel will have meta data about all the opened files, and the page cache will contain data from diifferent file. If you have one single file, opened, kernel will have meta info about that file only, and page cache contains info from this single file, so sequential paging will be much more effective. So, i think, best option is all 11 files as 1 single file

Posted by Tim Greer, 03-27-2008, 02:46 AM
Again, all things being equal. Now, if you have routines/functions, variables, and other data loaded in the one large file that you won't need or want every time or never in some cases, it's wasteful -- where you could otherwise only include files and their data and functions when/if needed, so that could be faster, depending on what it's doing, how large (how much data) is in memory and being processes (perhaps for no good reason). However, again, all things being equal, if you're opening 11 files to include, I assume you need that data, functions, etc. anyway. So, it can depend. So, the answer is one file if everything was equal, as I had originally said above, but I wanted to elaborate on that. Sorry if that sounds like gibberish, I'm tired.

Posted by jamesmoey, 03-27-2008, 04:28 AM
It depend on your application. If you application employ caching, then it is possible that not all the include file is needed to be loaded. Hence separating file will increase performance because the file size is a lot smaller. As a thumbnail of rule, 90% of the time, the program only execute 10% of the code. Therefore, there is no hard rule which is better or better performance. It all depend on your application.

Posted by RBBOT, 03-27-2008, 07:51 AM
Purely from diskio performance, all files in one php will be fastest. However, that hits memory usage and processor time as it has to compile all the extra code every hit, so it may be slower overall. However, you should install an opcode cache such as eaccelerator/xcache/apc, then it will keep pre-compiled versions of each include file in memory so they aren't read from disk, and in this scenario, the separate include files gives better overall performance.

Posted by diskio, 03-27-2008, 11:49 AM
Thank you all for answering. Some of those files should be included every single time, while the remaining will be included only when necessary (PHP __autoload function). As the answers are inconclusive (I thought it would be like that because there are too many factors), I'll merge the files that needs to be included every single time and I'll leave out the files that are not included every single time and include them when necessary (PHP __autoload function). As from your answers I conclude you're all familiar with this problems, I have one more question. So far I haven't been using caching applications, but I was experimenting with Zend Safe Guard (Zend Encoder). 1) Is it possible to install one of those applications (can you please suggest a single one that you believe does its job good) locally on my computer and then transfer cached (precompiled) files to server? I'm on the shared host and would like to protect the source code from the clients I'm giving the application (it is agreed that they do not buy my code but license it). 2) From the security point of view (I understand that this isn't the purpose of caching applications), how difficult is it to "decompile" it? I was disappointed to find out that Zend encoded files can be easily decompiled and therefore I'm looking for the alternative way (preferably GPL solution, but moderate price is also acceptable) so I can give my clients that, and protect the copyright.

Posted by 1boss1, 03-30-2008, 12:06 AM
Zend is very simple to decode, its as easy as dragging and dropping a file. Ioncube is a fair bit harder. As for cache, eAccelerator is very common, easy to install and does a good job.

Cette réponse était-elle pertinente?

 Imprimer cet article

Consultez aussi

Auto Block IP Windows 2003

Posted by directhostinguk, 05-06-2007, 02:39 PMAnyone got any ideas how to detect and block IP’s...

yum broken

Posted by chielsen, 12-18-2007, 02:20 PMI have waisted all not trying to get subversion working...

Mail the reach the mailbox

Posted by igalst, 05-08-2007, 08:41 AMHello, I have a VPS running Windows 2003 with Plesk 8.1...

SMS sending script

Posted by stjoenetworks, 01-16-2008, 11:35 PMAnyone know a decent/good script for sending SMS...

.htaccess redirect all pages to https://www

Posted by LJ Host, 07-17-2007, 01:50 PMHi guys, I'm not to good with htaccess so I need your...