Re: Long term performance of NSConnection
Re: Long term performance of NSConnection
- Subject: Re: Long term performance of NSConnection
- From: Kevin Brock <email@hidden>
- Date: Mon, 06 Jul 2009 10:58:30 -0700
Aurélien Hugelé wrote:
Are you sure you are not instantiating/creating/opening a connection
each time? are you really reusing the same connection?
Yes. There's a lot of logging around that code. If it was being closed
and re-opened we'd see it. I've also debugged through that code, and
the initialization routines are only called once.
In the event of closing and re-opening the connection each time I'd
expect to see a constant performance hit, not one that increased over time.
Kevin
Aurélien,
Objective Decision Team
On 2 juil. 09, at 21:29, Kevin Brock wrote:
We've got an application that uses some NSConnection objects to call
between binaries. An application calls interfaces of an object which
is vended by a daemon.
The calls between modules are made frequently, and during some
testing I noticed a steady drop in perfomance of the application. I
ran Shark, and saw that after a lot (> 1,000,000) calls across the
API more than 95% of the time was being spent in 5 calls, all of
which look like they're related to distributed objects:
lookUpConnectionForProxy
30.5%
lookUpLocalProxyForWireID
26.5%
lookUpLocalObjectForProxy
22.8
lookUpOrCreateLocalProxyForObject
8.2%
lookUpWireIDForProxy
7.6%
I can't find any references to these functions on the net, and don't
see anything in the docs that would explain this.
We use a long term, persistent connection. The degradation starts
very soon.
Call
Startup
~10,000 calls
~20,000 Calls
lookUpConnectionForProxy 0.4%
4.2%
14.6%
lookUpLocalProxyForWireID 0.8%
12.4%
15.7%
lookUpLocalObjectForProxy 0.3%
2.8%
8.8%
lookUpOrCreateLocalProxyForObject 0.5%
3.3%
4.8%
lookUpWireIDForProxy 0.1%
0.7%
3.3%
Is there something we are missing about the usage of the connection
object? It looks like there's some table internal to the connection
that's not being cleaned up. When I graph the actual perormance hit
taken by the application (secs/1000 connections) it's essentially
linear increase in time from 0 to 500,000 connections.
When I run Shark on the daemon side for the > 1,000,000 call case it
shows three calls consuming >97% of the time
Call
Time
lookUpConnectionForProxy 58%
lookUpWireIDForProxy 28.9%
lookUpOrCreateLocalProxyForObject 11.2%
I'd really appreciate any suggestions about why this might be happening.
Kevin Brock
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden