Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Flock() on File()
- Jason Carlton
January 30, 2010, 8:57 am
rate this thread
I use file() throughout my site to read small text files. Am I going
to have any performance issues from not using flock()? The files are
all read-only, so I'm not worried about someone writing while someone
else is reading.
Similarly, which is faster; file() or fopen()? File() is easier to
use, so I'm sure it is slower :-)
For reference, during peak hours, my site might have 800 request per
second, and ever since a major release update, I'm having speed issues
during peak hours. So, I'm trying to track it down... one line at a
- The Natural Philosopher
January 30, 2010, 12:09 pm
Re: Flock() on File()
Jason Carlton wrote:
If the files are never written to, you don't need to flock() them.
As for file() being slower - don't guess. Find out. And remember,
file() does the equivalent of fopen()/fread()/fclose().
You need to profile your code to find out where your real problems are.
It might not even be PHP, for instance.
Remove the "x" from my email address
JDS Computer Training Corp.