Results 1 to 4 of 4
  1. #1

    How to throttle correctly LS

    I want to limit the send rate of some of my items - what is the best practice to do so.
    I heard there is the config parameter max_delay_millis - can you explain the usage of this parameter - what exactly the delay is (do we get most recent message or just ignore some of the messages?)
    Thanks
    Offir

  2. #2
    Power Member
    Join Date
    Feb 2008
    Location
    Siracusa
    Posts
    161
    Hi oshvartz,

    the <max_delay_millis> is a overall parameter that specifies the longest delay that the server is allowed to apply to outgoing updates in order to collect more updates in the same packet. But it is not the right parameter to look at for your specific need.
    Limiting the send rate mainly depends on the subscription mode:

    a) In RAW mode there is no way to limit the update frequency (but server can always decide to further restrict in case of resources limitations)

    b) In DISTINCT and MERGE you can pose a rate for the whole subscription, by specifying a requested max frequency. Here you can find more details for the JavaScript case. But if your purpose is to limit the rate for some specific items, even in the context of the same subscription, you need to override the getAllowedMaxFrequencyItem method of the concrete implementation of your MetadataAdapter.

    c) In Command MODE, all the considerations above apply to the update for each single key

    You can get more information on this topic by looking at Section 3.2 of the General Concepts document

    Regards,
    Gianluca

  3. #3
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    You might also want to check out this example: https://github.com/Weswit/lightstrea...ent-javascript

  4. #4
    Member
    Join Date
    Jul 2010
    Location
    Herzelia
    Posts
    4
    Offir,
    Regarding your question about which items are dropped (latest or most recent), although you referred to the wrong way of doing rate limiting (the <max_dealy_millis>) when done correctly using a combination of "filtered mode" and "max frequency" - when the buffer size is not "unlimited" the messages to be dropped when the buffer is full are always the oldest to enter the buffer (first in line in the FIFO queue) - this makes sense since if the client needs to know anything from the buffer (and we have to choose what) we usually want to prefer more fresh update compared to some stale data.

    Note that i assume you use "filtered mode" and "DISTINCT" mode with some limited buffer size. In other cases you will get different results depending on the combination of the above.

    You should really dive into the "main concepts" doc to get the whole picture.
    Lighstreamer rocks, and it is as complex as it should be to do what it does.

    Yoad.

 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 02:20 PM.