ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject ignite git commit: Added ability to dump comm SPI stats to log. (cherry picked from commit fa356e3)
Date Fri, 18 Mar 2016 13:18:43 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 3e53f1722 -> 0b10e0c87


Added ability to dump comm SPI stats to log.
(cherry picked from commit fa356e3)


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0b10e0c8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0b10e0c8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0b10e0c8

Branch: refs/heads/master
Commit: 0b10e0c8766dc41aa723881a75a6a37f3406f1aa
Parents: 3e53f17
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Fri Mar 18 16:09:35 2016 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Fri Mar 18 16:17:18 2016 +0300

----------------------------------------------------------------------
 .../managers/communication/GridIoManager.java   | 10 ++++
 .../GridCachePartitionExchangeManager.java      |  3 ++
 .../util/nio/GridNioRecoveryDescriptor.java     | 21 +++++++-
 .../ignite/internal/util/nio/GridNioServer.java | 52 +++++++++++++++++++-
 .../communication/tcp/TcpCommunicationSpi.java  |  8 +++
 .../tcp/TcpCommunicationSpiMBean.java           |  8 ++-
 6 files changed, 98 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0b10e0c8/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index 232ec2e..9ffbf4e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -1943,6 +1943,16 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
         return getSpi().getOutboundMessagesQueueSize();
     }
 
+    /**
+     * Dumps SPI stats to logs in case TcpCommunicationSpi is used, no-op otherwise.
+     */
+    public void dumpStats() {
+        CommunicationSpi spi = getSpi();
+
+        if (spi instanceof TcpCommunicationSpi)
+            ((TcpCommunicationSpi)spi).dumpStats();
+    }
+
     /** {@inheritDoc} */
     @Override public void printMemoryStats() {
         X.println(">>>");

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b10e0c8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index a0f7f93..1681f2f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -1130,6 +1130,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
 
         for (GridCacheContext cacheCtx : cctx.cacheContexts())
             cacheCtx.preloader().dumpDebugInfo();
+
+        // Dump IO manager statistics.
+        cctx.gridIO().dumpStats();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b10e0c8/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
index 685d260..409bded 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
@@ -44,6 +44,9 @@ public class GridNioRecoveryDescriptor {
     /** Number of received messages. */
     private long rcvCnt;
 
+    /** Number of sent messages. */
+    private long sentCnt;
+
     /** Reserved flag. */
     private boolean reserved;
 
@@ -120,6 +123,13 @@ public class GridNioRecoveryDescriptor {
     }
 
     /**
+     * @return Number of sent messages.
+     */
+    public long sent() {
+        return sentCnt;
+    }
+
+    /**
      * @param lastAck Last acknowledged message.
      */
     public void lastAcknowledged(long lastAck) {
@@ -151,6 +161,8 @@ public class GridNioRecoveryDescriptor {
             if (resendCnt == 0) {
                 msgFuts.addLast(fut);
 
+                sentCnt++;
+
                 return msgFuts.size() < queueLimit;
             }
             else
@@ -187,6 +199,13 @@ public class GridNioRecoveryDescriptor {
     }
 
     /**
+     * @return Last acked message by remote node.
+     */
+    public long acked() {
+        return acked;
+    }
+
+    /**
      * Node left callback.
      *
      * @return {@code False} if descriptor is reserved.
@@ -379,4 +398,4 @@ public class GridNioRecoveryDescriptor {
     @Override public String toString() {
         return S.toString(GridNioRecoveryDescriptor.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b10e0c8/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 765b139..42c7ac7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -551,6 +551,14 @@ public class GridNioServer<T> {
     }
 
     /**
+     *
+     */
+    public void dumpStats() {
+        for (int i = 0; i < clientWorkers.size(); i++)
+            clientWorkers.get(i).offer(new NioOperationFuture<Void>(null, NioOperation.DUMP_STATS));
+    }
+
+    /**
      * Establishes a session.
      *
      * @param ch Channel to register within the server and create session for.
@@ -1433,6 +1441,43 @@ public class GridNioServer<T> {
 
                                 break;
                             }
+
+                            case DUMP_STATS: {
+                                StringBuilder sb = new StringBuilder();
+
+                                Set<SelectionKey> keys = selector.keys();
+
+                                sb.append(U.nl())
+                                    .append(">> Selector info [idx=").append(idx)
+                                    .append(", keysCnt=").append(keys.size())
+                                    .append("]").append(U.nl());
+
+                                for (SelectionKey key : keys) {
+                                    GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+
+                                    sb.append("    Conn [")
+                                        .append("rmtAddr=").append(ses.remoteAddress())
+                                        .append(", locAddr=").append(ses.localAddress())
+                                        .append(", bytesRcvd=").append(ses.bytesReceived())
+                                        .append(", bytesSent=").append(ses.bytesSent());
+
+                                    if (ses.recoveryDescriptor() != null) {
+                                        sb.append(", msgsSent=").append(ses.recoveryDescriptor().sent())
+                                            .append(", msgsAckedByRmt=").append(ses.recoveryDescriptor().acked())
+                                            .append(", msgsRcvd=").append(ses.recoveryDescriptor().received());
+                                    }
+                                    else
+                                        sb.append(", recoveryDesc=null");
+
+                                    sb.append("]").append(U.nl());
+                                }
+
+                                if (log.isInfoEnabled())
+                                    log.info(sb.toString());
+
+                                // Complete the request just in case (none should wait on
this future).
+                                req.onDone(true);
+                            }
                         }
                     }
 
@@ -1991,7 +2036,10 @@ public class GridNioServer<T> {
         PAUSE_READ,
 
         /** Resume read. */
-        RESUME_READ
+        RESUME_READ,
+
+        /** Dump statistics. */
+        DUMP_STATS
     }
 
     /**
@@ -2059,7 +2107,7 @@ public class GridNioServer<T> {
          * @param op Requested operation.
          */
         NioOperationFuture(GridSelectorNioSessionImpl ses, NioOperation op) {
-            assert ses != null;
+            assert ses != null || op == NioOperation.DUMP_STATS : "Invalid params [ses="
+ ses + ", op=" + op + ']';
             assert op != null;
             assert op != NioOperation.REGISTER;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b10e0c8/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 2a078ee..b283b82 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -1380,6 +1380,14 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     }
 
     /** {@inheritDoc} */
+    @Override public void dumpStats() {
+        GridNioServer<Message> nioSrvr1 = nioSrvr;
+
+        if (nioSrvr1 != null)
+            nioSrvr1.dumpStats();
+    }
+
+    /** {@inheritDoc} */
     @Override public Map<String, Object> getNodeAttributes() throws IgniteSpiException
{
         initFailureDetectionTimeout();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b10e0c8/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
index a785482..482e2ef 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
@@ -287,4 +287,10 @@ public interface TcpCommunicationSpiMBean extends IgniteSpiManagementMBean
{
      */
     @MXBeanDescription("Slow client queue limit.")
     public int getSlowClientQueueLimit();
-}
\ No newline at end of file
+
+    /**
+     * Dumps SPI per-connection stats to logs.
+     */
+    @MXBeanDescription("Dumps SPI statistics to logs.")
+    public void dumpStats();
+}


Mime
View raw message