Proof-of-concept mysqlnd plugins

A wide range of mysqlnd plugins, providing additional features are available from []. Mature, stable and ready-to-use plugins are documented in the reference manual. Those include:

* Replication and Load Balancing plugin - PECL/mysqlnd_ms

  • R/W Splitting, Failover, Load Balancing
  • Connection Service Levels, Lazy Connections

* Query Cache plugin - PECL/mysqlnd_qc

  • TTL and user-defined invalidation strategy
  • Flexible storage: MEM, APC, process memory, user-defined

* User Handler plugin - PECL/mysqlnd_uh

  • Write plugins in PHP not C
  • Basic monitoring, auditing and more

Additional, proof-of-concept plugins exist. The proof-of-concept plugins are not aimed at developers to showcase the possibilities of the mysqlnd plugin concept. They may or may not build, they may or may not be further developed. The replication and load balancing plugin is an example of a plugin that was available as a proof-of-concept long before it became of real value for end users and was released as stable.

Due to their early stage and uncertain future none of the proof-of-concept plugins is mentioned in the reference manual.

Multi Connect plugin - PECL/mysqlnd_mc

Theme: sharding, performance

The multi connect plugin splits up SELECT operations into pieces, executes the subtasks on multiple connections and joins the results in memory at the client. This approach can be useful, for example, when using manual sharding. Sharding does partition data over multiple shards. Whenever an aggregation is to be done, multiple shards have to be queried. Then the results needs to be fetched and aggregated at the client. The proof-of-concept does not support this concrete use case. It only shows how the plugin API could be used to achieve this goal.

Instead, the proof-of-concept takes a SELECT statement and adds a LIMIT clause to create subtasks. This is unlikely to result in better performance. However, from a plugin implementors point of view it makes no difference over the possibly more appealing sharding use case example.

Prepared Statement Handle Cache plugin - PECL/mysqlnd_pscache

Theme: performance

The creation of a prepared statement handle is a relatively expensive operation. It may not be as heavy weight as opening a connection but still. Tests in other environments but PHP have shown significant performance gains when pooling or caching prepared statement handles.

SQL injection protection plugin - PECL/mysqlnd_sip

Theme: security

The SQL injection protection plugin attempts to detect and block malicious SQL statements. It has two operational modes. In the learning mode it records all SQL statements and remembers them. The recorded statements are considered safe. Recoding shall be done in a safe environment, for example, in a test environment. In the operational mode the plugins verifies that all SQL statements match the lift of safe statements. All SQL statements that match are executed. The other ones are rejects. Execution is prevented.

pecl/mysqlnd_poc_plugins.txt · Last modified: 2017/09/22 13:28 by