Hi Qianqian Bu!

On 12.08.2019 at 05:03, Qianqian Bu via pecl-dev wrote:

> Hi Christoph,
> 
> Thanks so much for your checking and response. For the code repo, we 
> currently have  a private github repo which is currently on-going legal 
> review and will be publicly accessible in near future.  I think it will be 
> suitable to hold the code, I'll update with you when it is ready.  And I'll 
> try to generate package.xml later. There is a change for the extension 
> implementation, that is we decide to rename the extension with name from 
> mysqlnd_rd to mysqlnd_azure, may I ask does the name sound good to you? 

I have no objections regarding the name.

Regards,
Christoph

> Thanks & Best Regards,
> Qianqian Bu
> 
> -----Original 
> Message------------------------------------------------------------------------------------------------
> From: Christoph M. Becker <cmbecke...@gmx.de> 
> Sent: Wednesday, August 7, 2019 5:23 PM
> To: Qianqian Bu <qianqian...@microsoft.com>; pecl-dev@lists.php.net
> Cc: Hong Wang (R&D) <how...@microsoft.com>; Hang Zhang <h...@microsoft.com>; 
> Xiangyu Hu <xiangyu...@microsoft.com>; Shuode Li <shu...@microsoft.com>
> Subject: Re: Request for submitting a PECL extension which uses mysqlnd 
> plugin APIand enables redirection functionality for MySQL servers
> 
> Hi!
> 
> On 07.08.2019 at 10:03, Qianqian Bu via pecl-dev wrote:
> 
>> Dear Madam/Sir,
>>
>> My name is Qianqian Bu, I'm from Microsoft company and recently work on a 
>> project which enables redirection functionality for MySQL servers using PHP 
>> mysqlnd driver. The functionality has been implemented as a PHP extension 
>> using mysqlnd plugin API, and I'd like to request submitting it to PECL 
>> website.
>>
>> There is a document 
>> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fjira.mariadb.org%2Fbrowse%2FMDEV-15935&amp;data=02%7C01%7CQianqian.Bu%40microsoft.com%7C0736718e02e74fc3508908d71b18d98b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637007665863340235&amp;sdata=dTaKf5DPT9aYnG4onIJFg50yXqhgo71dth5l%2FQncaqc%3D&amp;reserved=0
>>   for MariaDB Connector J for the same purpose which you may use as a 
>> reference. The document gives the purpose and initial approach. The final 
>> implementation takes use of the message field of OK packet, server fills the 
>> message field with redirection information, then driver side needs extract 
>> the information and use it to establish a new connection. There is a ongoing 
>> pull request 
>> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMariaDB%2Fmariadb-connector-j%2Fpull%2F134&amp;data=02%7C01%7CQianqian.Bu%40microsoft.com%7C0736718e02e74fc3508908d71b18d98b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637007665863340235&amp;sdata=FSJAt3DWpza0mJmJRhIsld1jKmtx8U0cM%2BUS%2F0hDYTM%3D&amp;reserved=0
>>   for MariaDB Connector J for this, which you may also use as a reference. 
>> Following is the detailed description of the scenario and extension solution 
>> for PHP mysqlnd.
>>
>> Scenario (same as described in MDEV-15935):
>> Currently when multiple servers share one proxy, proxy forwards all the 
>> packets between servers and clients. Thus, the proxy adds latency, take many 
>> computing resources and impacts the overall performance. Especially for 
>> short connections scenarios like WordPress, the latency can be a critical 
>> issue.
>> Supporting redirection mechanism is helpful for proxy-based scenario. It is 
>> more like HTTP redirects or Oracle redirected connections. Clients get the 
>> servers' address from proxies and connect to servers transparently without 
>> latency and computing resource wasted.
>>
>> Extension solution:
>> We implement the solution as a PECL style extension using mysqlnd plugin 
>> API, and the basic idea is modifying the MYSQLND_METHOD(mysqlnd_data, 
>> connect) method, make it possible to establish a new connection based on the 
>> redirection information provided by the response OK packet in the last 
>> message field, and use the new connection if connection succeed. And then 
>> cache the redirection information, so next time, it only need one 
>> establishment phase to connect to MySQL server.
>> There are three MYSQLND_METHOD  methods replaced as follows:
>> conn_m->connect = MYSQLND_METHOD(mysqlnd_rd, connect); 
>> conn_d_m->connect = MYSQLND_METHOD(mysqlnd_rd_data, connect); 
>> conn_d_m->dtor = MYSQLND_METHOD_PRIVATE(mysqlnd_rd_data, dtor);
>>
>> And I've modified the interface of MYSQLND_METHOD(mysqlnd_rd_data, connect) 
>> a little, make the first parameter as MYSQLND_CONN_DATA ** instead of 
>> MYSQLND_CONN_DATA *, so I can modify the content of the connection object 
>> the pointer points to.
>> After the first connection established and before send the init_command 
>> which may update last message field:
>>        {
>>               const MYSQLND_CSTRING scheme = { transport.s, transport.l };
>>               if (FAIL == conn->m->connect_handshake(conn, &scheme, 
>> &username, &password, &database, mysql_flags)) {
>>                      goto err;
>>               }
>>        }
>> Try to establish a new connection:
>>                 enum_func_status redirectState = 
>> redirect_conn->m->connect_handshake(redirect_conn, &redirect_scheme, 
>> &redirect_username, &password, &database, mysql_flags); If succeeds, close 
>> the original connection, and update the connection information:
>>        conn->m->send_close(conn);
>>        conn->m->dtor(conn);
>>        ...
>>        conn = redirect_conn;
>>        ...
>> *pconn = redirect_conn; //use new conn outside for caller
>>        ...
>>        hostname = redirect_hostname;
>>        username = redirect_username;
>>        port = ui_redirect_port;
> 
> Thanks for the detailed explanation.  From what I can tell, this looks good 
> to me.
> 
>> I've presented the code to @Christoph Becker (HAYS Professional Solutions 
>> GM)<mailto:a-chb...@microsoft.com> before. Since currently the code is hold 
>> on a private repository, and there is a limit foe email size so I cannot add 
>> it in the attachment, may I ask how should I present the code to you?
> 
> One option could be to move it to a public Github repository.  Some other 
> PECL extensions are also hosted there (e.g. Imagick[1]).
> 
>> The code does not have a package.xml yet, from 
>> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpear.php.net%2Fmanual%2Fen%2Fpyrus.commands.pickle.php&amp;data=02%7C01%7CQianqian.Bu%40microsoft.com%7C0736718e02e74fc3508908d71b18d98b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637007665863350243&amp;sdata=RrekeEoicjRj04VpCiX3tJsfmzyBB42bfmHeV6vpZYU%3D&amp;reserved=0
>>  it says that I can use picke with pyrus.phar to generate the package file, 
>> but it seems pyrus.phar cannot work with PHP7. I cannot find pyrus.phar from 
>> pear2.php.net as described on 
>> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpear.php.net%2Fmanual%2Fen%2Finstallationpyrus.introduction.php&amp;data=02%7C01%7CQianqian.Bu%40microsoft.com%7C0736718e02e74fc3508908d71b18d98b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637007665863350243&amp;sdata=xl1Ndqqb91yp7bYXDjIPl7CalgFiTrikdzJb5HagRfc%3D&amp;reserved=0,
>>  and the download version from 
>> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpyrus%2FPyrus&amp;data=02%7C01%7CQianqian.Bu%40microsoft.com%7C0736718e02e74fc3508908d71b18d98b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637007665863350243&amp;sdata=yfKUCtIP6HUxFwbCyaxXde7dsw%2B3hU%2BzgfUZ12gFH%2BI%3D&amp;reserved=0
>>  does not work, and the repo has not been updated for many years. May I ask 
>> can you give me some help about how to generate the package.xml file?
> 
> I've filed a bug report regarding the obviously out-dated Pyrus 
> documentation[2].  It seems to me that you would have to write the 
> package.xml manually. :(
> 
> [1] 
> <https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FImagick%2Fimagick&amp;data=02%7C01%7CQianqian.Bu%40microsoft.com%7C0736718e02e74fc3508908d71b18d98b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637007665863350243&amp;sdata=zFmjh%2BEm0vPssYbBV6bWpJaZ%2Bynsg%2BqJdsyv0rh2b2M%3D&amp;reserved=0>
> [2] 
> <https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpear.php.net%2Fbugs%2Fbug.php%3Fid%3D23840&amp;data=02%7C01%7CQianqian.Bu%40microsoft.com%7C0736718e02e74fc3508908d71b18d98b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637007665863350243&amp;sdata=CkJnl9eSP5W2ZR76p4x9jJg00NbVwCs%2FiSY2AY4FOJ4%3D&amp;reserved=0>
> 
> Thanks,
> Christoph
> 

Reply via email to