Re: Package proposal: PHP mysqlnd connection multiplexing plugin

From: Date: Sat, 25 Aug 2012 22:22:34 +0000
Subject: Re: Package proposal: PHP mysqlnd connection multiplexing plugin
References: 1 2 3 4  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-9734@lists.php.net to get a copy of this message
Hi, On 08/25/2012 11:20 PM, Guillaume Rossolini wrote:
Hi, As I understand them, prepared statements are compiled once per connection with regards to the query plan. I guess using this extension would mean prepared statements would be compiled only once per connection pool in a different way the query cache works, is that right? In that sense, I can see great value for a multiplexed connection able to use prepared statements.
yes, the MySQL server compiles a statement per connection, there is no global PS cache in the server. In PECL there is already mysqlnd_pscache which tries to find a solution to the problem of preparing statement by caching them, for the next time one needs the same statement. When combined with persistent connections it should preserver the compiled state between requests. MUX is a bit different, it shares connection between different requests, in parallel. Now, because different requests don't know about others existence they can prepare the same statement over and over, and because there isn't a thread ps cache in the server (not any that I am aware of), every request/script will allocate memory for the same statement. Now, the mashup will be mysqlnd_pscache or its idea and mysqlnd_mux together. It is well known that the MySQL parser is not lightning fast, PS is a solution but preparing needs trips to the server and back, with a cache this will be saved and parsing is skipped. Best, Andrey
Best regards, -- Guillaume Rossolini On Fri, Aug 24, 2012 at 8:32 PM, Johannes Schlüter < johannes.schlueter@oracle.com> wrote:
On Fri, 2012-08-24 at 20:20 +0400, Alexey Zakhlestin wrote:
On 24.08.2012, at 17:14, Ulf Wendel <ulf.wendel@oracle.com> wrote:
The PDO_MySQL calls PDO::query(), PDO::exec(), PDO::prepare() are covered, if PDO::ATTR_EMULATE_PREPARES is set. Although this should cover many use cases it does not cover all.
So, it won't work with real prepared statements. Right? Is that temporary limitation?
Yes that is a current limitation. Doing multiplexing with prepared statements is a bit more complicated as one has to do more house keeping in order to make sure statement handles match and we're not wasting resources by keeping handles at life for too long. The initial release is to see whether there is potential for this at all. Depending on the feedback we might extend it, or maybe somebody from the community loves it and wants to extend it. johannes -- MySQL Engineering, MySQL Connectors Team ORACLE Deutschland B.V. & Co. KG, Riesstr. 25, D-80992 München Registergericht: Amtsgericht München, HRA 95603 -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pecl.dev (#9734) next »