Skip to content
  • Marc Alff's avatar
    6d113758
    Bug#12346211 PERF IMPACT OF PERFORMANCE-SCHEMA WITH DISABLED INSTRUMENTS/CONSUMERS · 6d113758
    Marc Alff authored
    Performance improvement #2: Flags denormalization.
    
    In the performance schema implementation,
    in storage/perfschema/,
    implemented the following changes.
    
    1) Define pre compiled instance flags.
    
    Before, in pfs.cc, to check if a mutex event is enabled, the code did:
    - Get the PFS_mutex_class from the PFS_mutex
    - check the PFS_mutex_class::m_enabled flag
    - check the flag_global_instrumentation consumer flag.
    
    This costs:
    - several memory access to follow pointers,
    - several tests
    
    With this fix, a pre compiled flag is maintained:
    - PFS_mutex::m_enabled
    that indicates if an event on a mutex instance is enabled or not.
    
    A single test is now sufficient in get_thread_mutex_locker().
    
    Because PFS_mutex::m_enabled is a pre compiled value,
    it needs to be refreshed each time:
    - setup_instruments changes for the mutex class
    - setup_consumers changes for the global_instrumentation consumer.
    
    Table setup_instruments and setup_consumers now 
    do update all derived flags when a setup value is changed.
    
    Similar changes have been implemented for other instrument type:
    - rwlock
    - cond
    - file
    using the same pattern.
    
    2) Define pre compiled table_share flags.
    
    Similar to 1) for PFS_table_share::m_enabled and m_timed.
    
    PFS_table_share::m_enabled is computed from the rules in
    performance_schema.setup_objects.
    
    3) Define pre compiled table handle flags.
    
    Similar to 1) for PFS_table::m_io_enabled and related.
    
    4) Packed performance schema internal structures
    
    Reordered members, removed unused members.
    
    5) Removed the setup objects cache.
    
    Using denormalized flags is a "push" design,
    where the thread that changes setup_* tables pushes
    all changes to internal structures.
    
    The setup object cache was a "pull" design,
    where a thread executing instrumented code had to pull
    data from different places at runtime,
    to maintain internal structures.
    
    The setup object cache has been removed.
    6d113758
    Bug#12346211 PERF IMPACT OF PERFORMANCE-SCHEMA WITH DISABLED INSTRUMENTS/CONSUMERS
    Marc Alff authored
    Performance improvement #2: Flags denormalization.
    
    In the performance schema implementation,
    in storage/perfschema/,
    implemented the following changes.
    
    1) Define pre compiled instance flags.
    
    Before, in pfs.cc, to check if a mutex event is enabled, the code did:
    - Get the PFS_mutex_class from the PFS_mutex
    - check the PFS_mutex_class::m_enabled flag
    - check the flag_global_instrumentation consumer flag.
    
    This costs:
    - several memory access to follow pointers,
    - several tests
    
    With this fix, a pre compiled flag is maintained:
    - PFS_mutex::m_enabled
    that indicates if an event on a mutex instance is enabled or not.
    
    A single test is now sufficient in get_thread_mutex_locker().
    
    Because PFS_mutex::m_enabled is a pre compiled value,
    it needs to be refreshed each time:
    - setup_instruments changes for the mutex class
    - setup_consumers changes for the global_instrumentation consumer.
    
    Table setup_instruments and setup_consumers now 
    do update all derived flags when a setup value is changed.
    
    Similar changes have been implemented for other instrument type:
    - rwlock
    - cond
    - file
    using the same pattern.
    
    2) Define pre compiled table_share flags.
    
    Similar to 1) for PFS_table_share::m_enabled and m_timed.
    
    PFS_table_share::m_enabled is computed from the rules in
    performance_schema.setup_objects.
    
    3) Define pre compiled table handle flags.
    
    Similar to 1) for PFS_table::m_io_enabled and related.
    
    4) Packed performance schema internal structures
    
    Reordered members, removed unused members.
    
    5) Removed the setup objects cache.
    
    Using denormalized flags is a "push" design,
    where the thread that changes setup_* tables pushes
    all changes to internal structures.
    
    The setup object cache was a "pull" design,
    where a thread executing instrumented code had to pull
    data from different places at runtime,
    to maintain internal structures.
    
    The setup object cache has been removed.
Loading