Re: concurrent fopen fwrite fclose
| From: | Chris Hewitt | Date: | Wed, 12 Feb 2003 09:15:15 +0000 |
| Subject: | Re: concurrent fopen fwrite fclose | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135291@lists.php.net to get a copy of this message | ||
Frederick L. Steinkopf wrote:
Hi, How does php handle multiple concurrent fopen fwrite fclose calls? I have a website that gets 7 million page views a month and we have created a custom log file using fopen fwrite and fclose. When running this concurrently with the apache log we notice significantly lower page hits with the php logger. My guess is that we're losing data when the requests come in concurrently. Any advice would be appreciated. Fred SteinkopfIt sounds as though its the multiple file updates problem. Only one process should be allowed to edit the file at any one time. I suggest you look at flock in the filesystem functions as a means of controlling exclusive access. Other processes need to wait their turn. With page hits averaging nearly 3 per second, depending upon what you log and what reporting you want from the logs, might a database be considered? HTH Chris