List:Commits« Previous MessageNext Message »
From:Marc Alff Date:April 7 2009 4:13pm
Subject:Re: [Fwd: Review of the performance schema instrumentation interface
View as plain text  
Hi Guilhem

Guilhem Bichot wrote:
> Hello,
> 
> Marc Alff a écrit, Le 23.03.2009 18:34:
>> Hi Guilhem & All
>>
>> Guilhem Bichot wrote:
>>> Hi Marc,
>>>
>>> You once explained that the data used by the Perf Schema is all-static,
>>> allocated at startup. What happens if, after startup, a client does
>>> "INSTALL PLUGIN a_plugin;"
>>> and this plugin features your instrumentation?
>>> Will the plugin's instrumented data be properly reported, or ignored?
>>> Does a concurrent SELECT from the Perf Schema risk reading something
>>> wrong?
>>> What about UNINSTALL PLUGIN?
>>>
>>
>> Let's assume that the server has room for 200 mutex instruments, for
>> example because it was started with:
>>
>> ./mysqld --performance-schema-max-mutex-instruments=200
>>
>> Let's assume 150 mutex instruments have been loaded already.
>>
>> Let's assume "a_plugin" contains 40 mutex instruments.
>> Let's assume "b_plugin" contains 20 mutex instruments.
>>
>> INSTALL PLUGIN a_plugin
>> --> the server now has 150+40 = 190 mutex instruments.
>>
>> UNINSTALL PLUGIN a_plugin
>> --> the server still has 190 instruments
>> All the historical data generated by the plugin code is still available
> 
> And thus, room in mutex_info_array (for example) is never freed, and as
> you explained, takes up space which the next to-be-installed plugin
> cannot use.
> Is there a way to force uninstalled plugins to free space occupied in
> the above array? Is it planned?
> 

There is a way to force a plugin to not consume slots during execution
of instrumented code:
- UPDATE SETUP_INSTRUMENTS set ENABLED='NO' WHERE ...
This avoids consuming the memory allocated by --performance-schema-max-mutex

There is currently no way to prevent a plugin from consuming slots for
registering the instruments themselves, which is the memory allocated by
--performance-schema-max-mutex-instruments

I don't see this as an issue, since only a few bytes per instrument will
be used, and the number of instruments in a plugin should be very low.
There are no plans to selectively exclude instrumentation when loading a
plugin with some filtering options.

To see how much memory is used, use:

SHOW ENGINE PERFORMANCE_SCHEMA STATUS

(PFS_MUTEX_INFO).ROW_SIZE is 248 bytes

So, if a plugin has 10 instrumented mutexes, it will "waste" 2480 bytes.

The best option if space is a concern is to not use space by avoiding
loading instrumented code. Space can *never* be freed, as doing this
while the code is running and executing instrumented code will lead to
crashes.
That's not a bug, it's a conscious design choice, to have lock-free code.

The way to avoid loading instruments, if a plugin consumes too much, is
to compile the plugin --without-perfschema and load the uninstrumented code.

The plugin code may also conditionally call the PSI::register_xxx() apis
based on some option, but that's up to plugin implementor.

Regards,
-- Marc

Thread
[Fwd: Review of the performance schema instrumentation interface (was:moins de remplacements)]Marc Alff19 Mar
  • Re: [Fwd: Review of the performance schema instrumentation interface(was: moins de remplacements)]Guilhem Bichot23 Mar
    • Re: [Fwd: Review of the performance schema instrumentation interfaceMarc Alff23 Mar
      • Re: [Fwd: Review of the performance schema instrumentation interfaceGuilhem Bichot7 Apr
        • Re: [Fwd: Review of the performance schema instrumentation interfaceMarc Alff7 Apr
          • Re: [Fwd: Review of the performance schema instrumentation interfaceGuilhem Bichot7 Apr
            • Re: [Fwd: Review of the performance schema instrumentation interfaceMarc Alff7 Apr
              • Re: [Fwd: Review of the performance schema instrumentation interfaceGuilhem Bichot8 Apr
                • Re: [Fwd: Review of the performance schema instrumentation interfaceMarc Alff20 Jun
  • Instrumenting Maria system threads Re: [Fwd: Review of the performanceschema instrumentation interface (was: moins de remplacements)]Guilhem Bichot23 Mar
  • Re: Review of the performance schema instrumentation interfaceSergei Golubchik10 Apr
    • Re: Review of the performance schema instrumentation interfaceMichael Widenius13 Apr