Thursday, January 15, 2009

MySQL Proxy is back


MySQL Proxy

MySQL Proxy is back. After a long hiatus due to many deadlines in the Proxy team, the GPL version of MySQL Proxy has been updated.
The most important news is the location. Proxy is now hosted on Launchpad, like many more MySQL related projects, and MySQL code itself.

Kay and Jan announced and commented the changes. The repository is now on Bazaar, and there are rules for contributions.
On the technical side, the differences are quite a lot, although the changes are not documented yet. So I am exploring and reporting my findings while I meet them.
The architecture has changed. The Proxy has been split into plugins, to make it more manageable.
The admin interface, as explained in the manual, is gone. Instead, there is a plugin, and you can design your own or expand the existing one (which does very little.) For example, from the code directory, after compiling, you could try this one:
./src/mysql-proxy --plugin-dir=$PWD/plugins/ \
--admin-lua-script=$PWD/lib/admin.lua
The only command enabled is SELECT * FROM backends (case sensitive). To use the admin interface now you need to provide a username and a password (default: root/secret).
$ mysql -h 127.0.0.1 -P 4041 -u root -psecret
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.99-agent-admin

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SELECT * FROM backends;
+-------------+----------------+-------+------+
| backend_ndx | address | state | type |
+-------------+----------------+-------+------+
| 1 | 127.0.0.1:3306 | 0 | 1 |
+-------------+----------------+-------+------+
1 row in set (0.00 sec)
Another important change is an option governing the amount of information from the Proxy. By default, the Proxy is silent. If you want to see warnings and errors, you must use the option
--log-level=(error|warning|info|message|debug)
Performance has been increased as well, by skipping result sets by default. If you really need a result set to be used in a Lua script, now you need to say it explicitly. When you append a query to the query queue, you must add {resultset_is_needed = true } as third parameter. If you don't the resultset is not made available to read_query_result().
There are more news, related to load balancing and query splitting, but I will report on that some other time.

3 comments:

Unknown said...

Thats a great news! but when will we get a community release? I have been waiting for a long time for 0.7.0..

Unknown said...

Will the MySQL Forge discussions be pulled into the new site at all? I'm glad to hear that some work is being done on it, but also disappointed that it hasn't come further...

Kay said...

We are looking at doing a webinar to address all these questions soon.
The MySQL Forge pages will remain, if only for the reason that Launchpad does not have a Wiki. This switch to Launchpad was mostly about making the code more accessible and not about moving the entire Proxy project there (note that we are still using the bugs.mysql.com bug tracker and not Launchpad's for example).