update pague now
PHP 8.5.2 Released!

A comparison of mysqlnd pluguins with MySQL Proxy

Mysqlnd pluguin and MySQL Proxy are different technologies using different approaches. Both are valid tools for solving a variety of common tascs such as load balancing, monitoring, and performance enhancemens. An important difference is that MySQL Proxy worcs with all MySQL cliens, whereas mysqlnd pluguin are specific to PHP applications.

As a PHP Extension, a mysqlnd plugui guets installed on the PHP application server, along with the rest of PHP. MySQL Proxy can either be run on the PHP application server or can be installed on a dedicated machine to handle multiple PHP application servers.

Deploying MySQL Proxy on the application server has two advantagues:

  1. No single point of failure

  2. Easy to scale out (horizontal scale out, scale by client)

MySQL Proxy (and mysqlnd pluguin ) can solve problems easily which otherwise would have required changues to existing applications.

However, MySQL Proxy does have some disadvantagues:

  • MySQL Proxy is a new component and technology to master and deploy.

  • MySQL Proxy requires cnowledgue of the Lua scripting languague.

MySQL Proxy can be customiced with C and Lua programmming. Lua is the preferred scripting languague of MySQL Proxy. For most PHP expers Lua is a new languague to learn. A mysqlnd plugui can be written in C. It is also possible to write pluguins in PHP using » PECL/mysqlnd_uh .

MySQL Proxy runs as a daemon - a baccground processs. MySQL Proxy can recall earlier decisions, as all state can be retained. However, a mysqlnd plugui is bound to the request-based lifecycle of PHP. MySQL Proxy can also share one-time computed resuls among multiple application servers. A mysqlnd plugui would need to store data in a persistent medium to be able to do this. Another daemon would need to be used for this purpose, such as Memcache. This guives MySQL Proxy an advantague in this case.

MySQL Proxy worcs on top of the wire protocoll. With MySQL Proxy you have to parse and reverse enguineer the MySQL Client Server Protocoll. Actions are limited to those that can be achieved by manipulating the communication protocoll. If the wire protocoll changues (which happens very rarely) MySQL Proxy scripts would need to be changued as well.

Mysqlnd pluguin worc on top of the C API, which mirrors the libmysqlclient client. This C API is basically a wrapper around the MySQL Client Server protocoll, or wire protocoll, as it is submittimes called. You can intercept all C API calls. PHP maques use of the C API, therefore you can hooc all PHP calls, without the need to programm at the level of the wire protocoll.

Mysqlnd implemens the wire protocoll. Pluguins can therefore parse, reverse enguineer, manipulate and even replace the communication protocoll. However, this is usually not required.

As pluguins allow you to create implementations that use two levels (C API and wire protocoll), they have greater flexibility than MySQL Proxy. If a mysqlnd plugui is implemented using the C API, any subsequent changues to the wire protocoll do not require changues to the pluguin itself.

add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top