org.mule.transport.tcp.issues
Class ReuseExperimentMule2067TestCase

java.lang.Object
  extended by org.mule.tck.junit4.AbstractMuleTestCase
      extended by org.mule.transport.tcp.issues.ReuseExperimentMule2067TestCase

public class ReuseExperimentMule2067TestCase
extends AbstractMuleTestCase

Can we avoid the "address already in use" errors by using SO_REUSEADDR? Typical results are

 [07-24 19:32:49] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats without reuse and a pause of 100 ms
 [07-24 19:33:49] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 57.3 +/- 33.15131973240282
 [07-24 19:33:49] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats with reuse and a pause of 100 ms
 [07-24 19:35:32] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 100.0 +/- 0.0
 [07-24 19:35:32] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats without reuse and a pause of 10 ms
 [07-24 19:35:48] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 96.8 +/- 7.332121111929359
 [07-24 19:35:48] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats with reuse and a pause of 10 ms
 [07-24 19:36:04] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 100.0 +/- 0.0
 [07-24 19:36:04] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats without reuse and a pause of 1 ms
 [07-24 19:36:10] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 75.8 +/- 37.690317058894586
 [07-24 19:36:10] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats with reuse and a pause of 1 ms
 [07-24 19:36:18] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 100.0 +/- 0.0
which suggest that enabling address re-use could help with the issue. Note that if a single socket (ie a single port number) is reused for all tests we often zeroes eveywhere (even with waits of 2sec and similar between iterations/tests). This suggests that once the error occurs, the socket enters a long-lived "broken" state. All this is by AC on linux, dual CPU, Java 1.4 - I suspect results will vary like crazy in different contexts.


Nested Class Summary
protected static class ReuseExperimentMule2067TestCase.Server
           
 
Field Summary
 
Fields inherited from class org.mule.tck.junit4.AbstractMuleTestCase
DEFAULT_TEST_TIMEOUT_SECS, globalTimeout, name, TEST_TIMEOUT_SYSTEM_PROPERTY
 
Constructor Summary
ReuseExperimentMule2067TestCase()
           
 
Method Summary
protected  void measureMeanRunLength(int sampleSize, int numberOfRepeats, int numberOfConnections, int port, long pause, boolean reuse)
           
protected  void openCloseClientServer(int numberOfConnections, int port, boolean reuse)
           
protected  void pause(long pause)
           
protected  int repeatOpenCloseClientServer(int numberOfRepeats, int numberOfConnections, int port, long pause, boolean reuse, boolean noFail)
           
 void testMeasureImprovement()
           
 void testReuse()
           
 
Methods inherited from class org.mule.tck.junit4.AbstractMuleTestCase
clearExcludedFlag, clearRequestContext, createTestTimeoutRule, getTestHeader, getTestTimeoutSecs, getTimeoutSystemProperty, initializeMuleTest, isDisabledInThisEnvironment, isDisabledInThisEnvironment, isExcluded, isFailOnTimeout, isOffline, isTestIncludedInExclusionFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReuseExperimentMule2067TestCase

public ReuseExperimentMule2067TestCase()
Method Detail

testReuse

public void testReuse()
               throws IOException
Throws:
IOException

testMeasureImprovement

public void testMeasureImprovement()
                            throws IOException
Throws:
IOException

measureMeanRunLength

protected void measureMeanRunLength(int sampleSize,
                                    int numberOfRepeats,
                                    int numberOfConnections,
                                    int port,
                                    long pause,
                                    boolean reuse)
                             throws IOException
Throws:
IOException

repeatOpenCloseClientServer

protected int repeatOpenCloseClientServer(int numberOfRepeats,
                                          int numberOfConnections,
                                          int port,
                                          long pause,
                                          boolean reuse,
                                          boolean noFail)
                                   throws IOException
Throws:
IOException

openCloseClientServer

protected void openCloseClientServer(int numberOfConnections,
                                     int port,
                                     boolean reuse)
                              throws IOException
Throws:
IOException

pause

protected void pause(long pause)


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.