MySQL Proxy: a chassis and a MySQL-server
December 2nd, 2007
At MySQL I'm writing several different command-line applications from the MEMo Agent to the MySQL Proxy. They all have a common set of requirement:
- command-line options
- config-files (mapping cmd-line options to config-files)
- logfile handling (syslog, SIGHUP, ...)
- a mainloop (SIGINT, CtrlHandler, ...)
- daemonizing (daemonize, services, ...)
- plugin handling
In the proxy svn you see all this a the chassis of the proxy.
At the side it has a MySQL-Server and a MySQL-Client (we usually call it the proxy). Currently this is implemented as libmysql-proxy which is then used by the proxy plugin to implement the proxy.
By splitting up the design into 3 different layers:
- chassis
- low-level protocol + protocol states
- proxy implementation as plugin
we can
- use the chassis for any kind of application
- implement MySQL apps based indepenent of the proxy features
- implement plugins for the chassis which don't use MySQL
For most of the chassis I used functionality provided already by glib2:
- GOption + GKeyFile
- the log facilities
- GModule
as we don't want to invent another platform independent API.
For the future I plan to clean up the second layer a bit and perhaps write a load generator that:
- can handle more than 100 connections
- and is scripted
We already have all the parts for it.
BTW, this is 0.7.0 aka trunk. The 0.6.1 is already built, but is stuck because of problems on win32.
2 Responses to “MySQL Proxy: a chassis and a MySQL-server”
Sorry, comments are closed for this article.
December 3rd, 2007 at 02:13 AM So can you talk a little about the load generator that you are considering? Does that mean that you can use the proxy program to run test cases against a server?
December 15th, 2007 at 10:37 PM Hi Jan, I've asked this question on the forum, but with no reply, so I'm trying it directly at the source: you ;). I would like to choose a backend server based on the connecting user use MySQL Proxy. This procedure seems to be out of sequence. Function read_auth is called after connect_server. How can I retrieve the username before connecting to the server?