note 56881 added to function.flock

From: Date: Sun, 18 Sep 2005 11:49:26 +0000
Subject: note 56881 added to function.flock
Groups: php.notes 
Request: Send a blank email to php-notes+get-95364@lists.php.net to get a copy of this message
Amazing! these discussions are so similar to those back in the late '60s and early '70s about how to achieve file synchronization - especially across not-very-compatible platfoms. That was the big debate that led us to create databases, rollback and all, for exactly the same reasons. The only big difference between then and now is that these days we have the internet, whereas back then the discussion was in the letters columns of the computing journals. [E-mail only started to be available in the late 70s - and messy to use via gateways between different national nets.] PHP's flock() is a nice little hack for simple synchronization situations: trying to use it in big situations won't reliably work. If you need a bit of resilience in the application, you have to provide it yourself - which could be as simple as occasional manual backups of the files that could become corrupted. The mkdir/etc trick is a slightly bigger hack: but horridly dependant on atomicity, which is not guaranteed on guess-which-corporation's crummy operating systems. Consider switching to Unix/Linux/Mac. If you have a big data-handling problem needing high automatic resilience, then you need a database: sadly, no-one's come up with a better answer in 40 years of trying. If PHP+MySQL is too slow, you need either one of the faster expensive databases, or servelets. Or wait for CPUs to get fast enough for you. Or rethink the problem you're trying to solve [which is what I've done many many times over the decades: the resulting application is invariably better than anything I'd have achieved with the original poor problem-analysis.] ---------------- It's depressing how people will struggle with inventing a square wheel without checking whether it was invented before. "Those who know no history are condemned to repeat it." [Carlos Casteneda - but similar thoughts were expressed by Churchill, Napolean, Alexander of Macedon, and many others.] ---- Manual Page -- http://www.php.net/manual/en/function.flock.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56881 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56881&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56881&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56881&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56881&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56881&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+56881&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56881&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56881&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95364) next »