You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2017/09/12 17:04:08 UTC

[geode] branch feature/GEODE-3083 created (now 0c6f2ef)

This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a change to branch feature/GEODE-3083
in repository https://gitbox.apache.org/repos/asf/geode.git.


      at 0c6f2ef  GEODE-3083: New protocol should record statistics

This branch includes the following new commits:

     new 0c6f2ef  GEODE-3083: New protocol should record statistics

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].

[geode] 01/01: GEODE-3083: New protocol should record statistics

Posted by bs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a commit to branch feature/GEODE-3083
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 0c6f2ef55b50c20e7f5cbf63681836c15fb2d5c5
Author: Bruce Schuchardt <bs...@pivotal.io>
AuthorDate: Tue Sep 12 10:01:56 2017 -0700

    GEODE-3083: New protocol should record statistics
    
    wip
    
    Statistics implemented: connections, connection starts, connection termination,
    bytes/second received bytes/second sent
    
    We need some performance testing on the byte measurement since it involves
    traversing the Protobuf message objects to calculate their sizes.
    
    We need additional stats including failed authentications/second and
    failed authorization checks/second
---
 .../apache/geode/internal/cache/tier/Acceptor.java |   6 +
 .../internal/cache/tier/sockets/AcceptorImpl.java  |  15 +-
 .../cache/tier/sockets/CacheServerStats.java       | 226 ++++++++++-----------
 .../tier/sockets/ClientProtocolMessageHandler.java |   7 +
 ...eHandler.java => ClientProtocolStatistics.java} |  20 +-
 .../sockets/GenericProtocolServerConnection.java   |  27 ++-
 .../tier/sockets/ServerConnectionFactory.java      |  33 ++-
 .../tier/sockets/ServerConnectionFactoryTest.java  |   2 +-
 .../cache/tier/sockets/ServerConnectionTest.java   |   3 +-
 .../protobuf/ProtobufClientStatistics.java         |  73 +++++++
 .../protocol/protobuf/ProtobufStreamProcessor.java |  15 ++
 .../RoundTripCacheConnectionJUnitTest.java         |   8 +
 .../RoundTripLocatorConnectionDUnitTest.java       |  18 ++
 13 files changed, 304 insertions(+), 149 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Acceptor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Acceptor.java
index f062129..7184407 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Acceptor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Acceptor.java
@@ -50,6 +50,12 @@ public abstract class Acceptor {
   public abstract int getPort();
 
   /**
+   * returns the server's name string, including the inet address and port that
+   * the server is listening on
+   */
+  public abstract String getServerName();
+
+  /**
    * Closes this acceptor thread
    */
   public abstract void close();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
index f9bc596..68377d8 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
@@ -511,7 +511,7 @@ public class AcceptorImpl extends Acceptor implements Runnable, CommBufferPool {
         }
       }
       this.localPort = port;
-      String sockName = this.serverSock.getLocalSocketAddress().toString();
+      String sockName = getServerName();
       logger.info(LocalizedMessage.create(
           LocalizedStrings.AcceptorImpl_CACHE_SERVER_CONNECTION_LISTENER_BOUND_TO_ADDRESS_0_WITH_BACKLOG_1,
           new Object[] {sockName, Integer.valueOf(backLog)}));
@@ -1178,6 +1178,17 @@ public class AcceptorImpl extends Acceptor implements Runnable, CommBufferPool {
     return localPort;
   }
 
+  @Override
+  public String getServerName() {
+    String name = this.serverSock.getLocalSocketAddress().toString();
+    try {
+      name = SocketCreator.getLocalHost().getCanonicalHostName() + "-" + name;
+    } catch (Exception e) {
+    }
+    return name;
+  }
+
+
   public InetAddress getServerInetAddr() {
     return this.serverSock.getInetAddress();
   }
