Welcome Guest, Not a member yet? Register   Sign In
file_exists() on non existstant files (file descriptors)
#1

I'm doing performance testing with our web server (latest version of CI).  When running we execute the following to see how many open and accessed files. 

# strace -e 'trace=open,access' -p 19435 |& sort | uniq -c | sort -nr | grep php

There are a lot of files that our web app don't use (i.e. application/helpers/SKY_url_helper.php, application/helpers/form_helper.php). When we add up the +40 files that CI looks for (but we don't implement) * thousands of requests/second we run into problems. 

I've gone through the code and there doesn't seem to be a way to explicitly stop files from trying to be open or from being checked if they exist.

The issue is that we are trying to get thousands of requests per second and we run out of file descriptors.  Especially when you take into account MySQL and memcache.

Q: Is it possible to stop CI from checking if a file exists or is there a 'trick/feature' that I am missing? 
Reply
#2

Do you have a bunch of entries in /application/config/autoload.php you don't need? Any entry in the autoload config is loaded every time CI starts.

Do you check whether a class/function exists before attempting to load it? In most cases the loader doesn't attempt to locate the file if the class has already been loaded, but there may be some exceptions.

Have you defined extra paths in the loader's view/library/model/helper paths (or used add_package_path() to do so)?

Other than that, the only thing I could really think of would be to overload the loader to limit the checks based on your requirements. I'd imagine if you really wanted to you could create a lookup table in one form or another by scanning the relevant directories through an external process and use that instead of calling file_exists(). As long as you run the task whenever files are added/removed, it shouldn't be much of an issue.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB