Tommy Pham wrote:
On Wed, Mar 24, 2010 at 3:52 AM, Lester Caine <> wrote:
Tommy Pham wrote:
How exactly will threading in PHP help with the size of the database?
That makes no sense to me, please help me understand how you think threading
will help in this scenario.
Looking at my example, not just the rows....  There are other features
that require queries to a DB for simple request of a category by a
shopper,  instead of running those queries in series, running them in
parallel would yield better response time.

Database size issues are tackled with clustering, caching and DB
optimisation. Threading in the language accessing the DB has no advantage
Yes, it does.  As mentioned several times, instead of running the
queries in series, run them in parallel.  If each of the queries takes
about .05 to .15 seconds.  How long would it take to run them in
serial?  How long do you it take to run them in parallel?
Any you have a database that can actually handle that?
If the database is taking 0.1 seconds per query, and you have 10 queries,
then getting the data is going to take 1 second to generate. If you want
some slow query to be started, and come back for the data later, then I
thought we already had that? But again this is part of the database driver
anyway. No need to add threading to PHP to get the database connection to
pull data in the most efficient way. And one does not write the driver in
PHP? We are using C there already?

Lester Caine - G8HFL

Exactly my point.  10 queries taking .1 second each running in serial
is 1 second total.  How long would it take to run all those same
queries simultaneously??? What's so difficult about the concept of
serial vs parallel?

You seem to think that those 10 queries are happening in isolation. What about the other 100 concurrent users all smacking the db server with 10 queries. The db server is just going to queue them and serially process them as each of it's own processing threads become free. In high concurrency situations threading isn't going to make much difference, in fact it's very likely to decrease performance because now you've added the overhead of thread concurrency handling in PHP when the db server is already handling this issue between the multiple web server requests.

Application and Templating Framework for PHP

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to