• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Efficient UDP processing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Efficient UDP processing


  • Subject: Re: Efficient UDP processing
  • From: Laurence Flath <email@hidden>
  • Date: Sun, 22 Jan 2006 12:36:01 -0800


On Jan 21, 2006, at 8:05 PM, Glenn Anderson wrote:

How exactly are you using the standard socket APIs?


Serious pseudo-code, but this is basically it:

Initialize:

    socket()
    bind()

Loop:

    while (1)
    {
        recvfrom()

        // parse  packet, some simple calcs

        bcopy()
    }


Do I need to packet-filter in a NKE? Are there any ways to DMA the packet's payload into said buffer? This seems a lot like writing a VNC client ... except that I can't afford to lose any packets.

Probably overkill, not to mention more complicated. While using sockets you will end up with two copies going on, one for the recv, and another to copy to the memory buffer, G4 class machines have more than enough memory bandwidth and CPU horsepower to deal with 100MB/sec worth of data.


If you need to squeeze a bit more performance out, you might be able to optimize things so that the buffer you use for recv is aligned such that the data you are copying out in to the memory buffer is aligned to a cache line, or at least 16 bytes. If the protocol makes any effort to send nicely sized chunks (eg: multiples of 16 bytes) you may be able to do an AltiVec or SSE optimized copy.


Agreed. I really don't want to go into kernel space; just checking to see if there are serious economies for doing so.


Shark is indicating most of the time is spent in recvfrom. I'll try out your suggestions (combined with Peter's), and follow up.

Thank you!

Laurence
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Efficient UDP processing (From: Laurence Flath <email@hidden>)
 >Re: Efficient UDP processing (From: Glenn Anderson <email@hidden>)

  • Prev by Date: Re: Why would CFReadStreamSetProperty return FALSE?
  • Next by Date: data into mbufs
  • Previous by thread: Re: Efficient UDP processing
  • Next by thread: Re: Efficient UDP processing
  • Index(es):
    • Date
    • Thread