[Spread-users] "connection clsoed" problem

Ryan Caudy rcaudy at gmail.com
Tue Sep 21 23:55:35 EDT 2004


I wouldn't recommend disconnecting after every multicast.  Reasons why
this is a bad idea were included in another recent post of mine.  I
would recommend another potential workaround -- try having each of
your threads connect to spread at startup, but delay it to avoid any
potential race conditions (e.g. thread 1 connects right away, 2
connects after 1 second, and so on...).

The only drawback I see with sharing a single connection is the
potential synchronization overhead, which could hurt throughput by
decreasing your degree of concurrency.  Are there others that concern
you?

Cheers,
Ryan


On Tue, 21 Sep 2004 22:25:25 -0400, Brian Moseley <bcm at maz.org> wrote:
> Ryan Caudy wrote:
> 
> > Spread certainly does support multiple connections from a single
> > process.  A quick check for your problem suggests a possible root
> > cause in the Java Library's implementation.  Basically,
> > InputStream.read(byte[] b) isn't guaranteed to read the full length of
> > b, and so a more correct version of the library would loop on reading
> > (as it does in several other situations).  I see one more instance of
> > this problem in the code.  I'll create a patch that fixes both, when I
> > have some time to do so.
> 
> that makes sense. thanks for the look.
> 
> > Is the second message that you multicast sent by the same
> > thread/connection?  That exception should *only* be thrown during an
> > attempt to connect, so I feel like there must be some detail of the
> > scenario I'm missing.  Can you explain further?
> 
> you're right. i did a little more digging and found that multiple
> different threads are attempting to open connections. not at all the
> problem that i originally described.
> 
> 1) thread A opens a connection and multicasts a message.
> 2) thread B attempts to open a connection and fails.
> 
> what's interesting is that this seems to happen only if thread A doesn't
> close its connection, or (as reported by my QA lab) if multiple threads
> attempt to open connections at the same time.
> 
> under light load, if i cause each thread to close its connection after
> multicasting, then the problem never occurs. with enough load to cause 4
> threads to execute more or less simultaneously, then only the first
> thread's connection succeeds.
> 
> my workaround is to maintain a single open connection shared by all
> threads, but i'm concerned that this will degrade my webapp's
> performance - i need to send ~1000 msgs per second - forcing me to scale
> horizontally more quickly than i'd expected.
> 
> 
> 
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users
> 



-- 
---------------------------------------------------------------------
Ryan W. Caudy
<rcaudy at gmail.com>
---------------------------------------------------------------------
Bloomberg L.P.
<rcaudy1 at bloomberg.net>
---------------------------------------------------------------------
[Alumnus]
<caudy at cnds.jhu.edu>         
Center for Networking and Distributed Systems
Department of Computer Science
Johns Hopkins University          
---------------------------------------------------------------------




More information about the Spread-users mailing list