Re: Re: how dod you get to do multiple mysql queries concurrently?

From: Date: Fri, 25 Jan 2008 20:13:27 +0000
Subject: Re: Re: how dod you get to do multiple mysql queries concurrently?
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-268143@lists.php.net to get a copy of this message
On Fri, January 25, 2008 1:45 pm, Jochem Maas wrote: > Richard Lynch schreef: >> On Fri, January 25, 2008 11:33 am, Floor Terra wrote: >>>>>>> I know how to do multiple queries - the key issue in my >>>>>>> question >>>>>>> was how to do them concurrently (i.e. in parallel). >>>>>> So you want to make PHP multithreaded??? >>>>> No, just the mysql queries. >>> Try pcntl_fork() to create a child process for each query. >>> Each child can make it's own MySQL connection. >> >> Do *NOT* do this in a web-server environment, unless you have >> EXTENSIVELY and EXHAUSTIVELY tested all your PHP extensions for >> thread-safety! > > I agree about the don't do that part - but what has process forking > got to do with thread safety? > > AFAIK you shouldn't do that because it madness to fork a complete > apache > process. Process forking has EVERYTHING to do with thread safety. Whatever is going to go wrong in a threaded environment is going to also go wrong when you fork the process, almost for sure. "Global" variables (or other resources) will not get split/duplicated correctly, as fork has NO IDEA what needs separating. So you suddenly have two processing pounding data in/out of what each of them think is an exclusive resource/memory-address/whatever... Baby go Boom! -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So?

« previous php.general (#268143) next »