From: Tommy Pham on
On Thu, Mar 25, 2010 at 12:02 PM, Peter Lind <peter.e.lind(a)gmail.com> wrote:
> On 25 March 2010 19:37, Tommy Pham <tommyhp2(a)gmail.com> wrote:
>> On Thu, Mar 25, 2010 at 3:55 AM, Per Jessen <per(a)computer.org> wrote:
>>> Tommy Pham wrote:
>>>
>>>> On Thu, Mar 25, 2010 at 1:46 AM, Per Jessen <per(a)computer.org> wrote:
>>>>>> * If you could implement threads and run those same queries in 2+
>>>>>> threads, the total time saved from queries execution is 1/2 sec or
>>>>>> more, which is pass along as the total response time reduced.  Is it
>>>>>> worth it for you implement threads if you're a speed freak?
>>>>>
>>>>> Use mysqlnd - asynchronous mysql queries.
>>>>>
>>>>
>>>> You're assuming that everyone in the PHP world uses MySQL 4.1 or
>>>> newer.  What about those who don't?
>>>
>>> They don't get to use threading, nor asynchronous mysql queries.
>>>
>>> Come on, you're asking about a future feature in PHP 7.x , but would
>>> like to support someone who is seriously backlevel on mysql??
>>>
>>>
>>> --
>>> Per Jessen, Zürich (16.9°C)
>>>
>>
>> I'm not talking about MySQL 4.0 or older.  I'm talking about other
>> RDBMS.  I think you should open your eyes a bit wider and take a look
>> at the bigger picture (Firebird, MSSQL, Oracle, PostgreSQL, etc).
>
> http://www.php.net/manual/en/function.pg-send-query.php
>
> Looks to me like the PHP postgresql library already handles that. Not
> to mention: you're not presenting an argument for threads, you're
> presenting an argument for implementing asynchronous queries in the
> other DBMS libraries.
>
> Of course, the problem could also be solved by introducing threads in
> PHP. I'd personally guess modifying DBMS libraries would be less
> costly, but as I haven't been involved in writing the PHP code my
> guess isn't worth much.
>
> Regards
> Peter
>

I'm presenting the argument for threading. Per is presenting the work
around using asynchronous queries via mysqlnd. I did read that link a
few days ago, "Although the user can send multiple queries at once,
multiple queries cannot be sent over a busy connection. If a query is
sent while the connection is busy, it waits until the last query is
finished and discards all its results." Which sounds like threads ->
multiple connections to not run into that problem.
From: Peter Lind on
On 25 March 2010 20:09, Tommy Pham <tommyhp2(a)gmail.com> wrote:
> On Thu, Mar 25, 2010 at 12:02 PM, Peter Lind <peter.e.lind(a)gmail.com> wrote:
>> On 25 March 2010 19:37, Tommy Pham <tommyhp2(a)gmail.com> wrote:
>>> On Thu, Mar 25, 2010 at 3:55 AM, Per Jessen <per(a)computer.org> wrote:
>>>> Tommy Pham wrote:
>>>>
>>>>> On Thu, Mar 25, 2010 at 1:46 AM, Per Jessen <per(a)computer.org> wrote:
>>>>>>> * If you could implement threads and run those same queries in 2+
>>>>>>> threads, the total time saved from queries execution is 1/2 sec or
>>>>>>> more, which is pass along as the total response time reduced.  Is it
>>>>>>> worth it for you implement threads if you're a speed freak?
>>>>>>
>>>>>> Use mysqlnd - asynchronous mysql queries.
>>>>>>
>>>>>
>>>>> You're assuming that everyone in the PHP world uses MySQL 4.1 or
>>>>> newer.  What about those who don't?
>>>>
>>>> They don't get to use threading, nor asynchronous mysql queries.
>>>>
>>>> Come on, you're asking about a future feature in PHP 7.x , but would
>>>> like to support someone who is seriously backlevel on mysql??
>>>>
>>>>
>>>> --
>>>> Per Jessen, Zürich (16.9°C)
>>>>
>>>
>>> I'm not talking about MySQL 4.0 or older.  I'm talking about other
>>> RDBMS.  I think you should open your eyes a bit wider and take a look
>>> at the bigger picture (Firebird, MSSQL, Oracle, PostgreSQL, etc).
>>
>> http://www.php.net/manual/en/function.pg-send-query.php
>>
>> Looks to me like the PHP postgresql library already handles that. Not
>> to mention: you're not presenting an argument for threads, you're
>> presenting an argument for implementing asynchronous queries in the
>> other DBMS libraries.
>>
>> Of course, the problem could also be solved by introducing threads in
>> PHP. I'd personally guess modifying DBMS libraries would be less
>> costly, but as I haven't been involved in writing the PHP code my
>> guess isn't worth much.
>>
>> Regards
>> Peter
>>
>
> I'm presenting the argument for threading.  Per is presenting the work
> around using asynchronous queries via mysqlnd.  I did read that link a
> few days ago, "Although the user can send multiple queries at once,
> multiple queries cannot be sent over a busy connection. If a query is
> sent while the connection is busy, it waits until the last query is
> finished and discards all its results."  Which sounds like threads ->
> multiple connections to not run into that problem.
>

