Announcement Announcement Module
Collapse
No announcement yet.
publish-subscribe-channel causing out of memory error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • publish-subscribe-channel causing out of memory error

    I have a publish-subscribe-channel as defined below.

    Code:
    <task:executor id="my-subscbr-pool" pool-size="1"/>
    	
    <!--  All Messages will published on this channel.   -->
    <publish-subscribe-channel id="myChannel" task-executor="my-subscbr-pool"/>
    Subscriber takes around 5-30 seconds to process each message that is received on the channel. When publisher sends hundreds of messages am getting OutOfMemory error.

    I do not see a way of defining 'capacity' for this channel. How do you specify capacity? What are the other ways of implementing this?

    If channel reaches the capacity can SI block the sender (publisher) thread until space is available?

    Thanks
    Last edited by pgondi; Oct 4th, 2011, 10:55 AM.

  • #2
    pub-sub channel does nopt have capacity because it is not a buffering channel. Its a direct hand-off. In other words messages never accumulate in the pub-sub channel, so it can not possibly cause OME
    Also, if you have that many messages why are you using single thread in your config?

    Comment


    • #3
      Also, your OME is probably because of your task-executor configuration. Your task-executor currently is configured with 1 thread and unlimited queue size (default) and no rejection policy.
      Please read this to for details on how to configure the task-executor and let us know if something is unclear.
      http://static.springsource.org/sprin...cheduling.html

      Comment


      • #4
        Specifically read the section on the "executor" element, and you will see the following:
        By default, the queue is unbounded, but this is rarely the desired configuration, because it can lead to OutOfMemoryErrors if enough tasks are added to that queue while all pool threads are busy.
        The following paragraph then addresses rejection policy options as well.

        Comment


        • #5
          Thanks a lot for quick replies.

          The reason I have thread-pool size as 1 is I have to process them in the order they are received.

          I was under the impression that underlying channel holds the messages. I got what your saying and it makes sense.

          I appreciate your time and help.

          Comment

          Working...
          X