From: Stuart Dallas on
On 24 Mar 2010, at 10:38, Tommy Pham wrote:
> On Wed, Mar 24, 2010 at 3:31 AM, Stuart Dallas <stuttle(a)gmail.com> wrote:
>> On 24 Mar 2010, at 10:24, Tommy Pham wrote:
>>> I did give a real life example, ie e-commerce site mentioned earlier.
>>> Amazon has the similar features of my example except they have about
>>> 30 million products without (i18n). Their I18n is different web
>>> server & db & site layout which is completely different from my
>>> example. Setting I18n aside, having the same features as my example
>>> with about 30 million products to response in about 3 seconds is very
>>> good. Even though my example only have about 750,000 products, the
>>> translations for the requested languages makes it into 750,000 * 6 =
>>> 4,500,000 rows of product descriptions. This is e-commerce site not a
>>> data warehouse/mining. What would happen then if the site has over
>>> 20,000,000 product skus with similar language translations for the
>>> descriptions? 20,000,000 * 6 = ... big number to me...
>>
>> 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.

I can see that argument, but your comment above only stated issues of database size, and said nothing about running queries in parallel, hence my confusion.

Threading would indeed allow you to run the queries in parallel, but at what cost? Personally I would focus on modifying the database structure and introducing caching to minimise the number of queries being executed. Threading would be my last resort if this was my major bottleneck.

-Stuart

--
http://stut.net/


From: Tommy Pham on
On Wed, Mar 24, 2010 at 3:39 AM, Stuart Dallas <stuttle(a)gmail.com> wrote:
>
> On 24 Mar 2010, at 10:34, Rene Veerman wrote:
>
>> On Wed, Mar 24, 2010 at 12:28 PM, Tommy Pham <tommyhp2(a)gmail.com> wrote:
>>>
>>> Funny you should mention all that.  Let's say that you're longer with
>>> that company, either by direct employment or contract consultant.
>>> You've implemented C because you need 'thread'.  Now your replacement
>>> comes in and has no clue about C even though your replacement is a PHP
>>> guru.  How much headache is maintenance gonna be?  Scalability?
>>> Portability? wow....
>>>
>> Thanks for posting this before i had to.
>>
>> +1, +1, +1...
>
> You realise, of course, that the same argument applies to using advanced features of PHP, such as threading should it ever be supported.
>
> -Stuart
>

Thanks for supporting PHP thread. Thus, it would be a lot easier for
any PHP guru to scale, make it portable, or integrate into other PHP
apps without having to juggle C, Ruby, Python... and whatever else is
out there...
From: Lester Caine on
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 here.
>
> 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
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
From: Tommy Pham on
On Wed, Mar 24, 2010 at 3:44 AM, Per Jessen <per(a)computer.org> wrote:
> Tommy Pham wrote:
>
>> On Wed, Mar 24, 2010 at 3:20 AM, Per Jessen <per(a)computer.org> wrote:
>>> Tommy Pham wrote:
>>>
>>>> What I find funny is that one of opponents of PHP threads earlier
>>>> mentioned that how silly it would be to be using C in a web app.
>>>> Now I hear people mentioning C when they need "productivity" or
>>>> "speed"...
>>>>
>>>
>>> I think I was the one to mention the latter, but as I started out
>>> saying, and as others have said too, it's about the right tool for
>>> the right job.  When choosing a tool, there are a number of factors
>>> to consider - developer productivity, available skills, future
>>> maintenance, performance, scalability, portability, parallelism,
>>> performance etcetera.
>>>
>>
>> Funny you should mention all that.  Let's say that you're longer with
>> that company, either by direct employment or contract consultant.
>> You've implemented C because you need 'thread'.  Now your replacement
>> comes in and has no clue about C even though your replacement is a PHP
>> guru.  How much headache is maintenance gonna be?  Scalability?
>> Portability? wow....
>
> Who was the idi... who hired someone who wasn't suited for the job?
> Tommy, that's a moot argument.  You can't fit a square peg in a round
> hole.
>
>
>
> --
> Per Jessen, Zürich (12.5°C)
>
>

Suited for the job? You mean introduce more complexity to a problem
that what could be avoided to begin with if PHP has thread support?
hmmm....
From: Tommy Pham on
On Wed, Mar 24, 2010 at 3:52 AM, Lester Caine <lester(a)lsces.co.uk> 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
>>> here.
>>
>> 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
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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?