On Aug 7, 2009, at 4:17 PM, Stewart Smith wrote:

Exactly, and I believe it's a non-starter approach for that reason
alone.

I disagree. It only needs special code to do it if you want to run
without the slight degredation of the compare... you can have a bunch of
if() there instead.

Actually my idea would be not to have the if() at all. The increment is so cheap you can do it all the time.

Either way, you incur locking and instruction costs. These costs have
been deemed too high by MySQL engineering for the hundreds (thousands?)
of metrics that the MySQL performance schema monitors (or is able to
monitor). This is likely because the frequency of certain events in the
performance schema is quite high?

Yep. Anything you're going to care about is going to be in a hot code
path.

Yes, and this is a major reason why the statistic gathering should be as lightweight as possible, especially when enabled.

But, this is OK, because this price is only paid when you are actually
profiling.

Agreed in principle, yes.

No, it's not.

It's partially paid *all the time*. Just the compare to see if profiling is on is *REALLY* expensive. You pay this price if you've compiled your
binary with profiling support - even if you never use it.

Your processor can do a LOT more NOPs per second than compares.

OK, but a non-atomic increment is also extremely lightweight. But this also means avoiding costly determination of the location to be incremented. This requires passing the Session pointer on the stack most of the time (to avoid getting a thread global pointer).

Another advantage of this approach is the performance characteristics to not change when you start to monitor the server.

So you don't have the affect that a problem goes away or moves elsewhere when you turn profiling on.


--
Paul McCullagh
PrimeBase Technologies
www.primebase.org
www.blobstreaming.org
pbxt.blogspot.com




_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to