Have you looked into what it would cost in development to improve the
library? Have you compared that to the cost in development to
introduce threads into PHP? No, I don't think you're presenting the
argument for threading - but I don't expect you to see it that way.

--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>
From: Ashley Sheridan on
On Thu, 2010-03-25 at 12:09 -0700, Tommy Pham wrote:

> On Thu, Mar 25, 2010 at 12:02 PM, Peter Lind <peter.e.lind(a)gmail.com> wrote:
> > On 25 March 2010 19:37, Tommy Pham <tommyhp2(a)gmail.com> wrote:
> >> On Thu, Mar 25, 2010 at 3:55 AM, Per Jessen <per(a)computer.org> wrote:
> >>> Tommy Pham wrote:
> >>>
> >>>> On Thu, Mar 25, 2010 at 1:46 AM, Per Jessen <per(a)computer.org> wrote:
> >>>>>> * If you could implement threads and run those same queries in 2+
> >>>>>> threads, the total time saved from queries execution is 1/2 sec or
> >>>>>> more, which is pass along as the total response time reduced. Is it
> >>>>>> worth it for you implement threads if you're a speed freak?
> >>>>>
> >>>>> Use mysqlnd - asynchronous mysql queries.
> >>>>>
> >>>>
> >>>> You're assuming that everyone in the PHP world uses MySQL 4.1 or
> >>>> newer. What about those who don't?
> >>>
> >>> They don't get to use threading, nor asynchronous mysql queries.
> >>>
> >>> Come on, you're asking about a future feature in PHP 7.x , but would
> >>> like to support someone who is seriously backlevel on mysql??
> >>>
> >>>
> >>> --
> >>> Per Jessen, Zürich (16.9°C)
> >>>
> >>
> >> I'm not talking about MySQL 4.0 or older. I'm talking about other
> >> RDBMS. I think you should open your eyes a bit wider and take a look
> >> at the bigger picture (Firebird, MSSQL, Oracle, PostgreSQL, etc).
> >
> > http://www.php.net/manual/en/function.pg-send-query.php
> >
> > Looks to me like the PHP postgresql library already handles that. Not
> > to mention: you're not presenting an argument for threads, you're
> > presenting an argument for implementing asynchronous queries in the
> > other DBMS libraries.
> >
> > Of course, the problem could also be solved by introducing threads in
> > PHP. I'd personally guess modifying DBMS libraries would be less
> > costly, but as I haven't been involved in writing the PHP code my
> > guess isn't worth much.
> >
> > Regards
> > Peter
> >
>
> I'm presenting the argument for threading. Per is presenting the work
> around using asynchronous queries via mysqlnd. I did read that link a
> few days ago, "Although the user can send multiple queries at once,
> multiple queries cannot be sent over a busy connection. If a query is
> sent while the connection is busy, it waits until the last query is
> finished and discards all its results." Which sounds like threads ->
> multiple connections to not run into that problem.
>


Wouldn't there still be the same issue though?

If several threads of PHP are all trying to connect to to a database
that can only handle a finite number of connections, the database must
still wait until a query has been pushed off of it's queue before it can
process another. As far as I can see, this isn't an issue that can be
solved by threading in PHP, but by allowing more concurrent connections
in the database.

Thanks,
Ash
http://www.ashleysheridan.co.uk


From: Tommy Pham on
On Thu, Mar 25, 2010 at 12:13 PM, Peter Lind <peter.e.lind(a)gmail.com> wrote:
> On 25 March 2010 20:09, Tommy Pham <tommyhp2(a)gmail.com> wrote:
>> On Thu, Mar 25, 2010 at 12:02 PM, Peter Lind <peter.e.lind(a)gmail.com> wrote:
>>> On 25 March 2010 19:37, Tommy Pham <tommyhp2(a)gmail.com> wrote:
>>>> On Thu, Mar 25, 2010 at 3:55 AM, Per Jessen <per(a)computer.org> wrote:
>>>>> Tommy Pham wrote:
>>>>>
>>>>>> On Thu, Mar 25, 2010 at 1:46 AM, Per Jessen <per(a)computer.org> wrote:
>>>>>>>> * If you could implement threads and run those same queries in 2+
>>>>>>>> threads, the total time saved from queries execution is 1/2 sec or
>>>>>>>> more, which is pass along as the total response time reduced.  Is it
>>>>>>>> worth it for you implement threads if you're a speed freak?
>>>>>>>
>>>>>>> Use mysqlnd - asynchronous mysql queries.
>>>>>>>
>>>>>>
>>>>>> You're assuming that everyone in the PHP world uses MySQL 4.1 or
>>>>>> newer.  What about those who don't?
>>>>>
>>>>> They don't get to use threading, nor asynchronous mysql queries.
>>>>>
>>>>> Come on, you're asking about a future feature in PHP 7.x , but would
>>>>> like to support someone who is seriously backlevel on mysql??
>>>>>
>>>>>
>>>>> --
>>>>> Per Jessen, Zürich (16.9°C)
>>>>>
>>>>
>>>> I'm not talking about MySQL 4.0 or older.  I'm talking about other
>>>> RDBMS.  I think you should open your eyes a bit wider and take a look
>>>> at the bigger picture (Firebird, MSSQL, Oracle, PostgreSQL, etc).
>>>
>>> http://www.php.net/manual/en/function.pg-send-query.php
>>>
>>> Looks to me like the PHP postgresql library already handles that. Not
>>> to mention: you're not presenting an argument for threads, you're
>>> presenting an argument for implementing asynchronous queries in the
>>> other DBMS libraries.
>>>
>>> Of course, the problem could also be solved by introducing threads in
>>> PHP. I'd personally guess modifying DBMS libraries would be less
>>> costly, but as I haven't been involved in writing the PHP code my
>>> guess isn't worth much.
>>>
>>> Regards
>>> Peter
>>>
>>
>> I'm presenting the argument for threading.  Per is presenting the work
>> around using asynchronous queries via mysqlnd.  I did read that link a
>> few days ago, "Although the user can send multiple queries at once,
>> multiple queries cannot be sent over a busy connection. If a query is
>> sent while the connection is busy, it waits until the last query is
>> finished and discards all its results."  Which sounds like threads ->
>> multiple connections to not run into that problem.
>>
>
> Have you looked into what it would cost in development to improve the
> library? Have you compared that to the cost in development to
> introduce threads into PHP? No, I don't think you're presenting the
> argument for threading - but I don't expect you to see it that way.
>

