• 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: Capping of sockets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Capping of sockets


  • Subject: Re: Capping of sockets
  • From: "David Aames" <email@hidden>
  • Date: Fri, 9 Jun 2006 23:30:10 +0100



On 6/9/06, james woodyatt <email@hidden> wrote:
[snip]

It sounds like you want to implement rate limiting in the application
layer.  The "traditional family values" approach to this problem is
not to limit the rate at which you *read* octets, but rather to limit
the rate at which you *write* them.

The algorithm you want is called a "token bucket".  Every N
milliseconds or so, you put a constant quantity of tokens "into" the
bucket.  If the bucket "overflows" you dump the "extra" tokens on the
floor.  Whenever you have octets to write, you pull enough tokens out
of the bucket to cover the cost of transmitting them.  If there
aren't enough tokens in the bucket, you queue whatever octets you
can't afford to transmit.  If the holding queue has octets in it when
it's time to add tokens to the bucket, you spend the tokens
immediately instead by transmitting from the queue.  If the holding
queue gets too long, then you either need to throttle back on the
octet source or decide which octets to drop.

Thanks for your insightful reply. I think I will manage to implement rate limitting for uploading. I've also just found an article (http://doc.trolltech.com/qq/qq17-ratecontrol.html ) which implements up/down rate limitting. The interesting part is where they set a maximum buffer of the socket - if this is reached the socket will stop receiving data. Is this even possible with BSD sockets? Or I would have to resort to kernel extensions?

Thanks

HTH...


--
james woodyatt < email@hidden>
member of technical staff
apple computer, inc.


 _______________________________________________
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

  • Follow-Ups:
    • Re: Capping of sockets
      • From: james woodyatt <email@hidden>
References: 
 >Re: Capping of sockets (From: Scott Ribe <email@hidden>)
 >Re: Capping of sockets (From: David Aames <email@hidden>)
 >Re: Capping of sockets (From: james woodyatt <email@hidden>)

  • Prev by Date: Re: Capping of sockets
  • Next by Date: Re: Capping of sockets
  • Previous by thread: Re: Capping of sockets
  • Next by thread: Re: Capping of sockets
  • Index(es):
    • Date
    • Thread