Bug #118724 optimzie for performance_schema
Submitted: 26 Jul 12:08 Modified: 11 Aug 12:05
Reporter: alex xing (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S5 (Performance)
Version:8.0.42 OS:Any
Assigned to: CPU Architecture:Any

[26 Jul 12:08] alex xing
Description:
Our online service constantly handles a large volume of short-lived connections (5000+). Compared to long-lived connections, we've found that find_thread_by_internal_id consumes a significant amount of CPU.

After analyzing the code, we discovered that find_thread_by_internal_id is invoked for every new connection and performs a traversal over a large array.

How to repeat:
just read the code or test mysqld with a large volume of short-lived connections (5000+)

Suggested fix:
To optimize performance, we could maintain an additional lookup map to reduce the traversal overhead.
[11 Aug 12:05] MySQL Verification Team
Hello Alex Xing,

Thank you for the report and feedback.

regards,
umesh