@@ -1487,7 +1498,7 @@ public class AcceptorImpl extends Acceptor implements Runnable, CommBufferPool {
 
     ServerConnection serverConn = serverConnectionFactory.makeServerConnection(socket, this.cache,
         this.crHelper, this.stats, AcceptorImpl.handShakeTimeout, this.socketBufferSize,
-        communicationModeStr, communicationMode, this, this.securityService);
+        communicationModeStr, communicationMode, this, this.securityService, this.getBindAddress());
 
     synchronized (this.allSCsLock) {
       this.allSCs.add(serverConn);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheServerStats.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheServerStats.java
index 4f2a0b3..fd12192 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheServerStats.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheServerStats.java
@@ -233,261 +233,257 @@ public class CacheServerStats implements MessageStats {
    * Add a convinience method to pass in a StatisticsFactory for Statistics construction. Helpful
    * for local Statistics operations
    * 
-   * @param f
+   * @param statisticsFactory
    * @param ownerName
    */
-  public CacheServerStats(StatisticsFactory f, String ownerName, String typeName,
-      StatisticDescriptor[] descriptiors) {
-    if (f == null) {
+  public CacheServerStats(StatisticsFactory statisticsFactory, String ownerName, String typeName,
+      StatisticDescriptor[] descriptors) {
+    if (statisticsFactory == null) {
       // Create statistics later when needed
       return;
     }
     StatisticDescriptor[] serverStatDescriptors = new StatisticDescriptor[] {
-        f.createIntCounter("getRequests", "Number of cache client get requests.", "operations"),
-        f.createLongCounter("readGetRequestTime", "Total time spent in reading get requests.",
+        statisticsFactory.createIntCounter("getRequests", "Number of cache client get requests.", "operations"),
+        statisticsFactory.createLongCounter("readGetRequestTime", "Total time spent in reading get requests.",
             "nanoseconds"),
-        f.createLongCounter("processGetTime",
+        statisticsFactory.createLongCounter("processGetTime",
             "Total time spent in processing a cache client get request, including the time to get an object from the cache.",
             "nanoseconds"),
-        f.createIntCounter("getResponses", "Number of get responses written to the cache client.",
+        statisticsFactory.createIntCounter("getResponses", "Number of get responses written to the cache client.",
             "operations"),
-        f.createLongCounter("writeGetResponseTime", "Total time spent in writing get responses.",
+        statisticsFactory.createLongCounter("writeGetResponseTime", "Total time spent in writing get responses.",
             "nanoseconds"),
 
-        f.createIntCounter("putRequests", "Number of cache client put requests.", "operations"),
-        f.createLongCounter("readPutRequestTime", "Total time spent in reading put requests.",
+        statisticsFactory.createIntCounter("putRequests", "Number of cache client put requests.", "operations"),
+        statisticsFactory.createLongCounter("readPutRequestTime", "Total time spent in reading put requests.",
             "nanoseconds"),
-        f.createLongCounter("processPutTime",
+        statisticsFactory.createLongCounter("processPutTime",
             "Total time spent in processing a cache client put request, including the time to put an object into the cache.",
             "nanoseconds"),
-        f.createIntCounter("putResponses", "Number of put responses written to the cache client.",
+        statisticsFactory.createIntCounter("putResponses", "Number of put responses written to the cache client.",
             "operations"),
-        f.createLongCounter("writePutResponseTime", "Total time spent in writing put responses.",
+        statisticsFactory.createLongCounter("writePutResponseTime", "Total time spent in writing put responses.",
             "nanoseconds"),
 
-        f.createIntCounter("putAllRequests", "Number of cache client putAll requests.",
+        statisticsFactory.createIntCounter("putAllRequests", "Number of cache client putAll requests.",
             "operations"),
-        f.createLongCounter("readPutAllRequestTime", "Total time spent in reading putAll requests.",
+        statisticsFactory.createLongCounter("readPutAllRequestTime", "Total time spent in reading putAll requests.",
             "nanoseconds"),
-        f.createLongCounter("processPutAllTime",
+        statisticsFactory.createLongCounter("processPutAllTime",
             "Total time spent in processing a cache client putAll request, including the time to put all objects into the cache.",
             "nanoseconds"),
-        f.createIntCounter("putAllResponses",
+        statisticsFactory.createIntCounter("putAllResponses",
             "Number of putAll responses written to the cache client.", "operations"),
-        f.createLongCounter("writePutAllResponseTime",
+        statisticsFactory.createLongCounter("writePutAllResponseTime",
             "Total time spent in writing putAll responses.", "nanoseconds"),
 
-        f.createIntCounter("removeAllRequests", "Number of cache client removeAll requests.",
+        statisticsFactory.createIntCounter("removeAllRequests", "Number of cache client removeAll requests.",
             "operations"),
-        f.createLongCounter("readRemoveAllRequestTime",
+        statisticsFactory.createLongCounter("readRemoveAllRequestTime",
             "Total time spent in reading removeAll requests.", "nanoseconds"),
-        f.createLongCounter("processRemoveAllTime",
+        statisticsFactory.createLongCounter("processRemoveAllTime",
             "Total time spent in processing a cache client removeAll request, including the time to remove all objects from the cache.",
             "nanoseconds"),
-        f.createIntCounter("removeAllResponses",
+        statisticsFactory.createIntCounter("removeAllResponses",
             "Number of removeAll responses written to the cache client.", "operations"),
-        f.createLongCounter("writeRemoveAllResponseTime",
+        statisticsFactory.createLongCounter("writeRemoveAllResponseTime",
             "Total time spent in writing removeAll responses.", "nanoseconds"),
 
-        f.createIntCounter("getAllRequests", "Number of cache client getAll requests.",
+        statisticsFactory.createIntCounter("getAllRequests", "Number of cache client getAll requests.",
             "operations"),
-        f.createLongCounter("readGetAllRequestTime", "Total time spent in reading getAll requests.",
+        statisticsFactory.createLongCounter("readGetAllRequestTime", "Total time spent in reading getAll requests.",
             "nanoseconds"),
-        f.createLongCounter("processGetAllTime",
+        statisticsFactory.createLongCounter("processGetAllTime",
             "Total time spent in processing a cache client getAll request.", "nanoseconds"),
-        f.createIntCounter("getAllResponses",
+        statisticsFactory.createIntCounter("getAllResponses",
             "Number of getAll responses written to the cache client.", "operations"),
-        f.createLongCounter("writeGetAllResponseTime",
+        statisticsFactory.createLongCounter("writeGetAllResponseTime",
             "Total time spent in writing getAll responses.", "nanoseconds"),
 
-        f.createIntCounter("destroyRequests", "Number of cache client destroy requests.",
+        statisticsFactory.createIntCounter("destroyRequests", "Number of cache client destroy requests.",
             "operations"),
-        f.createLongCounter("readDestroyRequestTime",
+        statisticsFactory.createLongCounter("readDestroyRequestTime",
             "Total time spent in reading destroy requests.", "nanoseconds"),
-        f.createLongCounter("processDestroyTime",
+        statisticsFactory.createLongCounter("processDestroyTime",
             "Total time spent in processing a cache client destroy request, including the time to destroy an object from the cache.",
             "nanoseconds"),
-        f.createIntCounter("destroyResponses",
+        statisticsFactory.createIntCounter("destroyResponses",
             "Number of destroy responses written to the cache client.", "operations"),
-        f.createLongCounter("writeDestroyResponseTime",
+        statisticsFactory.createLongCounter("writeDestroyResponseTime",
             "Total time spent in writing destroy responses.", "nanoseconds"),
 
-        f.createIntCounter("invalidateRequests", "Number of cache client invalidate requests.",
+        statisticsFactory.createIntCounter("invalidateRequests", "Number of cache client invalidate requests.",
             "operations"),
-        f.createLongCounter("readInvalidateRequestTime",
+        statisticsFactory.createLongCounter("readInvalidateRequestTime",
             "Total time spent in reading invalidate requests.", "nanoseconds"),
-        f.createLongCounter("processInvalidateTime",
+        statisticsFactory.createLongCounter("processInvalidateTime",
             "Total time spent in processing a cache client invalidate request, including the time to invalidate an object from the cache.",
             "nanoseconds"),
-        f.createIntCounter("invalidateResponses",
+        statisticsFactory.createIntCounter("invalidateResponses",
             "Number of invalidate responses written to the cache client.", "operations"),
-        f.createLongCounter("writeInvalidateResponseTime",
+        statisticsFactory.createLongCounter("writeInvalidateResponseTime",
             "Total time spent in writing invalidate responses.", "nanoseconds"),
 
-        f.createIntCounter("sizeRequests", "Number of cache client size requests.", "operations"),
-        f.createLongCounter("readSizeRequestTime", "Total time spent in reading size requests.",
+        statisticsFactory.createIntCounter("sizeRequests", "Number of cache client size requests.", "operations"),
+        statisticsFactory.createLongCounter("readSizeRequestTime", "Total time spent in reading size requests.",
             "nanoseconds"),
-        f.createLongCounter("processSizeTime",
+        statisticsFactory.createLongCounter("processSizeTime",
             "Total time spent in processing a cache client size request, including the time to size an object from the cache.",
             "nanoseconds"),
-        f.createIntCounter("sizeResponses", "Number of size responses written to the cache client.",
+        statisticsFactory.createIntCounter("sizeResponses", "Number of size responses written to the cache client.",
             "operations"),
-        f.createLongCounter("writeSizeResponseTime", "Total time spent in writing size responses.",
+        statisticsFactory.createLongCounter("writeSizeResponseTime", "Total time spent in writing size responses.",
             "nanoseconds"),
 
 
-        f.createIntCounter("queryRequests", "Number of cache client query requests.", "operations"),
-        f.createLongCounter("readQueryRequestTime", "Total time spent in reading query requests.",
+        statisticsFactory.createIntCounter("queryRequests", "Number of cache client query requests.", "operations"),
+        statisticsFactory.createLongCounter("readQueryRequestTime", "Total time spent in reading query requests.",
             "nanoseconds"),
-        f.createLongCounter("processQueryTime",
+        statisticsFactory.createLongCounter("processQueryTime",
             "Total time spent in processing a cache client query request, including the time to destroy an object from the cache.",
             "nanoseconds"),
-        f.createIntCounter("queryResponses",
+        statisticsFactory.createIntCounter("queryResponses",
             "Number of query responses written to the cache client.", "operations"),
-        f.createLongCounter("writeQueryResponseTime",
+        statisticsFactory.createLongCounter("writeQueryResponseTime",
             "Total time spent in writing query responses.", "nanoseconds"),
 
-        f.createIntCounter("destroyRegionRequests",
+        statisticsFactory.createIntCounter("destroyRegionRequests",
             "Number of cache client destroyRegion requests.", "operations"),
-        f.createLongCounter("readDestroyRegionRequestTime",
+        statisticsFactory.createLongCounter("readDestroyRegionRequestTime",
             "Total time spent in reading destroyRegion requests.", "nanoseconds"),
-        f.createLongCounter("processDestroyRegionTime",
+        statisticsFactory.createLongCounter("processDestroyRegionTime",
             "Total time spent in processing a cache client destroyRegion request, including the time to destroy the region from the cache.",
             "nanoseconds"),
-        f.createIntCounter("destroyRegionResponses",
+        statisticsFactory.createIntCounter("destroyRegionResponses",
             "Number of destroyRegion responses written to the cache client.", "operations"),
-        f.createLongCounter("writeDestroyRegionResponseTime",
+        statisticsFactory.createLongCounter("writeDestroyRegionResponseTime",
             "Total time spent in writing destroyRegion responses.", "nanoseconds"),
 
-        f.createIntCounter("containsKeyRequests", "Number of cache client containsKey requests.",
+        statisticsFactory.createIntCounter("containsKeyRequests", "Number of cache client containsKey requests.",
             "operations"),
-        f.createLongCounter("readContainsKeyRequestTime",
+        statisticsFactory.createLongCounter("readContainsKeyRequestTime",
             "Total time spent reading containsKey requests.", "nanoseconds"),
-        f.createLongCounter("processContainsKeyTime",
+        statisticsFactory.createLongCounter("processContainsKeyTime",
             "Total time spent processing a containsKey request.", "nanoseconds"),
-        f.createIntCounter("containsKeyResponses",
+        statisticsFactory.createIntCounter("containsKeyResponses",
             "Number of containsKey responses written to the cache client.", "operations"),
-        f.createLongCounter("writeContainsKeyResponseTime",
+        statisticsFactory.createLongCounter("writeContainsKeyResponseTime",
             "Total time spent writing containsKey responses.", "nanoseconds"),
 
-        f.createIntCounter("processBatchRequests", "Number of cache client processBatch requests.",
+        statisticsFactory.createIntCounter("processBatchRequests", "Number of cache client processBatch requests.",
             "operations"),
-        f.createLongCounter("readProcessBatchRequestTime",
+        statisticsFactory.createLongCounter("readProcessBatchRequestTime",
             "Total time spent in reading processBatch requests.", "nanoseconds"),
-        f.createLongCounter("processBatchTime",
+        statisticsFactory.createLongCounter("processBatchTime",
             "Total time spent in processing a cache client processBatch request.", "nanoseconds"),
-        f.createIntCounter("processBatchResponses",
+        statisticsFactory.createIntCounter("processBatchResponses",
             "Number of processBatch responses written to the cache client.", "operations"),
-        f.createLongCounter("writeProcessBatchResponseTime",
+        statisticsFactory.createLongCounter("writeProcessBatchResponseTime",
             "Total time spent in writing processBatch responses.", "nanoseconds"),
-        f.createLongCounter("batchSize", "The size of the batches received.", "bytes"),
-        f.createIntCounter("clearRegionRequests", "Number of cache client clearRegion requests.",
+        statisticsFactory.createLongCounter("batchSize", "The size of the batches received.", "bytes"),
+        statisticsFactory.createIntCounter("clearRegionRequests", "Number of cache client clearRegion requests.",
             "operations"),
-        f.createLongCounter("readClearRegionRequestTime",
+        statisticsFactory.createLongCounter("readClearRegionRequestTime",
             "Total time spent in reading clearRegion requests.", "nanoseconds"),
-        f.createLongCounter("processClearRegionTime",
+        statisticsFactory.createLongCounter("processClearRegionTime",
             "Total time spent in processing a cache client clearRegion request, including the time to clear the region from the cache.",
             "nanoseconds"),
-        f.createIntCounter("clearRegionResponses",
+        statisticsFactory.createIntCounter("clearRegionResponses",
             "Number of clearRegion responses written to the cache client.", "operations"),
-        f.createLongCounter("writeClearRegionResponseTime",
+        statisticsFactory.createLongCounter("writeClearRegionResponseTime",
             "Total time spent in writing clearRegion responses.", "nanoseconds"),
-        f.createIntCounter("clientNotificationRequests",
+        statisticsFactory.createIntCounter("clientNotificationRequests",
             "Number of cache client notification requests.", "operations"),
-        f.createLongCounter("readClientNotificationRequestTime",
+        statisticsFactory.createLongCounter("readClientNotificationRequestTime",
             "Total time spent in reading client notification requests.", "nanoseconds"),
-        f.createLongCounter("processClientNotificationTime",
+        statisticsFactory.createLongCounter("processClientNotificationTime",
             "Total time spent in processing a cache client notification request.", "nanoseconds"),
 
-        f.createIntCounter("updateClientNotificationRequests",
+        statisticsFactory.createIntCounter("updateClientNotificationRequests",
             "Number of cache client notification update requests.", "operations"),
-        f.createLongCounter("readUpdateClientNotificationRequestTime",
+        statisticsFactory.createLongCounter("readUpdateClientNotificationRequestTime",
             "Total time spent in reading client notification update requests.", "nanoseconds"),
-        f.createLongCounter("processUpdateClientNotificationTime",
+        statisticsFactory.createLongCounter("processUpdateClientNotificationTime",
             "Total time spent in processing a client notification update request.", "nanoseconds"),
 
-        f.createIntCounter("clientReadyRequests", "Number of cache client ready requests.",
+        statisticsFactory.createIntCounter("clientReadyRequests", "Number of cache client ready requests.",
             "operations"),
-        f.createLongCounter("readClientReadyRequestTime",
+        statisticsFactory.createLongCounter("readClientReadyRequestTime",
             "Total time spent in reading cache client ready requests.", "nanoseconds"),
-        f.createLongCounter("processClientReadyTime",
+        statisticsFactory.createLongCounter("processClientReadyTime",
             "Total time spent in processing a cache client ready request, including the time to destroy an object from the cache.",
             "nanoseconds"),
-        f.createIntCounter("clientReadyResponses",
+        statisticsFactory.createIntCounter("clientReadyResponses",
             "Number of client ready responses written to the cache client.", "operations"),
-        f.createLongCounter("writeClientReadyResponseTime",
+        statisticsFactory.createLongCounter("writeClientReadyResponseTime",
             "Total time spent in writing client ready responses.", "nanoseconds"),
 
-        f.createIntCounter("closeConnectionRequests",
+        statisticsFactory.createIntCounter("closeConnectionRequests",
             "Number of cache client close connection requests.", "operations"),
-        f.createLongCounter("readCloseConnectionRequestTime",
+        statisticsFactory.createLongCounter("readCloseConnectionRequestTime",
             "Total time spent in reading close connection requests.", "nanoseconds"),
-        f.createLongCounter("processCloseConnectionTime",
+        statisticsFactory.createLongCounter("processCloseConnectionTime",
             "Total time spent in processing a cache client close connection request.",
             "nanoseconds"),
-        f.createIntCounter("failedConnectionAttempts", "Number of failed connection attempts.",
+        statisticsFactory.createIntCounter("failedConnectionAttempts", "Number of failed connection attempts.",
             "attempts"),
-        f.createIntGauge("currentClientConnections",
+        statisticsFactory.createIntGauge("currentClientConnections",
             "Number of sockets accepted and used for client to server messaging.", "sockets"),
-        f.createIntGauge("currentQueueConnections",
+        statisticsFactory.createIntGauge("currentQueueConnections",
             "Number of sockets accepted and used for server to client messaging.", "sockets"),
-        f.createIntGauge("currentClients", "Number of client virtual machines connected.",
+        statisticsFactory.createIntGauge("currentClients", "Number of client virtual machines connected.",
             "clients"),
-        f.createIntCounter("outOfOrderGatewayBatchIds", "Number of Out of order batch IDs.",
+        statisticsFactory.createIntCounter("outOfOrderGatewayBatchIds", "Number of Out of order batch IDs.",
             "batches"),
-        f.createIntCounter("abandonedWriteRequests",
+        statisticsFactory.createIntCounter("abandonedWriteRequests",
             "Number of write opertations abandond by clients", "requests"),
-        f.createIntCounter("abandonedReadRequests",
+        statisticsFactory.createIntCounter("abandonedReadRequests",
             "Number of read opertations abandond by clients", "requests"),
-        f.createLongCounter("receivedBytes", "Total number of bytes received from clients.",
+        statisticsFactory.createLongCounter("receivedBytes", "Total number of bytes received from clients.",
             "bytes"),
-        f.createLongCounter("sentBytes", "Total number of bytes sent to clients.", "bytes"),
-        f.createIntGauge("messagesBeingReceived",
+        statisticsFactory.createLongCounter("sentBytes", "Total number of bytes sent to clients.", "bytes"),
+        statisticsFactory.createIntGauge("messagesBeingReceived",
             "Current number of message being received off the network or being processed after reception.",
             "messages"),
-        f.createLongGauge("messageBytesBeingReceived",
+        statisticsFactory.createLongGauge("messageBytesBeingReceived",
             "Current number of bytes consumed by messages being received or processed.", "bytes"),
-        f.createIntCounter("connectionsTimedOut",
+        statisticsFactory.createIntCounter("connectionsTimedOut",
             "Total number of connections that have been timed out by the server because of client inactivity",
             "connections"),
-        f.createIntGauge("threadQueueSize",
+        statisticsFactory.createIntGauge("threadQueueSize",
             "Current number of connections waiting for a thread to start processing their message.",
             "connections"),
-        f.createIntGauge("acceptsInProgress",
+        statisticsFactory.createIntGauge("acceptsInProgress",
             "Current number of server accepts that are attempting to do the initial handshake with the client.",
             "accepts"),
-        f.createIntCounter("acceptThreadStarts",
+        statisticsFactory.createIntCounter("acceptThreadStarts",
             "Total number of threads created to deal with an accepted socket. Note that this is not the current number of threads.",
             "starts"),
-        f.createIntCounter("connectionThreadStarts",
+        statisticsFactory.createIntCounter("connectionThreadStarts",
             "Total number of threads created to deal with a client connection. Note that this is not the current number of threads.",
             "starts"),
-        f.createIntGauge("connectionThreads",
+        statisticsFactory.createIntGauge("connectionThreads",
             "Current number of threads dealing with a client connection.", "threads"),
-        f.createDoubleGauge("connectionLoad",
+        statisticsFactory.createDoubleGauge("connectionLoad",
             "The load from client to server connections as reported by the load probe installed in this server",
             "load"),
-        f.createDoubleGauge("loadPerConnection",
+        statisticsFactory.createDoubleGauge("loadPerConnection",
             "The estimate of how much load is added for each new connection as reported by the load probe installed in this server",
             "load"),
-        f.createDoubleGauge("queueLoad",
+        statisticsFactory.createDoubleGauge("queueLoad",
             "The load from queues as reported by the load probe installed in this server", "load"),
-        f.createDoubleGauge("loadPerQueue",
+        statisticsFactory.createDoubleGauge("loadPerQueue",
             "The estimate of how much load is added for each new connection as reported by the load probe installed in this server",
             "load")};
     StatisticDescriptor[] alldescriptors = serverStatDescriptors;
-    if (descriptiors != null) {
-      alldescriptors = new StatisticDescriptor[descriptiors.length + serverStatDescriptors.length];
-      System.arraycopy(descriptiors, 0, alldescriptors, 0, descriptiors.length);
-      System.arraycopy(serverStatDescriptors, 0, alldescriptors, descriptiors.length,
+    if (descriptors != null) {
+      alldescriptors = new StatisticDescriptor[descriptors.length + serverStatDescriptors.length];
+      System.arraycopy(descriptors, 0, alldescriptors, 0, descriptors.length);
+      System.arraycopy(serverStatDescriptors, 0, alldescriptors, descriptors.length,
           serverStatDescriptors.length);
     }
-    statType = f.createType(typeName, typeName, alldescriptors);
-    try {
-      ownerName = SocketCreator.getLocalHost().getCanonicalHostName() + "-" + ownerName;
-    } catch (Exception e) {
-    }
-    this.stats = f.createAtomicStatistics(statType, ownerName);
+    statType = statisticsFactory.createType(typeName, typeName, alldescriptors);
+    this.stats = statisticsFactory.createAtomicStatistics(statType, ownerName);
 
     getRequestsId = this.stats.nameToId("getRequests");
     readGetRequestTimeId = this.stats.nameToId("readGetRequestTime");
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProtocolMessageHandler.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProtocolMessageHandler.java
index 0ced3aa..b8969e1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProtocolMessageHandler.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProtocolMessageHandler.java
@@ -19,6 +19,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import org.apache.geode.Statistics;
+import org.apache.geode.StatisticsFactory;
+
 
 /**
  * This is an interface that other modules can implement to hook into
@@ -29,6 +32,10 @@ import java.io.OutputStream;
  * {@link GenericProtocolServerConnection}.
  */
 public interface ClientProtocolMessageHandler {
+  void initializeStatistics(String statisticsName, StatisticsFactory factory);
+
+  ClientProtocolStatistics getStatistics();
+
   void receiveMessage(InputStream inputStream, OutputStream outputStream,
       MessageExecutionContext executionContext) throws IOException;
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProtocolMessageHandler.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProtocolStatistics.java
similarity index 56%
copy from geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProtocolMessageHandler.java
copy to geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProtocolStatistics.java
index 0ced3aa..eeb79da 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProtocolMessageHandler.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProtocolStatistics.java
@@ -12,23 +12,13 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.internal.cache.tier.sockets;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-
 /**
- * This is an interface that other modules can implement to hook into
- * {@link GenericProtocolServerConnection} to handle messages sent to Geode.
- *
- * Currently, only one {@link ClientProtocolMessageHandler} at a time can be used in a Geode
- * instance. It gets wired into {@link ServerConnectionFactory} to create all instances of
- * {@link GenericProtocolServerConnection}.
+ * Implementations of this interface record statistics for the corresponding client/server
+ * protocol
  */
-public interface ClientProtocolMessageHandler {
-  void receiveMessage(InputStream inputStream, OutputStream outputStream,
-      MessageExecutionContext executionContext) throws IOException;
+public interface ClientProtocolStatistics {
+  public void clientConnected();
+  public void clientDisconnected();
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/GenericProtocolServerConnection.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/GenericProtocolServerConnection.java
index 6c81028..ec88f4f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/GenericProtocolServerConnection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/GenericProtocolServerConnection.java
@@ -36,20 +36,26 @@ public class GenericProtocolServerConnection extends ServerConnection {
   private final ClientProtocolMessageHandler messageHandler;
   private final SecurityManager securityManager;
   private final Authenticator authenticator;
+  private boolean cleanedUp;
 
   /**
    * Creates a new <code>GenericProtocolServerConnection</code> that processes messages received
    * from an edge client over a given <code>Socket</code>.
    */
-  public GenericProtocolServerConnection(Socket s, InternalCache c, CachedRegionHelper helper,
-      CacheServerStats stats, int hsTimeout, int socketBufferSize, String communicationModeStr,
-      byte communicationMode, Acceptor acceptor, ClientProtocolMessageHandler newClientProtocol,
-      SecurityService securityService, Authenticator authenticator) {
-    super(s, c, helper, stats, hsTimeout, socketBufferSize, communicationModeStr, communicationMode,
+  public GenericProtocolServerConnection(Socket socket, InternalCache cache,
+                                         CachedRegionHelper helper,
+                                         CacheServerStats stats, int hsTimeout,
+                                         int socketBufferSize, String communicationModeStr,
+                                         byte communicationMode, Acceptor acceptor,
+                                         ClientProtocolMessageHandler newClientProtocol,
+                                         SecurityService securityService,
+                                         Authenticator authenticator) {
+    super(socket, cache, helper, stats, hsTimeout, socketBufferSize, communicationModeStr, communicationMode,
         acceptor, securityService);
     securityManager = securityService.getSecurityManager();
     this.messageHandler = newClientProtocol;
     this.authenticator = authenticator;
+    this.messageHandler.getStatistics().clientConnected();
   }
 
   @Override
@@ -76,6 +82,17 @@ public class GenericProtocolServerConnection extends ServerConnection {
   }
 
   @Override
+  public boolean cleanup() {
+    synchronized(this) {
+      if (!cleanedUp) {
+        cleanedUp = true;
+        messageHandler.getStatistics().clientDisconnected();
+      }
+    }
+    return super.cleanup();
+  }
+
+  @Override
   protected boolean doHandShake(byte epType, int qSize) {
     // no handshake for new client protocol.
     return true;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java
index f0348c3..1604db6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache.tier.sockets;
 
 import static org.apache.geode.internal.cache.tier.CommunicationMode.ProtobufClientServerProtocol;
 
+import org.apache.geode.StatisticsFactory;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.tier.Acceptor;
 import org.apache.geode.internal.cache.tier.CachedRegionHelper;
@@ -24,6 +25,7 @@ import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.security.server.Authenticator;
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.net.Socket;
 import java.util.HashMap;
 import java.util.Map;
@@ -36,7 +38,8 @@ public class ServerConnectionFactory {
   private ClientProtocolMessageHandler protocolHandler;
   private Map<String, Class<? extends Authenticator>> authenticators = null;
 
-  public ServerConnectionFactory() {}
+  public ServerConnectionFactory() {
+  }
 
   private synchronized void initializeAuthenticatorsMap() {
     if (authenticators != null) {
@@ -49,12 +52,14 @@ public class ServerConnectionFactory {
     }
   }
 
-  private synchronized ClientProtocolMessageHandler initializeMessageHandler() {
+  private synchronized ClientProtocolMessageHandler initializeMessageHandler(
+      StatisticsFactory statisticsFactory, String statisticsName) {
     if (protocolHandler != null) {
       return protocolHandler;
     }
 
     protocolHandler = new MessageHandlerFactory().makeMessageHandler();
+    protocolHandler.initializeStatistics(statisticsName, statisticsFactory);
 
     return protocolHandler;
   }
@@ -78,16 +83,21 @@ public class ServerConnectionFactory {
     }
   }
 
-  private ClientProtocolMessageHandler getClientProtocolMessageHandler() {
+  private ClientProtocolMessageHandler getOrCreateClientProtocolMessageHandler(
+      StatisticsFactory statisticsFactory, Acceptor acceptor) {
     if (protocolHandler == null) {
-      initializeMessageHandler();
+      return initializeMessageHandler(statisticsFactory, acceptor.getServerName());
     }
     return protocolHandler;
   }
 
-  public ServerConnection makeServerConnection(Socket s, InternalCache c, CachedRegionHelper helper,
-      CacheServerStats stats, int hsTimeout, int socketBufferSize, String communicationModeStr,
-      byte communicationMode, Acceptor acceptor, SecurityService securityService)
+  public ServerConnection makeServerConnection(Socket socket, InternalCache cache,
+                                               CachedRegionHelper helper,
+                                               CacheServerStats stats, int hsTimeout,
+                                               int socketBufferSize, String communicationModeStr,
+                                               byte communicationMode, Acceptor acceptor,
+                                               SecurityService securityService,
+                                               InetAddress bindAddress)
       throws IOException {
     if (communicationMode == ProtobufClientServerProtocol.getModeNumber()) {
       if (!Boolean.getBoolean("geode.feature-protobuf-protocol")) {
@@ -96,12 +106,15 @@ public class ServerConnectionFactory {
         String authenticationMode =
             System.getProperty("geode.protocol-authentication-mode", "NOOP");
 
-        return new GenericProtocolServerConnection(s, c, helper, stats, hsTimeout, socketBufferSize,
-            communicationModeStr, communicationMode, acceptor, getClientProtocolMessageHandler(),
+        return new GenericProtocolServerConnection(socket, cache, helper, stats, hsTimeout,
+            socketBufferSize,
+            communicationModeStr, communicationMode, acceptor,
+            getOrCreateClientProtocolMessageHandler(
+                cache.getDistributedSystem(), acceptor),
             securityService, findStreamAuthenticator(authenticationMode));
       }
     } else {
-      return new LegacyServerConnection(s, c, helper, stats, hsTimeout, socketBufferSize,
+      return new LegacyServerConnection(socket, cache, helper, stats, hsTimeout, socketBufferSize,
           communicationModeStr, communicationMode, acceptor, securityService);
     }
   }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactoryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactoryTest.java
index 09c5949..56d3770 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactoryTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactoryTest.java
@@ -107,7 +107,7 @@ public class ServerConnectionFactoryTest {
 
     return new ServerConnectionFactory().makeServerConnection(socketMock, mock(InternalCache.class),
         mock(CachedRegionHelper.class), mock(CacheServerStats.class), 0, 0, "", communicationMode,
-        mock(AcceptorImpl.class), mock(SecurityService.class));
+        mock(AcceptorImpl.class), mock(SecurityService.class), InetAddress.getLocalHost());
   }
 
 }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java
index bd23223..5f101fb 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java
@@ -84,7 +84,8 @@ public class ServerConnectionTest {
 
     serverConnection =
         new ServerConnectionFactory().makeServerConnection(socket, cache, null, null, 0, 0, null,
-            CommunicationMode.PrimaryServerToClient.getModeNumber(), acceptor, securityService);
+            CommunicationMode.PrimaryServerToClient.getModeNumber(), acceptor, securityService,
+            InetAddress.getLocalHost());
     MockitoAnnotations.initMocks(this);
   }
 
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufClientStatistics.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufClientStatistics.java
new file mode 100644
index 0000000..ecd61f3
--- /dev/null
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufClientStatistics.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.protocol.protobuf;
+
+import org.apache.geode.StatisticDescriptor;
+import org.apache.geode.Statistics;
+import org.apache.geode.StatisticsFactory;
+import org.apache.geode.StatisticsType;
+import org.apache.geode.internal.cache.tier.sockets.ClientProtocolStatistics;
+
+public class ProtobufClientStatistics implements ClientProtocolStatistics {
+  private final StatisticsType statType;
+  private final Statistics stats;
+  private final int currentClientConnectionsId;
+  private final int clientConnectionTerminationsId;
+  private final int clientConnectionStartsId;
+  private final int bytesReceivedId;
+  private final int bytesSentId;
+
+  public ProtobufClientStatistics(StatisticsFactory statisticsFactory, String statisticsName, String typeName) {
+    StatisticDescriptor[] serverStatDescriptors = new StatisticDescriptor[]{
+        statisticsFactory.createIntGauge("currentClientConnections",
+            "Number of sockets accepted and used for client to server messaging.", "sockets"),
+        statisticsFactory.createIntCounter("clientConnectionStarts",
+            "Number of sockets accepted and used for client to server messaging.", "sockets"),
+        statisticsFactory.createIntCounter("clientConnectionTerminations",
+            "Number of sockets that were used for client to server messaging.", "sockets"),
+        statisticsFactory.createLongCounter("bytesReceived",
+            "Bytes received from client messaging.", "bytes"),
+        statisticsFactory.createLongCounter("bytesSent",
+            "Bytes sent for client messaging.", "bytes")
+    };
+    statType = statisticsFactory.createType(typeName, "Protobuf client/server statistics", serverStatDescriptors);
+    this.stats = statisticsFactory.createAtomicStatistics(statType, statisticsName);
+    currentClientConnectionsId = this.stats.nameToId("currentClientConnections");
+    clientConnectionStartsId = this.stats.nameToId("clientConnectionStarts");
+    clientConnectionTerminationsId = this.stats.nameToId("clientConnectionTerminations");
+    bytesReceivedId = this.stats.nameToId("bytesReceived");
+    bytesSentId = this.stats.nameToId("bytesSent");
+  }
+
+  @Override
+  public void clientConnected() {
+    stats.incInt(currentClientConnectionsId, 1);
+    stats.incInt(clientConnectionStartsId, 1);
+  }
+
+  @Override
+  public void clientDisconnected() {
+    stats.incInt(currentClientConnectionsId, -1);
+    stats.incInt(clientConnectionTerminationsId, 1);
+  }
+
+  public void messageReceived(int bytes) {
+    stats.incLong(bytesReceivedId, bytes);
+  }
+
+  public void messageSent(int bytes) {
+    stats.incLong(bytesSentId, bytes);
+  }
+}
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufStreamProcessor.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufStreamProcessor.java
index f28c310..fb6e4c6 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufStreamProcessor.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufStreamProcessor.java
@@ -19,8 +19,10 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import org.apache.geode.StatisticsFactory;
 import org.apache.geode.annotations.Experimental;
 import org.apache.geode.internal.cache.tier.sockets.ClientProtocolMessageHandler;
+import org.apache.geode.internal.cache.tier.sockets.ClientProtocolStatistics;
 import org.apache.geode.internal.cache.tier.sockets.MessageExecutionContext;
 import org.apache.geode.protocol.exception.InvalidProtocolMessageException;
 import org.apache.geode.internal.protocol.protobuf.ClientProtocol;
@@ -38,6 +40,7 @@ import org.apache.geode.serialization.registry.exception.CodecAlreadyRegisteredF
 public class ProtobufStreamProcessor implements ClientProtocolMessageHandler {
   private final ProtobufProtocolSerializer protobufProtocolSerializer;
   private final ProtobufOpsProcessor protobufOpsProcessor;
+  private ProtobufClientStatistics statistics;
 
   public ProtobufStreamProcessor() throws CodecAlreadyRegisteredForTypeException {
     protobufProtocolSerializer = new ProtobufProtocolSerializer();
@@ -46,6 +49,16 @@ public class ProtobufStreamProcessor implements ClientProtocolMessageHandler {
   }
 
   @Override
+  public void initializeStatistics(String statisticsName, StatisticsFactory factory) {
+    statistics = new ProtobufClientStatistics(factory, statisticsName, "ProtobufServerStats");
+  }
+
+  @Override
+  public ClientProtocolStatistics getStatistics() {
+    return statistics;
+  }
+
+  @Override
   public void receiveMessage(InputStream inputStream, OutputStream outputStream,
       MessageExecutionContext executionContext) throws IOException {
     try {
@@ -62,6 +75,7 @@ public class ProtobufStreamProcessor implements ClientProtocolMessageHandler {
     if (message == null) {
       throw new EOFException("Tried to deserialize protobuf message at EOF");
     }
+    statistics.messageReceived(message.getSerializedSize());
 
     ClientProtocol.Request request = message.getRequest();
     ClientProtocol.Response response = protobufOpsProcessor.process(request, executionContext);
@@ -69,6 +83,7 @@ public class ProtobufStreamProcessor implements ClientProtocolMessageHandler {
         ProtobufUtilities.createMessageHeaderForRequest(message);
     ClientProtocol.Message responseMessage =
         ProtobufUtilities.createProtobufResponse(responseHeader, response);
+    statistics.messageSent(responseMessage.getSerializedSize());
     protobufProtocolSerializer.serialize(responseMessage, outputStream);
   }
 }
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
index cc15e4f..82cfeb8 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
@@ -126,6 +126,9 @@ public class RoundTripCacheConnectionJUnitTest {
     cacheFactory.set(ConfigurationProperties.MCAST_PORT, "0");
     cacheFactory.set(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false");
     cacheFactory.set(ConfigurationProperties.USE_CLUSTER_CONFIGURATION, "false");
+    cacheFactory.set(ConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true");
+    cacheFactory.set(ConfigurationProperties.STATISTIC_SAMPLE_RATE, "100");
+    cacheFactory.set(ConfigurationProperties.STATISTIC_ARCHIVE_FILE, getClass().getSimpleName()+"_"+testName.getMethodName()+".gfs");
     cache = cacheFactory.create();
 
     CacheServer cacheServer = cache.addCacheServer();
@@ -208,6 +211,7 @@ public class RoundTripCacheConnectionJUnitTest {
         ProtobufUtilities.createProtobufRequestWithGetAllRequest(getAllRequest));
     protobufProtocolSerializer.serialize(getAllMessage, outputStream);
     validateGetAllResponse(socket, protobufProtocolSerializer);
+    Thread.sleep(3000);
   }
 
   @Test
@@ -297,6 +301,9 @@ public class RoundTripCacheConnectionJUnitTest {
     CacheFactory cacheFactory = new CacheFactory();
     cacheFactory.set(ConfigurationProperties.LOCATORS, "");
     cacheFactory.set(ConfigurationProperties.MCAST_PORT, "0");
+    cacheFactory.set(ConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true");
+    cacheFactory.set(ConfigurationProperties.STATISTIC_SAMPLE_RATE, "100");
+    cacheFactory.set(ConfigurationProperties.STATISTIC_ARCHIVE_FILE, getClass().getSimpleName()+"_"+testName.getMethodName()+".gfs");
     cache = cacheFactory.create();
 
     CacheServer cacheServer = cache.addCacheServer();
@@ -326,6 +333,7 @@ public class RoundTripCacheConnectionJUnitTest {
       assertEquals(-1, socket.getInputStream().read()); // EOF implies disconnected.
     }
 
+    Thread.sleep(15000);
     for (Socket currentSocket : sockets) {
       currentSocket.close();
     }
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripLocatorConnectionDUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripLocatorConnectionDUnitTest.java
index 5b627b8..9603caf 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripLocatorConnectionDUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripLocatorConnectionDUnitTest.java
@@ -19,6 +19,7 @@ import static org.apache.geode.internal.cache.tier.CommunicationMode.ProtobufCli
 import static org.junit.Assert.assertEquals;
 
 import java.io.DataOutputStream;
+import java.io.File;
 import java.io.IOException;
 import java.net.Socket;
 
@@ -29,7 +30,9 @@ import org.junit.contrib.java.lang.system.RestoreSystemProperties;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.distributed.Locator;
+import org.apache.geode.internal.Config;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.protocol.exception.InvalidProtocolMessageException;
 import org.apache.geode.internal.protocol.protobuf.ClientProtocol;
@@ -51,6 +54,7 @@ import org.junit.experimental.categories.Category;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.net.Socket;
+import java.util.Properties;
 
 @Category(DistributedTest.class)
 public class RoundTripLocatorConnectionDUnitTest extends JUnit4CacheTestCase {
@@ -129,6 +133,20 @@ public class RoundTripLocatorConnectionDUnitTest extends JUnit4CacheTestCase {
         messageResponse.getErrorResponse().getError().getErrorCode());
   }
 
+  @Override
+  public Properties getDistributedSystemProperties() {
+    Properties properties = super.getDistributedSystemProperties();
+    properties.put(ConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true");
+    properties.put(ConfigurationProperties.STATISTIC_SAMPLE_RATE, "100");
+    String statFileName = getUniqueName() + ".gfs";
+    properties.put(ConfigurationProperties.STATISTIC_ARCHIVE_FILE, statFileName);
+    File statFile = new File(statFileName);
+    if (statFile.exists()) {
+      statFile.delete();
+    }
+    return properties;
+  }
+
   private Integer startCacheWithCacheServer() throws IOException {
     System.setProperty("geode.feature-protobuf-protocol", "true");
 

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <co...@geode.apache.org>.