Re: [Sqlrelay-discussion] performance statistics
Brought to you by:
mused
|
From: Devananda <kar...@ya...> - 2006-04-20 07:51:59
|
Devananda wrote: > Rodney Holm wrote: >> Here is a short thread regarding the implementation of statistics >> gathering. >> >> Unfortunately Im not able to work on this anytime soon, hopefully >> this information will come in handy to others looking to add this >> most desirable feature to sqlrelay. >> > Rodney, > > Thank you for sending me that thread. It gave me a starting point, and > I've been digging into the source for a few hours now. I've reached a > bit of a wall, however -- how does the sqlrconnection class relate to > the sqlrconnection_svr class? My understanding of it is that the > former is instantiated w/in each API's library and used to connect to > the sqlr connection daemon, whereas the latter is how each sqlr > connection daemon actually connects to the particular database server. > > I was hoping to modify the sqlrsh tool just enough to get it to read > info from the shared memory segment, but am having (most likely > conceptual) trouble figuring out how to get that information -- sqlrsh > only has an instance of sqlrconnection, so I'm guessing that I will > need to create interfaces in both these classes to request/receive the > status data which will be stored in the shared mem segment. > > Any thoughts? > > Regards, > Devananda I was looking at this from the wrong perspective initially. While I'm sure there's plenty of room for improvement in what I've done, I do have a working CLI program which reads from the shmdata, and I have modified the mysql connector to update that data as appropriate. Feels like quite a triumph, tbh - it's been about 7 years since I wrote any serious c/c++! In brief, what I've done is create another 'connections' class called "status", with nearly all the functions replaced by stubs. I rearranged sqlrconnection_svr::initConnection() slightly, so that the shared memory is initialized before the attempt (or failure) to connect to the actual database, thus allowing the status class access to shared memory even though it will not connect to any database. Of course, I added some counters to the shmdata struct itself. Adding counters, and enabling other connectors to interact with the counters should be very simple -- within any class derived from sqlrconnection_svr, it is "statistics->$param(++|--)", and within a class derived from sqlrcursor_svr, it is "conn->statistics->$param(++|--)". What is the proper way for me to upload and share these changes? I have a sourceforge cvs account already (I created a module for mysql administration, http://sourceforge.net/projects/mycat/, though work has kept me from updating that project recently). If it's better that I create a diff and send that, or something else, let me know. Cheers, Devananda |