Changes between Initial Version and Version 1 of Ticket #2434, comment 12


Ignore:
Timestamp:
Feb 15, 2019 8:47:14 PM (3 months ago)
Author:
jogger
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2434, comment 12

    initial v1  
    1111{{{
    1212--- "EventPumper orig.java"     2019-02-11 11:37:03.180913002 +0100
    13 +++ "EventPumper patch.java"    2019-02-15 06:53:42.498136840 +0100
     13+++ "EventPumper patch.java"    2019-02-15 21:40:40.271500090 +0100
    1414@@ -56,6 +56,7 @@
    1515     private final ObjectCounter<ByteArray> _blockedIPs;
     
    3030 
    3131     /** tunnel test now disabled, but this should be long enough to allow an active tunnel to get started */
    32 @@ -103,12 +104,13 @@
     32@@ -103,7 +104,7 @@
    3333     //private static final String PROP_DIRECT = "i2np.ntcp.useDirectBuffers";
    3434 
     
    3939     static {
    4040         long maxMemory = SystemVersion.getMaxMemory();
    41 -        MIN_BUFS = (int) Math.max(MIN_MINB, Math.min(MAX_MINB, 1 + (maxMemory / (16*1024*1024))));
    42 -    }
    43 +        // let´s spend 1% of memory for buffers. It´s a tryCache after all
    44 +        // will definitely reduce GC, can be seen in jconsole
    45 +        MIN_BUFS = (int) Math.max(MIN_MINB, Math.min(MAX_MINB, maxMemory / 100 / BUF_SIZE));
    46      
    47      private static final TryCache<ByteBuffer> _bufferCache = new TryCache<>(new BufferFactory(), MIN_BUFS);
    48  
    49 @@ -178,12 +180,12 @@
     41@@ -178,12 +179,12 @@
    5042     
    5143     /**
     
    6254         long lastBlockedIPClear = lastFailsafeIteration;
    6355         while (_alive && _selector.isOpen()) {
    64 @@ -189,26 +191,32 @@
     56@@ -189,26 +190,32 @@
    6557         while (_alive && _selector.isOpen()) {
    6658             try {
     
    10395                 
    10496                 long now = System.currentTimeMillis();
    105 @@ -223,11 +231,8 @@
     97@@ -223,11 +230,8 @@
    10698                         int lastKeySetSize = all.size();
    10799                         _context.statManager().addRateData("ntcp.pumperKeySetSize", lastKeySetSize);
     
    116108                         int failsafeCloses = 0;
    117109                         int failsafeInvalid = 0;
    118 @@ -315,22 +320,25 @@
     110@@ -315,22 +319,25 @@
    119111                     } catch (ClosedSelectorException cse) {
    120112                         continue;
     
    151143             } catch (RuntimeException re) {
    152144                 _log.error("Error in the event pumper", re);
    153 @@ -451,10 +459,10 @@
     145@@ -451,10 +458,10 @@
    154146      *  Only wakeup if new.
    155147      */
     
    164156     /**
    165157      *  This is only called from NTCPConnection.complete()
    166 @@ -463,6 +471,7 @@
     158@@ -463,6 +470,7 @@
    167159      */
    168160     public void wantsRead(NTCPConnection con) {
     
    172164     }
    173165 
    174 @@ -881,16 +890,8 @@
     166@@ -881,16 +889,8 @@
    175167                 if (_log.shouldLog(Log.WARN)) _log.warn("Error registering", cce);
    176168             }