CPU Hog by control-node in membership manager
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Juniper Openstack | Status tracked in Trunk | |||||
R3.1 |
Fix Committed
|
High
|
Ananth Suryanarayana | |||
R3.1.1.x |
Won't Fix
|
High
|
Ananth Suryanarayana | |||
R3.2 |
Fix Committed
|
High
|
Ananth Suryanarayana | |||
R4.0 |
Fix Committed
|
High
|
Ananth Suryanarayana | |||
Trunk |
Fix Committed
|
High
|
Ananth Suryanarayana |
Bug Description
This cpu hog issue was originally reported by Vinoth Kannan Ganapathy <email address hidden> and Senthilnathan Murugappan <email address hidden>
Do not call std::list::size() repeatedly as it may not run in O(1) time
Until C++11, std::list::size() complexity is not necessarily O(1). It could O(N)
as it computes size() as std::distance(
list.
In membership manager code, there are asserts() to verify equality for sets and
maps which contain the same elements. This can churn cpu, especially when there
is a very large number of RibStates to process.
Fixed by maintaining a counter per std::list in membership manager code itself.
TODO Scan entire contrail-code base for std::list::size() and apply similar fix.
Reference: http://
e.g.
Thread 9 (Thread 0x7fb2c4e6f700 (LWP 16842)):
Python Exception <class 'ValueError'> Cannot find type std::_List_
#0 __distance<
#1 distance<
#2 size (this=0x310ee78) at /usr/include/
#3 BgpMembershipMa
#4 0x000000000089f7a8 in BgpMembershipMa
#5 0x00000000006e3c27 in operator() (this=<optimized out>) at /usr/include/
#6 TaskTrigger:
#7 0x00000000006db4c7 in TaskImpl::execute (this=0x7fb2aee
#8 0x00007fb2cebd5b3a in ?? () from /usr/lib/
#9 0x00007fb2cebd1816 in ?? () from /usr/lib/
#10 0x00007fb2cebd0f4b in ?? () from /usr/lib/
#11 0x00007fb2cebcd0ff in ?? () from /usr/lib/
#12 0x00007fb2cebcd2f9 in ?? () from /usr/lib/
#13 0x00007fb2cedf1184 in start_thread () from /lib/x86_
#14 0x00007fb2cdec237d in clone () from /lib/x86_
Review in progress for https:/ /review. opencontrail. org/33958
Submitter: Ananth Suryanarayana (<email address hidden>)