Last Comment Bug 13009 - service manager has too many locks
: service manager has too many locks
: perf
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: All All
P2 major (vote)
: mozilla0.9.9
Assigned To: neeti
: gerardok
: Nathan Froyd [:froydnj]
Depends on:
Blocks: 98275 104166
  Show dependency treegraph
Reported: 1999-09-02 00:43 PDT by Chris Waterson
Modified: 2017-02-03 12:36 PST (History)
7 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Chris Waterson 1999-09-02 00:43:41 PDT
The service manager has APIs that are protected by a monitor, as well as using
a threadsafe hashtable for internal use. Travis said "service manager is
dying", so I'm handing him this bundle o' joy to remind him that the new
incarnation shouldn't do that.
Comment 1 User image travis 1999-09-07 12:03:59 PDT
This probably belongs to you dp as you are the one working on that side of the
service manager.
Comment 2 User image Suresh Duddi (gone) 1999-10-03 07:58:59 PDT
It might take a while before the servicemanager goes away. In the mean time, any
suggestions for improvement here.
Comment 3 User image Suresh Duddi (gone) 1999-10-19 14:54:59 PDT
This is a performance bottleneck. We should see if we can eliminate the
excessive locking.
Comment 4 User image Warren Harris 1999-10-19 18:11:59 PDT
If the service manager entry points are protected by a lock, the hashtable
doesn't need to use one. I see line 180 of nsServiceManager.cpp says "Get a
threadSafe hashtable" which may not be necessary any more. I'd investigate
setting that parameter to false.
Comment 5 User image Suresh Duddi (gone) 1999-10-19 18:20:59 PDT
Just curious, why are you eliminating the other case: remove locks from apis and
protect the data (hashtable entries).
Comment 6 User image daver 1999-10-20 13:48:59 PDT
performance team should nominate this to make it happen.
Comment 7 User image daver 1999-10-20 13:49:59 PDT
Correction, performance team should nominate this IF they want to make it
Comment 8 User image Suresh Duddi (gone) 1999-10-21 10:44:59 PDT
Performance guys, can you evaluate this and let us know if we should fix it.
Comment 9 User image Suresh Duddi (gone) 2000-01-16 20:26:59 PST
whatever. We are going to leave it like this for a while.
Comment 10 User image leger 2000-01-18 11:55:59 PST
Moving "perf" to keyword field.  This is the are we use now :-)
Comment 11 User image Peter Trudelle 2000-01-26 19:15:04 PST
moving from leftover dogfood to beta1 radar per beta criteria priority #2
Comment 12 User image leger 2000-01-27 17:05:38 PST
Need to quanify what impact this has on the spec and where you think it will 
help and how much please.
Comment 13 User image Mike Shaver (:shaver -- probably not reading bugmail closely) 2000-01-27 17:18:55 PST
Where is the spec?
Comment 14 User image Suresh Duddi (gone) 2000-01-28 00:51:25 PST
This bug came out of the timing analysis done by the performance effort. I am 
sure this was a blaring number and hence the bug. We need to quantify to really 
get the number by which this is a problem and further by how much we can reduce 
it since there is no way we can eliminate all the locks.

I know this doesn't help much. Just thinking aloud at this point. My general 
sense was that this wont improve performance a great deal. So let us go after 
bigger fish...
Comment 15 User image leger 2000-01-28 17:06:42 PST
Putting on PDT- radar for beta1.  If you have date to make a better call, let us 
know - pdt
Comment 16 User image Warren Harris 2000-02-08 01:37:25 PST
A recent Quantify run shows that GetService accounts for 15.18% of total 
runtime. The enter/exit monitors there account for about 2% of that.

The service manager also uses a threadsafe hashtable, which accounts for 
another 1%. That hashtable is threadsafe (unnecessarily?), and 44% of all time 
spent in nsHashtable::Get is entering and exiting the lock. 

Attempting to calculate this all out, I come up with (.02 + .44 * .01) * .15 
==> .366% of execution time manipulating these locks. However, the simple fix 
is probably to change the flag passed to the hashtable constructor to make it 
not be threadsafe since the higher level locks are already protecting it.
Comment 17 User image Jim Roskind 2000-02-08 23:17:55 PST
Based on Warren's analysis, there is a tiny .366% gain (even if we got it down 
to zero locks) and notable risk.  PDT gave this a PDT- for beta1.
Comment 18 User image leger 2000-06-13 18:40:28 PDT
Moving all current open XPCOM and XPCOM Registry bugs to rayw since dp is on 
sabbatical.  rayw is now default assignee for these components.
Comment 19 User image Warren Harris 2000-10-17 20:26:17 PDT
Assigning rest of xpcom stuff to myself (from Ray).
Comment 20 User image chris hofmann 2001-03-19 14:54:37 PST
-> kandrot 

now is a good time for smaller and larger perf wins...
Comment 21 User image Doug Turner (:dougt) 2001-08-28 09:18:59 PDT
reassign all kandrot xpcom bug.
Comment 22 User image Doug Turner (:dougt) 2001-10-01 14:09:19 PDT
neeti is working on this as part of her cleanup/performance work in xpcom.
Comment 23 User image Henry Jia 2001-12-04 00:27:50 PST
Add myself to the CC list. I'll try to see if I can do some work on it.
Comment 24 User image neeti 2002-02-12 12:52:05 PST
This was fixed by bug 96461. nsComponentManager now uses PLDHashtable, instead 
of the threadsafe version of nsHashtable.

Note You need to log in before you can comment on or make changes to this bug.