Aren't all feature requests must be analyzed the same way? Example,
namespace, how many of us actually uses it now when there is an
alternative solution- subfolders - that we've been using since who
knows how long. I don't know if threads was asked a feature prior
namespace was implemented.
From: Tommy Pham on
On Thu, Mar 25, 2010 at 12:11 PM, Ashley Sheridan
<ash(a)ashleysheridan.co.uk> wrote:
>
> On Thu, 2010-03-25 at 12:09 -0700, Tommy Pham wrote:
>
> On Thu, Mar 25, 2010 at 12:02 PM, Peter Lind <peter.e.lind(a)gmail.com> wrote:
> > On 25 March 2010 19:37, Tommy Pham <tommyhp2(a)gmail.com> wrote:
> >> On Thu, Mar 25, 2010 at 3:55 AM, Per Jessen <per(a)computer.org> wrote:
> >>> Tommy Pham wrote:
> >>>
> >>>> On Thu, Mar 25, 2010 at 1:46 AM, Per Jessen <per(a)computer.org> wrote:
> >>>>>> * If you could implement threads and run those same queries in 2+
> >>>>>> threads, the total time saved from queries execution is 1/2 sec or
> >>>>>> more, which is pass along as the total response time reduced.  Is it
> >>>>>> worth it for you implement threads if you're a speed freak?
> >>>>>
> >>>>> Use mysqlnd - asynchronous mysql queries.
> >>>>>
> >>>>
> >>>> You're assuming that everyone in the PHP world uses MySQL 4.1 or
> >>>> newer.  What about those who don't?
> >>>
> >>> They don't get to use threading, nor asynchronous mysql queries.
> >>>
> >>> Come on, you're asking about a future feature in PHP 7.x , but would
> >>> like to support someone who is seriously backlevel on mysql??
> >>>
> >>>
> >>> --
> >>> Per Jessen, Zürich (16.9°C)
> >>>
> >>
> >> I'm not talking about MySQL 4.0 or older.  I'm talking about other
> >> RDBMS.  I think you should open your eyes a bit wider and take a look
> >> at the bigger picture (Firebird, MSSQL, Oracle, PostgreSQL, etc).
> >
> > http://www.php.net/manual/en/function.pg-send-query.php
> >
> > Looks to me like the PHP postgresql library already handles that. Not
> > to mention: you're not presenting an argument for threads, you're
> > presenting an argument for implementing asynchronous queries in the
> > other DBMS libraries.
> >
> > Of course, the problem could also be solved by introducing threads in
> > PHP. I'd personally guess modifying DBMS libraries would be less
> > costly, but as I haven't been involved in writing the PHP code my
> > guess isn't worth much.
> >
> > Regards
> > Peter
> >
>
> I'm presenting the argument for threading. Per is presenting the work
> around using asynchronous queries via mysqlnd. I did read that link a
> few days ago, "Although the user can send multiple queries at once,
> multiple queries cannot be sent over a busy connection. If a query is
> sent while the connection is busy, it waits until the last query is
> finished and discards all its results." Which sounds like threads ->
> multiple connections to not run into that problem.
>
>
> Wouldn't there still be the same issue though?
>
> If several threads of PHP are all trying to connect to to a database that can only handle a finite number of connections, the database must still wait until a query has been pushed off of it's queue before it can process another. As far as I can see, this isn't an issue that can be solved by threading in PHP, but by allowing more concurrent connections in the database.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>

That's why I asked about the DB utilization earlier. Since the having
the threads can open multiple connections and finish the request
sooner, it can move on to the next request. Since Java & ASP.NET have
connection pooling, this adds to benefit of threads even more. I
don't know if PHP has connection pooling now. I haven't code in PHP a
some years.

Regards,
Tommy