Re: OS X Socket Performance
Re: OS X Socket Performance
- Subject: Re: OS X Socket Performance
- From: Peter Sichel <email@hidden>
- Date: Tue, 10 Sep 2002 09:51:24 -0400
At 3:21 AM -0400 9/10/02, Peter Sichel wrote:
Assuming good design, the performance hit of using Objective-C
is negligible. The latency of multiple ICMP listeners or using
Distributed Objects and run loops needs to be considered more
carefully. The important thing is to match the design to what
you are trying to accomplish.
Perhaps I could elaborate on this to be more insightful.
The issue with multiple ICMP listeners, Distributed Objects,
or Run Loops is that you are waiting for the kernel to schedule
your thread to perform some processing. This adds milliseconds
to the latency of responding. Obviously you want as few of these
scheduling delays as possible per network transaction.
In the direct BSD sockets case, you need only one scheduling
delay to awake from select(), at which point your thread can handle
as many network transactions as are pending.
[In the Open Transport case, you don't even have to wait for
the kernel to schedule you if your notifier responds
at interrupt time, but this is tricky to code.]
When using CFSockets, there is one scheduling delay for the
shared CFSockets thread to awake from select(), and another
scheduling delay to wake the Run Loop of the main thread. This adds
some latency, but is not too serious as long as CFSockets and
your Run Loop are designed to handle all the network transactions
that are pending.
What you don't want to do if performance matters is impose
one or more kernel scheduling delays for each network transaction.
To reach 2000 connections per second, you need to handle 10 or 20
connections each time your thread awakes from select().
It should be possible to examine any of the Objective-C BSD Sockets
frameworks to verify whether they allow multiple network transactions
per kernel scheduling delay. If not, the framework will be slow
compared to using BSD Sockets directly from C or Objective-C.
- Peter
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.