diff --git a/src/vlib/CMakeLists.txt b/src/vlib/CMakeLists.txt
index c3dfba9..b187f98 100644
--- a/src/vlib/CMakeLists.txt
+++ b/src/vlib/CMakeLists.txt
@@ -66,6 +66,7 @@
   cli_funcs.h
   cli.h
   counter.h
+  counter_types.h
   defs.h
   error_funcs.h
   error.h
diff --git a/src/vlib/counter.c b/src/vlib/counter.c
index 6afa73e..5c3350f 100644
--- a/src/vlib/counter.c
+++ b/src/vlib/counter.c
@@ -99,7 +99,7 @@
     vec_validate_aligned (cm->counters[i], index, CLIB_CACHE_LINE_BYTES);
 
   vlib_stats_pop_heap (cm, oldheap,
-		       3 /* STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE */ );
+		       2 /* STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE */ );
 }
 
 void
@@ -114,7 +114,7 @@
     vec_validate_aligned (cm->counters[i], index, CLIB_CACHE_LINE_BYTES);
 
   vlib_stats_pop_heap (cm, oldheap,
-		       4 /*STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED */ );
+		       3 /*STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED */ );
 }
 
 u32
diff --git a/src/vlib/counter.h b/src/vlib/counter.h
index fe5279a..3aacc9b 100644
--- a/src/vlib/counter.h
+++ b/src/vlib/counter.h
@@ -40,6 +40,8 @@
 #ifndef included_vlib_counter_h
 #define included_vlib_counter_h
 
+#include <vlib/counter_types.h>
+
 /** \file
 
     Optimized thread-safe counters.
@@ -50,9 +52,6 @@
     The idea is to drastically eliminate atomic operations.
 */
 
-/** 64bit counters */
-typedef u64 counter_t;
-
 /** A collection of simple counters */
 
 typedef struct
@@ -135,14 +134,6 @@
     }
 }
 
-/** Combined counter to hold both packets and byte differences.
- */
-typedef struct
-{
-  counter_t packets;			/**< packet counter */
-  counter_t bytes;			/**< byte counter  */
-} vlib_counter_t;
-
 /** Add two combined counters, results in the first counter
     @param [in,out] a - (vlib_counter_t *) dst counter
     @param b - (vlib_counter_t *) src counter
diff --git a/src/vlib/counter_types.h b/src/vlib/counter_types.h
new file mode 100644
index 0000000..d6ce27f
--- /dev/null
+++ b/src/vlib/counter_types.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ * Licensed 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.
+ */
+
+#ifndef included_vlib_counter_types_h
+#define included_vlib_counter_types_h
+
+#include <stdint.h>
+
+/** 64bit counters */
+typedef uint64_t counter_t;
+
+/** Combined counter to hold both packets and byte differences.
+ */
+typedef struct
+{
+  counter_t packets;			/**< packet counter */
+  counter_t bytes;			/**< byte counter  */
+} vlib_counter_t;
+
+#endif
diff --git a/src/vlib/error.c b/src/vlib/error.c
index aa53324..9fc1e70 100644
--- a/src/vlib/error.c
+++ b/src/vlib/error.c
@@ -140,9 +140,10 @@
 };
 /* *INDENT-ON* */
 
-void vlib_stats_register_error_index (u8 *, u64) __attribute__ ((weak));
+void vlib_stats_register_error_index (u8 *, u64 *, u64)
+  __attribute__ ((weak));
 void
-vlib_stats_register_error_index (u8 * notused, u64 notused2)
+vlib_stats_register_error_index (u8 * notused, u64 * notused2, u64 notused3)
 {
 };
 
@@ -210,7 +211,8 @@
       {
 	error_name = format (0, "/err/%v/%s%c", n->name, error_strings[i], 0);
 	/* Note: error_name consumed by the following call */
-	vlib_stats_register_error_index (error_name, n->error_heap_index + i);
+	vlib_stats_register_error_index (error_name, em->counters,
+					 n->error_heap_index + i);
       }
   }
 
diff --git a/src/vpp-api/CMakeLists.txt b/src/vpp-api/CMakeLists.txt
index 872e9cc..0f2510d 100644
--- a/src/vpp-api/CMakeLists.txt
+++ b/src/vpp-api/CMakeLists.txt
@@ -20,8 +20,7 @@
   client/client.c
   client/stat_client.c
   client/libvppapiclient.map
-
-  LINK_LIBRARIES vppinfra vlibmemoryclient svm pthread m rt
+  LINK_LIBRARIES vppinfra vlibmemoryclient pthread
 )
 add_dependencies(vppapiclient vpp_version_h api_headers)
 
diff --git a/src/vpp-api/client/libvppapiclient.map b/src/vpp-api/client/libvppapiclient.map
index f51b924..00a26fb 100644
--- a/src/vpp-api/client/libvppapiclient.map
+++ b/src/vpp-api/client/libvppapiclient.map
@@ -15,8 +15,6 @@
 	api_main;
 	stat_segment_connect;
 	stat_segment_disconnect;
-	stat_segment_register;
-	stat_segment_collect;
 	stat_segment_ls;
 	stat_segment_dump;
 	stat_segment_data_free;
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c
index ad7078e..b5aab74 100644
--- a/src/vpp-api/client/stat_client.c
+++ b/src/vpp-api/client/stat_client.c
@@ -17,72 +17,122 @@
  *------------------------------------------------------------------
  */
 
-#include <vlib/vlib.h>
-#include <vppinfra/socket.h>
-#include <svm/ssvm.h>
-#include <vpp/stats/stats.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <stdbool.h>
+#include <sys/stat.h>
 #include <regex.h>
+#include <assert.h>
+#include <vppinfra/vec.h>
+#include <vppinfra/lock.h>
 #include "stat_client.h"
+#include <stdatomic.h>
 
 typedef struct
 {
-  u64 current_epoch;
-  volatile int segment_ready;
-  ssvm_private_t stat_segment;	/* mapped stats segment object */
-  ssvm_shared_header_t *shared_header;
-  clib_spinlock_t *stat_segment_lockp;	/* Spinlock for the stats segment */
-  uword *counter_vector_by_name;
-  u64 *error_base;
+  uint64_t current_epoch;
+  stat_segment_shared_header_t *shared_header;
+  stat_segment_directory_entry_t *directory_vector;
+  ssize_t memory_size;
 } stat_client_main_t;
 
 stat_client_main_t stat_client_main;
 
+static int
+recv_fd (int sock)
+{
+  struct msghdr msg = { 0 };
+  struct cmsghdr *cmsg;
+  int fd = -1;
+  char iobuf[1];
+  struct iovec io = {.iov_base = iobuf,.iov_len = sizeof (iobuf) };
+  union
+  {
+    char buf[CMSG_SPACE (sizeof (fd))];
+    struct cmsghdr align;
+  } u;
+  msg.msg_iov = &io;
+  msg.msg_iovlen = 1;
+  msg.msg_control = u.buf;
+  msg.msg_controllen = sizeof (u.buf);
+
+  ssize_t size;
+  if ((size = recvmsg (sock, &msg, 0)) < 0)
+    {
+      perror ("recvmsg failed");
+      return -1;
+    }
+  cmsg = CMSG_FIRSTHDR (&msg);
+  if (cmsg && cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS)
+    {
+      memmove (&fd, CMSG_DATA (cmsg), sizeof (fd));
+    }
+  return fd;
+}
+
+static stat_segment_directory_entry_t *
+get_stat_vector (void)
+{
+  stat_client_main_t *sm = &stat_client_main;
+  ASSERT (sm->shared_header);
+  return stat_segment_pointer (sm->shared_header,
+			       sm->shared_header->directory_offset);
+}
+
 int
 stat_segment_connect (char *socket_name)
 {
   stat_client_main_t *sm = &stat_client_main;
-  ssvm_private_t *ssvmp = &sm->stat_segment;
-  clib_socket_t s = { 0 };
-  clib_error_t *err;
-  int fd = -1, retval;
+  int mfd = -1;
+  int sock;
 
   memset (sm, 0, sizeof (*sm));
-  s.config = socket_name;
-  s.flags = CLIB_SOCKET_F_IS_CLIENT | CLIB_SOCKET_F_SEQPACKET;
-  err = clib_socket_init (&s);
-  if (err)
+  if ((sock = socket (AF_UNIX, SOCK_SEQPACKET, 0)) < 0)
     {
-      clib_error_report (err);
-      return -1;
-    }
-  err = clib_socket_recvmsg (&s, 0, 0, &fd, 1);
-  if (err)
-    {
-      clib_error_report (err);
-      return -1;
-    }
-  clib_socket_close (&s);
-
-  memset (ssvmp, 0, sizeof (*ssvmp));
-  ssvmp->fd = fd;
-
-  /* Note: this closes memfd.fd */
-  retval = ssvm_slave_init_memfd (ssvmp);
-  if (retval)
-    {
-      fprintf (stderr, "WARNING: segment map returned %d\n", retval);
+      perror ("Couldn't open socket");
       return -1;
     }
 
-  ASSERT (ssvmp && ssvmp->sh);
+  struct sockaddr_un un = { 0 };
+  un.sun_family = AF_UNIX;
+  strncpy ((char *) un.sun_path, socket_name, sizeof (un.sun_path) - 1);
+  if (connect (sock, (struct sockaddr *) &un, sizeof (struct sockaddr_un)) <
+      0)
+    {
+      perror ("connect");
+      return -1;
+    }
 
-  /* Pick up the segment lock from the shared memory header */
-  sm->shared_header = ssvmp->sh;
-  sm->stat_segment_lockp = (clib_spinlock_t *) (sm->shared_header->opaque[0]);
-  sm->segment_ready = 1;
+  if ((mfd = recv_fd (sock)) < 0)
+    {
+      fprintf (stderr, "Receiving file descriptor failed\n");
+      return -1;
+    }
+  close (sock);
 
-  sm->counter_vector_by_name =
-    (uword *) sm->shared_header->opaque[STAT_SEGMENT_OPAQUE_DIR];
+  /* mmap shared memory segment. */
+  void *memaddr;
+  struct stat st = { 0 };
+
+  if (fstat (mfd, &st) == -1)
+    {
+      perror ("mmap");
+      return -1;
+    }
+  if ((memaddr =
+       mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, mfd, 0)) == MAP_FAILED)
+    {
+      perror ("mmap");
+      return -1;
+    }
+
+  sm->memory_size = st.st_size;
+  sm->shared_header = memaddr;
+  sm->directory_vector =
+    stat_segment_pointer (memaddr, sm->shared_header->directory_offset);
 
   return 0;
 }
@@ -91,146 +141,72 @@
 stat_segment_disconnect (void)
 {
   stat_client_main_t *sm = &stat_client_main;
-  ssvm_delete_memfd (&sm->stat_segment);
+  munmap (sm->shared_header, sm->memory_size);
+
   return;
 }
 
-/*
- * The application needs to register which counters it is interested
- * in.
- */
-stat_segment_cached_pointer_t *
-stat_segment_register (u8 * stats[])
-{
-  int i;
-  uword *p;
-  stat_client_main_t *sm = &stat_client_main;
-  stat_segment_cached_pointer_t *cp, *cached_pointer_vec = 0;
-
-  for (i = 0; i < vec_len (stats); i++)
-    {
-      p = hash_get_mem (sm->counter_vector_by_name, stats[i]);
-      if (p == 0)
-	{
-	  fprintf (stderr, "WARN: %s not in directory!\n", stats[i]);
-	  continue;
-	}
-      vec_add2 (cached_pointer_vec, cp, 1);
-      cp->name = strdup ((char *) stats[i]);	// Point to p->key instead?
-    }
-  return cached_pointer_vec;
-}
-
-static u64 *
-get_error_base (u32 thread_index)
-{
-  u64 *error_base = 0;
-  uword *p;
-  stat_client_main_t *sm = &stat_client_main;
-  stat_segment_directory_entry_t *ep;
-
-  /* Special case /err/0/counter_vector */
-  p = hash_get_mem (sm->counter_vector_by_name,
-		    format (0, "/err/%d/counter_vector", thread_index));
-  if (p)
-    {
-      ep = (stat_segment_directory_entry_t *) (p[0]);
-      error_base = ep->value;
-    }
-  return error_base;
-}
-
-f64
+double
 stat_segment_heartbeat (void)
 {
-  f64 *heartbeat = 0;
-  uword *p;
   stat_client_main_t *sm = &stat_client_main;
-  stat_segment_directory_entry_t *ep;
-
-  /* Special case /err/0/counter_vector */
-  p = hash_get_mem (sm->counter_vector_by_name,
-		    format (0, "/sys/heartbeat%c", 0));
-  if (p)
-    {
-      ep = (stat_segment_directory_entry_t *) (p[0]);
-      heartbeat = ep->value;
-    }
-  return *heartbeat;
-}
-
-static void
-maybe_update_cached_pointers (stat_segment_cached_pointer_t * cached_pointers)
-{
-  stat_client_main_t *sm = &stat_client_main;
-  stat_segment_cached_pointer_t *cp;
-  uword *p;
-  int i;
-
-  /* Cached pointers OK? */
-  if (sm->current_epoch ==
-      (u64) sm->shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH])
-    return;
-
-  /* Special case /err/0/counter_vector */
-  sm->error_base = get_error_base (0);
-
-  /* Nope, fix them... */
-  for (i = 0; i < vec_len (cached_pointers); i++)
-    {
-      cp = &cached_pointers[i];
-
-      p = hash_get_mem (sm->counter_vector_by_name, cp->name);
-      if (p == 0)
-	{
-	  fprintf (stderr, "WARN: %s not in directory!\n", cp->name);
-	  continue;
-	}
-      cp->ep = (stat_segment_directory_entry_t *) (p[0]);
-    }
-
-  /* And remember that we did... */
-  sm->current_epoch =
-    (u64) sm->shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH];
+  stat_segment_directory_entry_t *vec = get_stat_vector ();
+  double *hb = stat_segment_pointer (sm->shared_header, vec[4].offset);
+  return *hb;
 }
 
 stat_segment_data_t
-copy_data (stat_segment_directory_entry_t * ep, u64 * error_base, char *name)
+copy_data (stat_segment_directory_entry_t * ep)
 {
+  stat_client_main_t *sm = &stat_client_main;
   stat_segment_data_t result = { 0 };
-  u32 error_index;
   int i;
   vlib_counter_t **combined_c;	/* Combined counter */
   counter_t **simple_c;		/* Simple counter */
+  counter_t *error_base;
+  uint64_t *offset_vector;
+
+  assert (sm->shared_header);
+
   result.type = ep->type;
-  result.name = name;
+  result.name = strdup (ep->name);
   switch (ep->type)
     {
-    case STAT_DIR_TYPE_SCALAR_POINTER:
-      result.scalar_value = *(f64 *) ep->value;
-      break;
-
-    case STAT_DIR_TYPE_VECTOR_POINTER:
-      result.vector_pointer = ep->value;
+    case STAT_DIR_TYPE_SCALAR_INDEX:
+      result.scalar_value = ep->value;
       break;
 
     case STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE:
-      simple_c = ep->value;
+      simple_c = stat_segment_pointer (sm->shared_header, ep->offset);
       result.simple_counter_vec = vec_dup (simple_c);
+      offset_vector =
+	stat_segment_pointer (sm->shared_header, ep->offset_vector);
       for (i = 0; i < vec_len (simple_c); i++)
-	result.simple_counter_vec[i] = vec_dup (simple_c[i]);
+	{
+	  counter_t *cb =
+	    stat_segment_pointer (sm->shared_header, offset_vector[i]);
+	  result.simple_counter_vec[i] = vec_dup (cb);
+	}
       break;
 
     case STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED:
-      combined_c = ep->value;
+      combined_c = stat_segment_pointer (sm->shared_header, ep->offset);
       result.combined_counter_vec = vec_dup (combined_c);
+      offset_vector =
+	stat_segment_pointer (sm->shared_header, ep->offset_vector);
       for (i = 0; i < vec_len (combined_c); i++)
-	result.combined_counter_vec[i] = vec_dup (combined_c[i]);
+	{
+	  vlib_counter_t *cb =
+	    stat_segment_pointer (sm->shared_header, offset_vector[i]);
+	  result.combined_counter_vec[i] = vec_dup (cb);
+	}
       break;
 
     case STAT_DIR_TYPE_ERROR_INDEX:
-      error_index = (uintptr_t) ep->value;
-      result.error_value = error_base[error_index];
+      error_base =
+	stat_segment_pointer (sm->shared_header,
+			      sm->shared_header->error_offset);
+      result.error_value = error_base[ep->index];
       break;
 
     default:
@@ -239,32 +215,6 @@
   return result;
 }
 
-stat_segment_data_t *
-stat_segment_collect (stat_segment_cached_pointer_t * cached_pointers)
-{
-  stat_client_main_t *sm = &stat_client_main;
-  stat_segment_data_t *res = 0;
-  int i;
-
-  /* Grab the stats segment lock */
-  clib_spinlock_lock (sm->stat_segment_lockp);
-
-  /* see if we need to update cached pointers */
-  maybe_update_cached_pointers (cached_pointers);
-
-  for (i = 0; i < vec_len (cached_pointers); i++)
-    {
-      vec_add1 (res,
-		copy_data (cached_pointers[i].ep, sm->error_base,
-			   cached_pointers[i].name));
-    }
-
-  /* Drop the lock */
-  clib_spinlock_unlock (sm->stat_segment_lockp);
-
-  return res;
-}
-
 void
 stat_segment_data_free (stat_segment_data_t * res)
 {
@@ -286,19 +236,48 @@
 	default:
 	  ;
 	}
+      free (res[i].name);
     }
   vec_free (res);
 }
 
-u8 **
-stat_segment_ls (u8 ** patterns)
+
+typedef struct
+{
+  uint64_t epoch;
+} stat_segment_access_t;
+
+static void
+stat_segment_access_start (stat_segment_access_t * sa)
 {
   stat_client_main_t *sm = &stat_client_main;
-  hash_pair_t *p;
-  u8 **dir = 0;
+  stat_segment_shared_header_t *shared_header = sm->shared_header;
+  sa->epoch = shared_header->epoch;
+  while (shared_header->in_progress != 0)
+    ;
+}
+
+static bool
+stat_segment_access_end (stat_segment_access_t * sa)
+{
+  stat_client_main_t *sm = &stat_client_main;
+  stat_segment_shared_header_t *shared_header = sm->shared_header;
+
+  if (shared_header->epoch != sa->epoch || shared_header->in_progress)
+    return false;
+  return true;
+}
+
+uint32_t *
+stat_segment_ls (uint8_t ** patterns)
+{
+  stat_client_main_t *sm = &stat_client_main;
+  stat_segment_access_t sa;
+
+  uint32_t *dir = 0;
   regex_t regex[vec_len (patterns)];
 
-  int i;
+  int i, j;
   for (i = 0; i < vec_len (patterns); i++)
     {
       int rv = regcomp (&regex[i], (char *) patterns[i], 0);
@@ -309,58 +288,67 @@
 	}
     }
 
-  clib_spinlock_lock (sm->stat_segment_lockp);
+  stat_segment_access_start (&sa);
 
-  /* *INDENT-OFF* */
-  hash_foreach_pair (p, sm->counter_vector_by_name,
-  ({
-    for (i = 0; i < vec_len(patterns); i++) {
-      int rv = regexec(&regex[i], (char *)p->key, 0, NULL, 0);
-      if (rv == 0) {
-	vec_add1 (dir, (u8 *)p->key);
-	break;
-      }
+  stat_segment_directory_entry_t *counter_vec = get_stat_vector ();
+  for (j = 0; j < vec_len (counter_vec); j++)
+    {
+      for (i = 0; i < vec_len (patterns); i++)
+	{
+	  int rv = regexec (&regex[i], counter_vec[j].name, 0, NULL, 0);
+	  if (rv == 0)
+	    {
+	      vec_add1 (dir, j);
+	      break;
+	    }
+	}
+      if (vec_len (patterns) == 0)
+	vec_add1 (dir, j);
     }
-    if (vec_len(patterns) == 0)
-      vec_add1 (dir, (u8 *)p->key);
-  }));
-  /* *INDENT-ON* */
-
-  clib_spinlock_unlock (sm->stat_segment_lockp);
 
   for (i = 0; i < vec_len (patterns); i++)
     regfree (&regex[i]);
 
+  if (!stat_segment_access_end (&sa))
+    {
+      /* Failed, clean up */
+      vec_free (dir);
+      return 0;
+
+    }
+
+  /* Update last version */
+  sm->current_epoch = sa.epoch;
   return dir;
 }
 
 stat_segment_data_t *
-stat_segment_dump (u8 * stats[])
+stat_segment_dump (uint32_t * stats)
 {
   int i;
-  uword *p;
   stat_client_main_t *sm = &stat_client_main;
   stat_segment_directory_entry_t *ep;
   stat_segment_data_t *res = 0;
+  stat_segment_access_t sa;
 
-  clib_spinlock_lock (sm->stat_segment_lockp);
+  /* Has directory been update? */
+  if (sm->shared_header->epoch != sm->current_epoch)
+    return 0;
 
-  sm->error_base = get_error_base (0);
+  stat_segment_access_start (&sa);
   for (i = 0; i < vec_len (stats); i++)
     {
-      p = hash_get_mem (sm->counter_vector_by_name, stats[i]);
-      if (p == 0)
-	{
-	  fprintf (stderr, "WARN: %s not in directory!\n", stats[i]);
-	  continue;
-	}
       /* Collect counter */
-      ep = (stat_segment_directory_entry_t *) (p[0]);
-      vec_add1 (res, copy_data (ep, sm->error_base, (char *) stats[i]));
+      ep = vec_elt_at_index (sm->directory_vector, stats[i]);
+      vec_add1 (res, copy_data (ep));
     }
-  clib_spinlock_unlock (sm->stat_segment_lockp);
 
-  return res;
+  if (stat_segment_access_end (&sa))
+    return res;
+
+  fprintf (stderr, "Epoch changed while reading, invalid results\n");
+  // TODO increase counter
+  return 0;
 }
 
 /* Wrapper for accessing vectors from other languages */
@@ -380,6 +368,36 @@
   return string_vector;
 }
 
+stat_segment_data_t *
+stat_segment_dump_entry (uint32_t index)
+{
+  stat_client_main_t *sm = &stat_client_main;
+  stat_segment_directory_entry_t *ep;
+  stat_segment_data_t *res = 0;
+  stat_segment_access_t sa;
+
+  stat_segment_access_start (&sa);
+
+  /* Collect counter */
+  ep = vec_elt_at_index (sm->directory_vector, index);
+  vec_add1 (res, copy_data (ep));
+
+  if (stat_segment_access_end (&sa))
+    return res;
+  return 0;
+}
+
+char *
+stat_segment_index_to_name (uint32_t index)
+{
+  char *name;
+  stat_segment_directory_entry_t *counter_vec = get_stat_vector ();
+  stat_segment_directory_entry_t *ep;
+  ep = vec_elt_at_index (counter_vec, index);
+  name = strdup (ep->name);
+  return name;
+}
+
 /*
  * fd.io coding-style-patch-verification: ON
  *
diff --git a/src/vpp-api/client/stat_client.h b/src/vpp-api/client/stat_client.h
index 73e91b1..c1a0ecf 100644
--- a/src/vpp-api/client/stat_client.h
+++ b/src/vpp-api/client/stat_client.h
@@ -17,8 +17,9 @@
 #ifndef included_stat_client_h
 #define included_stat_client_h
 
-#include <vlib/vlib.h>
-#include <vpp/stats/stats.h>
+#include <stdint.h>
+#include <vpp/stats/stat_segment.h>
+#include <vlib/counter_types.h>
 
 typedef struct
 {
@@ -26,31 +27,25 @@
   stat_directory_type_t type;
   union
   {
-    f64 scalar_value;
-    u64 error_value;
-    u64 *vector_pointer;
+    double scalar_value;
+    uint64_t error_value;
     counter_t **simple_counter_vec;
     vlib_counter_t **combined_counter_vec;
   };
 } stat_segment_data_t;
 
-typedef struct
-{
-  char *name;
-  stat_segment_directory_entry_t *ep;
-} stat_segment_cached_pointer_t;
-
 int stat_segment_connect (char *socket_name);
 void stat_segment_disconnect (void);
-u8 **stat_segment_ls (u8 ** pattern);
-stat_segment_data_t *stat_segment_dump (u8 ** counter_vec);
-stat_segment_cached_pointer_t *stat_segment_register (u8 ** counter_vec);
-/* Collects registered counters */
-stat_segment_data_t *stat_segment_collect (stat_segment_cached_pointer_t *);
-void stat_segment_data_free (stat_segment_data_t * res);
-f64 stat_segment_heartbeat (void);
-u8 **stat_segment_string_vector (u8 ** string_vector, char *string);
+uint8_t **stat_segment_string_vector (uint8_t ** string_vector, char *string);
 int stat_segment_vec_len (void *vec);
+uint32_t *stat_segment_ls (uint8_t ** pattern);
+stat_segment_data_t *stat_segment_dump (uint32_t * counter_vec);
+stat_segment_data_t *stat_segment_dump_entry (uint32_t index);
+void stat_segment_data_free (stat_segment_data_t * res);
+
+double stat_segment_heartbeat (void);
+
+char *stat_segment_index_to_name (uint32_t index);
 
 #endif /* included_stat_client_h */
 
diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py
index b84a0e5..9bdb79f 100644
--- a/src/vpp-api/python/vpp_papi/vpp_stats.py
+++ b/src/vpp-api/python/vpp_papi/vpp_stats.py
@@ -13,44 +13,42 @@
 
 typedef enum {
   STAT_DIR_TYPE_ILLEGAL = 0,
-  STAT_DIR_TYPE_SCALAR_POINTER,
-  STAT_DIR_TYPE_VECTOR_POINTER,
+  STAT_DIR_TYPE_SCALAR_INDEX,
   STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE,
   STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED,
   STAT_DIR_TYPE_ERROR_INDEX,
-  STAT_DIR_TYPE_SERIALIZED_NODES,
 } stat_directory_type_t;
 
-typedef struct {
-  stat_directory_type_t type;
-  void *value;
-} stat_segment_directory_entry_t;
-
-typedef struct {
-  char *name;
+typedef struct
+{
   stat_directory_type_t type;
   union {
+    uint64_t offset;
+    uint64_t index;
+    uint64_t value;
+  };
+  uint64_t offset_vector;
+  char name[128]; // TODO change this to pointer to "somewhere"
+} stat_segment_directory_entry_t;
+
+typedef struct
+{
+  char *name;
+  stat_directory_type_t type;
+  union
+  {
     double scalar_value;
     uint64_t error_value;
-    uint64_t *vector_pointer;
     counter_t **simple_counter_vec;
     vlib_counter_t **combined_counter_vec;
   };
 } stat_segment_data_t;
 
-typedef struct {
-  char *name;
-  stat_segment_directory_entry_t *ep;
-} stat_segment_cached_pointer_t;
-
 int stat_segment_connect (char *socket_name);
 void stat_segment_disconnect (void);
 
-uint8_t  **stat_segment_ls (uint8_t **pattern);
-stat_segment_data_t *stat_segment_dump (uint8_t ** counter_vec);
-/* Collects registered counters */
-stat_segment_cached_pointer_t *stat_segment_register (uint8_t ** counter_vec);
-stat_segment_data_t *stat_segment_collect (stat_segment_cached_pointer_t *);
+uint32_t *stat_segment_ls (uint8_t ** pattern);
+stat_segment_data_t *stat_segment_dump (uint32_t * counter_vec);
 void stat_segment_data_free (stat_segment_data_t * res);
 double stat_segment_heartbeat (void);
 int stat_segment_vec_len(void *vec);
@@ -100,11 +98,15 @@
 
 
 def stat_entry_to_python(api, e):
+    # Scalar index
+    if e.type == 1:
+        return e.scalar_value
+        return None
+    if e.type == 2:
+        return simple_counter_vec_list(api, e.simple_counter_vec)
     if e.type == 3:
-        return simple_counter_vec_list(e.simple_counter_vec)
-    if e.type == 4:
         return combined_counter_vec_list(api, e.combined_counter_vec)
-    if e.type == 5:
+    if e.type == 4:
         return e.error_value
     return None
 
@@ -129,12 +131,12 @@
         for i in range(rv_len):
             n = ffi.string(rv[i].name)
             e = stat_entry_to_python(self.api, rv[i])
-            if e:
-                stats[n] = e
+            stats[n] = e
         return stats
 
-    def dump_str(self, counters_str):
-        return self.dump(make_string_vector(self.api, counters_str))
+    def get_counter(self, name):
+        dir = self.ls(name)
+        return self.dump(dir).values()[0]
 
     def disconnect(self):
         self.api.stat_segment_disconnect()
@@ -153,9 +155,3 @@
         for k in sorted(error_counters):
             s += '{:<60}{:>10}\n'.format(k, error_counters[k])
         return s
-
-    def register(self):
-        raise NotImplemented
-
-    def collect(self):
-        raise NotImplemented
diff --git a/src/vpp/CMakeLists.txt b/src/vpp/CMakeLists.txt
index feb75cf..999b280 100644
--- a/src/vpp/CMakeLists.txt
+++ b/src/vpp/CMakeLists.txt
@@ -113,9 +113,8 @@
 
 add_vpp_executable(vpp_get_stats
   SOURCES app/vpp_get_stats.c
-  LINK_LIBRARIES vppapiclient vppinfra svm vlibmemoryclient
+  LINK_LIBRARIES vppapiclient vppinfra
   DEPENDS api_headers
-  NO_INSTALL
 )
 
 add_vpp_executable(vpp_prometheus_export
diff --git a/src/vpp/app/vpp_get_stats.c b/src/vpp/app/vpp_get_stats.c
index 908e675..c1a5acb 100644
--- a/src/vpp/app/vpp_get_stats.c
+++ b/src/vpp/app/vpp_get_stats.c
@@ -22,12 +22,17 @@
 #include <vpp/stats/stats.h>
 
 static int
-stat_poll_loop (stat_segment_cached_pointer_t * cp)
+stat_poll_loop (u8 ** patterns)
 {
   struct timespec ts, tsrem;
   stat_segment_data_t *res;
   int i, j, k, lost_connection = 0;
   f64 heartbeat, prev_heartbeat = 0;
+  u32 *stats = stat_segment_ls (patterns);
+  if (!stats)
+    {
+      return -1;
+    }
 
   printf ("\033[2J");		/*  clear the screen  */
   while (1)
@@ -49,7 +54,12 @@
 	}
 
       printf ("\033[H");	/* Cursor top left corner */
-      res = stat_segment_collect (cp);
+      res = stat_segment_dump (stats);
+      if (!res)
+	{
+	  stats = stat_segment_ls (patterns);
+	  continue;
+	}
       for (i = 0; i < vec_len (res); i++)
 	{
 	  switch (res[i].type)
@@ -57,24 +67,24 @@
 	    case STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE:
 	      for (k = 0; k < vec_len (res[i].simple_counter_vec); k++)
 		for (j = 0; j < vec_len (res[i].simple_counter_vec[k]); j++)
-		  fformat (stdout, "[%d]: %lld packets %s\n",
+		  fformat (stdout, "[%d]: %llu packets %s\n",
 			   j, res[i].simple_counter_vec[k][j], res[i].name);
 	      break;
 
 	    case STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED:
 	      for (k = 0; k < vec_len (res[i].simple_counter_vec); k++)
 		for (j = 0; j < vec_len (res[i].combined_counter_vec[k]); j++)
-		  fformat (stdout, "[%d]: %lld packets, %lld bytes %s\n",
+		  fformat (stdout, "[%d]: %llu packets, %llu bytes %s\n",
 			   j, res[i].combined_counter_vec[k][j].packets,
 			   res[i].combined_counter_vec[k][j].bytes,
 			   res[i].name);
 	      break;
 
 	    case STAT_DIR_TYPE_ERROR_INDEX:
-	      fformat (stdout, "%lld %s\n", res[i].error_value, res[i].name);
+	      fformat (stdout, "%llu %s\n", res[i].error_value, res[i].name);
 	      break;
 
-	    case STAT_DIR_TYPE_SCALAR_POINTER:
+	    case STAT_DIR_TYPE_SCALAR_INDEX:
 	      fformat (stdout, "%.2f %s\n", res[i].scalar_value, res[i].name);
 	      break;
 
@@ -99,6 +109,7 @@
   STAT_CLIENT_CMD_LS,
   STAT_CLIENT_CMD_POLL,
   STAT_CLIENT_CMD_DUMP,
+  STAT_CLIENT_CMD_TIGHTPOLL,
 };
 
 int
@@ -108,10 +119,9 @@
   u8 *stat_segment_name, *pattern = 0, **patterns = 0;
   int rv;
   enum stat_client_cmd_e cmd = STAT_CLIENT_CMD_UNKNOWN;
-  void *heap_base;
 
-  heap_base = clib_mem_vm_map ((void *) 0x10000000ULL, 128 << 20);
-  clib_mem_init (heap_base, 128 << 20);
+  /* Create a heap of 64MB */
+  clib_mem_init (0, 64 << 20);
 
   unformat_init_command_line (a, argv);
 
@@ -133,6 +143,10 @@
 	{
 	  cmd = STAT_CLIENT_CMD_POLL;
 	}
+      else if (unformat (a, "tightpoll"))
+	{
+	  cmd = STAT_CLIENT_CMD_TIGHTPOLL;
+	}
       else if (unformat (a, "%s", &pattern))
 	{
 	  vec_add1 (patterns, pattern);
@@ -154,10 +168,9 @@
       exit (1);
     }
 
-  u8 **dir;
+  u32 *dir;
   int i, j, k;
   stat_segment_data_t *res;
-  stat_segment_cached_pointer_t *cp;
 
   dir = stat_segment_ls (patterns);
 
@@ -167,7 +180,9 @@
       /* List all counters */
       for (i = 0; i < vec_len (dir); i++)
 	{
-	  printf ("%s\n", (char *) dir[i]);
+	  char *n = stat_segment_index_to_name (dir[i]);
+	  printf ("%s\n", n);
+	  free (n);
 	}
       break;
 
@@ -180,7 +195,7 @@
 	    case STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE:
 	      for (k = 0; k < vec_len (res[i].simple_counter_vec) - 1; k++)
 		for (j = 0; j < vec_len (res[i].simple_counter_vec[k]); j++)
-		  fformat (stdout, "[%d @ %d]: %lld packets %s\n",
+		  fformat (stdout, "[%d @ %d]: %llu packets %s\n",
 			   j, k, res[i].simple_counter_vec[k][j],
 			   res[i].name);
 	      break;
@@ -188,19 +203,18 @@
 	    case STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED:
 	      for (k = 0; k < vec_len (res[i].combined_counter_vec); k++)
 		for (j = 0; j < vec_len (res[i].combined_counter_vec[k]); j++)
-		  fformat (stdout, "[%d @ %d]: %lld packets, %lld bytes %s\n",
+		  fformat (stdout, "[%d @ %d]: %llu packets, %llu bytes %s\n",
 			   j, k, res[i].combined_counter_vec[k][j].packets,
 			   res[i].combined_counter_vec[k][j].bytes,
 			   res[i].name);
 	      break;
 
 	    case STAT_DIR_TYPE_ERROR_INDEX:
-	      fformat (stdout, "%lld %s\n", res[i].error_value, dir[i]);
+	      fformat (stdout, "%llu %s\n", res[i].error_value, res[i].name);
 	      break;
 
-	    case STAT_DIR_TYPE_SCALAR_POINTER:
-	      fformat (stdout, "%.2f %s\n", dir[i], res[i].scalar_value,
-		       res[i].name);
+	    case STAT_DIR_TYPE_SCALAR_INDEX:
+	      fformat (stdout, "%.2f %s\n", res[i].scalar_value, res[i].name);
 	      break;
 
 	    default:
@@ -211,19 +225,27 @@
       break;
 
     case STAT_CLIENT_CMD_POLL:
-      cp = stat_segment_register (dir);
-      if (!cp)
-	{
-	  fformat (stderr,
-		   "Couldn't register required counters with stat segment\n");
-	  exit (1);
-	}
-      stat_poll_loop (cp);
+      stat_poll_loop (patterns);
       /* We can only exist the pool loop if we lost connection to VPP */
       stat_segment_disconnect ();
       goto reconnect;
       break;
 
+    case STAT_CLIENT_CMD_TIGHTPOLL:
+      while (1)
+	{
+	  res = stat_segment_dump (dir);
+	  if (res == 0)
+	    {
+	      /* Refresh */
+	      vec_free (dir);
+	      dir = stat_segment_ls (patterns);
+	      continue;
+	    }
+	  stat_segment_data_free (res);
+	}
+      break;
+
     default:
       fformat (stderr,
 	       "%s: usage [socket-name <name>] [ls|dump|poll] <patterns> ...\n",
diff --git a/src/vpp/app/vpp_prometheus_export.c b/src/vpp/app/vpp_prometheus_export.c
index 4fd749a..65e0147 100644
--- a/src/vpp/app/vpp_prometheus_export.c
+++ b/src/vpp/app/vpp_prometheus_export.c
@@ -30,7 +30,6 @@
 #include <sys/socket.h>
 #include <vpp-api/client/stat_client.h>
 #include <vlib/vlib.h>
-#include <vpp/stats/stats.h>
 #include <ctype.h>
 
 /* https://github.com/prometheus/prometheus/wiki/Default-port-allocations */
@@ -50,12 +49,22 @@
 }
 
 static void
-dump_metrics (FILE * stream, stat_segment_cached_pointer_t * cp)
+dump_metrics (FILE * stream, u8 ** patterns)
 {
   stat_segment_data_t *res;
   int i, j, k;
+  static u32 *stats = 0;
 
-  res = stat_segment_collect (cp);
+retry:
+  res = stat_segment_dump (stats);
+  if (res == 0)
+    {				/* Memory layout has changed */
+      if (stats)
+	vec_free (stats);
+      stats = stat_segment_ls (patterns);
+      goto retry;
+    }
+
   for (i = 0; i < vec_len (res); i++)
     {
       switch (res[i].type)
@@ -93,7 +102,7 @@
 		   prom_string (res[i].name), res[i].error_value);
 	  break;
 
-	case STAT_DIR_TYPE_SCALAR_POINTER:
+	case STAT_DIR_TYPE_SCALAR_INDEX:
 	  fformat (stream, "# TYPE %s counter\n", prom_string (res[i].name));
 	  fformat (stream, "%s %.2f\n", prom_string (res[i].name),
 		   res[i].scalar_value);
@@ -113,7 +122,7 @@
 #define NOT_FOUND_ERROR "<html><head><title>Document not found</title></head><body><h1>404 - Document not found</h1></body></html>"
 
 static void
-http_handler (FILE * stream, stat_segment_cached_pointer_t * cp)
+http_handler (FILE * stream, u8 ** patterns)
 {
   char status[80] = { 0 };
   if (fgets (status, sizeof (status) - 1, stream) == 0)
@@ -165,7 +174,7 @@
       return;
     }
   fputs ("HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\n", stream);
-  dump_metrics (stream, cp);
+  dump_metrics (stream, patterns);
 }
 
 static int
@@ -223,10 +232,9 @@
   unformat_input_t _argv, *a = &_argv;
   u8 *stat_segment_name, *pattern = 0, **patterns = 0;
   int rv;
-  void *heap_base;
 
-  heap_base = clib_mem_vm_map ((void *) 0x10000000ULL, 128 << 20);
-  clib_mem_init (heap_base, 128 << 20);
+  /* Allocating 32MB heap */
+  clib_mem_init (0, 32 << 20);
 
   unformat_init_command_line (a, argv);
 
@@ -257,18 +265,6 @@
       exit (1);
     }
 
-  u8 **dir;
-  stat_segment_cached_pointer_t *cp;
-
-  dir = stat_segment_ls (patterns);
-  cp = stat_segment_register (dir);
-  if (!cp)
-    {
-      fformat (stderr,
-	       "Couldn't register required counters with stat segment\n");
-      exit (1);
-    }
-
   int fd = start_listen (SERVER_PORT);
   if (fd < 0)
     {
@@ -291,8 +287,8 @@
 	  if (inet_ntop
 	      (AF_INET6, &clientaddr.sin6_addr, address, sizeof (address)))
 	    {
-	      printf ("Client address is [%s]:%d\n", address,
-		      ntohs (clientaddr.sin6_port));
+	      fprintf (stderr, "Client address is [%s]:%d\n", address,
+		       ntohs (clientaddr.sin6_port));
 	    }
 	}
 
@@ -304,7 +300,7 @@
 	  continue;
 	}
       /* Single reader at the moment */
-      http_handler (stream, cp);
+      http_handler (stream, patterns);
       fclose (stream);
     }
 
diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c
index dcaeb50..7bf6624 100644
--- a/src/vpp/stats/stat_segment.c
+++ b/src/vpp/stats/stat_segment.c
@@ -12,47 +12,64 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <vpp/stats/stats.h>
 
+#include <vppinfra/mem.h>
+#include <vpp/stats/stats.h>
+#undef HAVE_MEMFD_CREATE
+#include <vppinfra/linux/syscall.h>
+
+/*
+ *  Used only by VPP writers
+ */
 void
 vlib_stat_segment_lock (void)
 {
   stats_main_t *sm = &stats_main;
-  vlib_main_t *vm = vlib_get_main ();
-  f64 deadman;
-
-  /* 3ms is WAY long enough to be reasonably sure something is wrong */
-  deadman = vlib_time_now (vm) + 3e-3;
-
-  while (__sync_lock_test_and_set (&((*sm->stat_segment_lockp)->lock), 1))
-    {
-      if (vlib_time_now (vm) >= deadman)
-	{
-	  clib_warning ("BUG: stat segment lock held too long...");
-	  break;
-	}
-    }
+  clib_spinlock_lock (sm->stat_segment_lockp);
+  sm->shared_header->in_progress = 1;
 }
 
 void
 vlib_stat_segment_unlock (void)
 {
   stats_main_t *sm = &stats_main;
+  sm->shared_header->epoch++;
+  sm->shared_header->in_progress = 0;
   clib_spinlock_unlock (sm->stat_segment_lockp);
 }
 
+/*
+ * Change heap to the stats shared memory segment
+ */
 void *
 vlib_stats_push_heap (void)
 {
   stats_main_t *sm = &stats_main;
-  ssvm_private_t *ssvmp = &sm->stat_segment;
-  ssvm_shared_header_t *shared_header;
 
-  ASSERT (ssvmp && ssvmp->sh);
+  ASSERT (sm && sm->shared_header);
+  return clib_mem_set_heap (sm->heap);
+}
 
-  shared_header = ssvmp->sh;
+/* Name to vector index hash */
+static u32
+lookup_or_create_hash_index (void *oldheap, char *name, u32 next_vector_index)
+{
+  stats_main_t *sm = &stats_main;
+  u32 index;
+  hash_pair_t *hp;
 
-  return ssvm_push_heap (shared_header);
+  hp = hash_get_pair (sm->directory_vector_by_name, name);
+  if (!hp)
+    {
+      hash_set (sm->directory_vector_by_name, name, next_vector_index);
+      index = next_vector_index;
+    }
+  else
+    {
+      index = hp->value[0];
+    }
+
+  return index;
 }
 
 void
@@ -60,250 +77,216 @@
 {
   vlib_simple_counter_main_t *cm = (vlib_simple_counter_main_t *) cm_arg;
   stats_main_t *sm = &stats_main;
-  ssvm_private_t *ssvmp = &sm->stat_segment;
-  ssvm_shared_header_t *shared_header;
+  stat_segment_shared_header_t *shared_header = sm->shared_header;
   char *stat_segment_name;
-  stat_segment_directory_entry_t *ep;
-  uword *p;
-
-  ASSERT (ssvmp && ssvmp->sh);
-
-  shared_header = ssvmp->sh;
+  stat_segment_directory_entry_t e = { 0 };
 
   /* Not all counters have names / hash-table entries */
-  if (cm->name || cm->stat_segment_name)
+  if (!cm->name && !cm->stat_segment_name)
     {
-      hash_pair_t *hp;
-      u8 *name_copy;
-
-      stat_segment_name = cm->stat_segment_name ?
-	cm->stat_segment_name : cm->name;
-
-      vlib_stat_segment_lock ();
-
-      /* Update hash table. The name must be copied into the segment */
-      hp = hash_get_pair (sm->counter_vector_by_name, stat_segment_name);
-      if (hp)
-	{
-	  name_copy = (u8 *) hp->key;
-	  ep = (stat_segment_directory_entry_t *) (hp->value[0]);
-	  hash_unset_mem (sm->counter_vector_by_name, stat_segment_name);
-	  vec_free (name_copy);
-	  clib_mem_free (ep);
-	}
-      name_copy = format (0, "%s%c", stat_segment_name, 0);
-      ep = clib_mem_alloc (sizeof (*ep));
-      ep->type = type;
-      ep->value = cm->counters;
-      hash_set_mem (sm->counter_vector_by_name, name_copy, ep);
-
-      /* Reset the client hash table pointer, since it WILL change! */
-      shared_header->opaque[STAT_SEGMENT_OPAQUE_DIR]
-	= sm->counter_vector_by_name;
-
-      /* Warn clients to refresh any pointers they might be holding */
-      shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] = (void *)
-	((u64) shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] + 1);
-      vlib_stat_segment_unlock ();
+      clib_mem_set_heap (oldheap);
+      return;
     }
-  ssvm_pop_heap (oldheap);
+
+  ASSERT (shared_header);
+
+  vlib_stat_segment_lock ();
+
+  /* Lookup hash-table is on the main heap */
+  stat_segment_name =
+    cm->stat_segment_name ? cm->stat_segment_name : cm->name;
+  u32 next_vector_index = vec_len (sm->directory_vector);
+  clib_mem_set_heap (oldheap);	/* Exit stats segment */
+  u32 vector_index = lookup_or_create_hash_index (oldheap, stat_segment_name,
+						  next_vector_index);
+  /* Back to stats segment */
+  clib_mem_set_heap (sm->heap);	/* Re-enter stat segment */
+
+
+  /* Update the vector */
+  if (vector_index == next_vector_index)
+    {				/* New */
+      strncpy (e.name, stat_segment_name, 128 - 1);
+      e.type = type;
+      vec_add1 (sm->directory_vector, e);
+      vector_index++;
+    }
+
+  stat_segment_directory_entry_t *ep = &sm->directory_vector[vector_index];
+  ep->offset = stat_segment_offset (shared_header, cm->counters);	/* Vector of threads of vectors of counters */
+  u64 *offset_vector =
+    ep->offset_vector ? stat_segment_pointer (shared_header,
+					      ep->offset_vector) : 0;
+
+  /* Update the 2nd dimension offset vector */
+  int i;
+  vec_validate (offset_vector, vec_len (cm->counters) - 1);
+  for (i = 0; i < vec_len (cm->counters); i++)
+    offset_vector[i] = stat_segment_offset (shared_header, cm->counters[i]);
+  ep->offset_vector = stat_segment_offset (shared_header, offset_vector);
+  sm->directory_vector[vector_index].offset =
+    stat_segment_offset (shared_header, cm->counters);
+
+  /* Reset the client hash table pointer, since it WILL change! */
+  shared_header->directory_offset =
+    stat_segment_offset (shared_header, sm->directory_vector);
+
+  vlib_stat_segment_unlock ();
+  clib_mem_set_heap (oldheap);
 }
 
 void
-vlib_stats_register_error_index (u8 * name, u64 index)
+vlib_stats_register_error_index (u8 * name, u64 * em_vec, u64 index)
 {
   stats_main_t *sm = &stats_main;
-  ssvm_private_t *ssvmp = &sm->stat_segment;
-  ssvm_shared_header_t *shared_header;
-  stat_segment_directory_entry_t *ep;
+  stat_segment_shared_header_t *shared_header = sm->shared_header;
+  stat_segment_directory_entry_t e;
   hash_pair_t *hp;
-  u8 *name_copy;
-  uword *p;
 
-  ASSERT (ssvmp && ssvmp->sh);
-
-  shared_header = ssvmp->sh;
+  ASSERT (shared_header);
 
   vlib_stat_segment_lock ();
-  /* Update hash table. The name must be copied into the segment */
-  hp = hash_get_pair (sm->counter_vector_by_name, name);
-  if (hp)
-    {
-      name_copy = (u8 *) hp->key;
-      ep = (stat_segment_directory_entry_t *) (hp->value[0]);
-      hash_unset_mem (sm->counter_vector_by_name, name);
-      vec_free (name_copy);
-      clib_mem_free (ep);
-    }
 
-  ep = clib_mem_alloc (sizeof (*ep));
-  ep->type = STAT_DIR_TYPE_ERROR_INDEX;
-  ep->value = (void *) index;
-
-  hash_set_mem (sm->counter_vector_by_name, name, ep);
-
-  /* Reset the client hash table pointer, since it WILL change! */
-  shared_header->opaque[STAT_SEGMENT_OPAQUE_DIR] = sm->counter_vector_by_name;
+  memcpy (e.name, name, vec_len (name));
+  e.name[vec_len (name)] = '\0';
+  e.type = STAT_DIR_TYPE_ERROR_INDEX;
+  e.offset = index;
+  vec_add1 (sm->directory_vector, e);
 
   /* Warn clients to refresh any pointers they might be holding */
-  shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] = (void *)
-    ((u64) shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] + 1);
+  shared_header->directory_offset =
+    stat_segment_offset (shared_header, sm->directory_vector);
+
   vlib_stat_segment_unlock ();
 }
 
-void
-vlib_stats_pop_heap2 (u64 * counter_vector, u32 thread_index, void *oldheap)
+static void
+stat_validate_counter_vector (stat_segment_directory_entry_t * ep, u32 max)
 {
   stats_main_t *sm = &stats_main;
-  ssvm_private_t *ssvmp = &sm->stat_segment;
-  ssvm_shared_header_t *shared_header;
-  stat_segment_directory_entry_t *ep;
-  hash_pair_t *hp;
-  u8 *error_vector_name;
-  u8 *name_copy;
-  uword *p;
+  stat_segment_shared_header_t *shared_header = sm->shared_header;
+  counter_t **counters = 0;
+  vlib_thread_main_t *tm = vlib_get_thread_main ();
+  int i;
+  u64 *offset_vector = 0;
 
-  ASSERT (ssvmp && ssvmp->sh);
+  vec_validate_aligned (counters, tm->n_vlib_mains - 1,
+			CLIB_CACHE_LINE_BYTES);
+  for (i = 0; i < tm->n_vlib_mains; i++)
+    {
+      vec_validate_aligned (counters[i], max, CLIB_CACHE_LINE_BYTES);
+      vec_add1 (offset_vector,
+		stat_segment_offset (shared_header, counters[i]));
+    }
+  ep->offset = stat_segment_offset (shared_header, counters);
+  ep->offset_vector = stat_segment_offset (shared_header, offset_vector);
+}
 
-  shared_header = ssvmp->sh;
+void
+vlib_stats_pop_heap2 (u64 * error_vector, u32 thread_index, void *oldheap)
+{
+  stats_main_t *sm = &stats_main;
+  stat_segment_shared_header_t *shared_header = sm->shared_header;
+
+  ASSERT (shared_header);
 
   vlib_stat_segment_lock ();
-  error_vector_name = format (0, "/err/%d/counter_vector%c", thread_index, 0);
-
-  /* Update hash table. The name must be copied into the segment */
-  hp = hash_get_pair (sm->counter_vector_by_name, error_vector_name);
-  if (hp)
-    {
-      name_copy = (u8 *) hp->key;
-      ep = (stat_segment_directory_entry_t *) (hp->value[0]);
-      hash_unset_mem (sm->counter_vector_by_name, error_vector_name);
-      vec_free (name_copy);
-      clib_mem_free (ep);
-    }
-
-  ep = clib_mem_alloc (sizeof (*ep));
-  ep->type = STAT_DIR_TYPE_VECTOR_POINTER;
-  ep->value = counter_vector;
-
-  hash_set_mem (sm->counter_vector_by_name, error_vector_name, ep);
 
   /* Reset the client hash table pointer, since it WILL change! */
-  shared_header->opaque[STAT_SEGMENT_OPAQUE_DIR] = sm->counter_vector_by_name;
+  shared_header->error_offset =
+    stat_segment_offset (shared_header, error_vector);
+  shared_header->directory_offset =
+    stat_segment_offset (shared_header, sm->directory_vector);
 
-  /* Warn clients to refresh any pointers they might be holding */
-  shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] = (void *)
-    ((u64) shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] + 1);
   vlib_stat_segment_unlock ();
-  ssvm_pop_heap (oldheap);
+  clib_mem_set_heap (oldheap);
 }
 
 clib_error_t *
 vlib_map_stat_segment_init (void)
 {
   stats_main_t *sm = &stats_main;
-  ssvm_private_t *ssvmp = &sm->stat_segment;
-  ssvm_shared_header_t *shared_header;
+  stat_segment_shared_header_t *shared_header;
   stat_segment_directory_entry_t *ep;
+
   f64 *scalar_data;
   u8 *name;
   void *oldheap;
   u32 *lock;
   int rv;
-  u64 memory_size;
+  ssize_t memory_size;
+
+
+  int mfd;
+  char *mem_name = "stat_segment_test";
+  void *memaddr;
 
   memory_size = sm->memory_size;
   if (memory_size == 0)
     memory_size = STAT_SEGMENT_DEFAULT_SIZE;
 
-  ssvmp->ssvm_size = memory_size;
-  ssvmp->i_am_master = 1;
-  ssvmp->my_pid = getpid ();
-  ssvmp->name = format (0, "/stats%c", 0);
-  ssvmp->requested_va = 0;
+  /* Create shared memory segment */
+  if ((mfd = memfd_create (mem_name, 0)) < 0)
+    return clib_error_return (0, "stat segment memfd_create failure");
 
-  rv = ssvm_master_init (ssvmp, SSVM_SEGMENT_MEMFD);
+  /* Set size */
+  if ((ftruncate (mfd, memory_size)) == -1)
+    return clib_error_return (0, "stat segment ftruncate failure");
 
-  if (rv)
-    return clib_error_return (0, "stat segment ssvm init failure");
-  shared_header = ssvmp->sh;
+  if ((memaddr =
+       mmap (NULL, memory_size, PROT_READ | PROT_WRITE, MAP_SHARED, mfd,
+	     0)) == MAP_FAILED)
+    return clib_error_return (0, "stat segment mmap failure");
 
-  oldheap = ssvm_push_heap (shared_header);
+  void *heap;
+#if USE_DLMALLOC == 0
+  heap = mheap_alloc_with_flags (((u8 *) memaddr) + getpagesize (),
+				 memory_size - getpagesize (),
+				 MHEAP_FLAG_DISABLE_VM |
+				 MHEAP_FLAG_THREAD_SAFE);
+#else
+  heap =
+    create_mspace_with_base (((u8 *) memaddr) + getpagesize (),
+			     memory_size - getpagesize (), 1 /* locked */ );
+  mspace_disable_expand (heap);
+#endif
+
+  sm->heap = heap;
+  sm->memfd = mfd;
+
+  sm->directory_vector_by_name = hash_create_string (0, sizeof (uword));
+  sm->shared_header = shared_header = memaddr;
+  sm->stat_segment_lockp = clib_mem_alloc (sizeof (clib_spinlock_t));
+  clib_spinlock_init (sm->stat_segment_lockp);
+
+  oldheap = clib_mem_set_heap (sm->heap);
 
   /* Set up the name to counter-vector hash table */
-  sm->counter_vector_by_name = hash_create_string (0, sizeof (uword));
+  sm->directory_vector = 0;
 
-  sm->stat_segment_lockp = clib_mem_alloc (sizeof (clib_spinlock_t));
+  shared_header->epoch = 1;
 
-  /* Save the hash table address in the shared segment, for clients */
-  clib_spinlock_init (sm->stat_segment_lockp);
-  shared_header->opaque[STAT_SEGMENT_OPAQUE_LOCK] = sm->stat_segment_lockp;
-  shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] = (void *) 1;
+  /* Scalar stats and node counters */
+  vec_validate (sm->directory_vector, STAT_COUNTERS - 1);
+#define _(E,t,n,p)							\
+  strcpy(sm->directory_vector[STAT_COUNTER_##E].name,  "/sys" #p "/" #n); \
+  sm->directory_vector[STAT_COUNTER_##E].type = STAT_DIR_TYPE_##t;
+  foreach_stat_segment_counter_name
+#undef _
+    /* Save the vector offset in the shared segment, for clients */
+    shared_header->directory_offset =
+    stat_segment_offset (shared_header, sm->directory_vector);
 
-  /* Set up a few scalar stats */
-
-  scalar_data = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES,
-					CLIB_CACHE_LINE_BYTES);
-  sm->vector_rate_ptr = (scalar_data + 0);
-  sm->input_rate_ptr = (scalar_data + 1);
-  sm->last_runtime_ptr = (scalar_data + 2);
-  sm->last_runtime_stats_clear_ptr = (scalar_data + 3);
-  sm->heartbeat_ptr = (scalar_data + 4);
-
-  name = format (0, "/sys/vector_rate%c", 0);
-  ep = clib_mem_alloc (sizeof (*ep));
-  ep->type = STAT_DIR_TYPE_SCALAR_POINTER;
-  ep->value = sm->vector_rate_ptr;
-
-  hash_set_mem (sm->counter_vector_by_name, name, ep);
-
-  name = format (0, "/sys/input_rate%c", 0);
-  ep = clib_mem_alloc (sizeof (*ep));
-  ep->type = STAT_DIR_TYPE_SCALAR_POINTER;
-  ep->value = sm->input_rate_ptr;
-
-  hash_set_mem (sm->counter_vector_by_name, name, ep);
-
-  name = format (0, "/sys/last_update%c", 0);
-  ep = clib_mem_alloc (sizeof (*ep));
-  ep->type = STAT_DIR_TYPE_SCALAR_POINTER;
-  ep->value = sm->last_runtime_ptr;
-
-  hash_set_mem (sm->counter_vector_by_name, name, ep);
-
-  name = format (0, "/sys/last_stats_clear%c", 0);
-  ep = clib_mem_alloc (sizeof (*ep));
-  ep->type = STAT_DIR_TYPE_SCALAR_POINTER;
-  ep->value = sm->last_runtime_stats_clear_ptr;
-
-  hash_set_mem (sm->counter_vector_by_name, name, ep);
-
-  name = format (0, "/sys/heartbeat%c", 0);
-  ep = clib_mem_alloc (sizeof (*ep));
-  ep->type = STAT_DIR_TYPE_SCALAR_POINTER;
-  ep->value = sm->heartbeat_ptr;
-
-  hash_set_mem (sm->counter_vector_by_name, name, ep);
-
-
-  /* Publish the hash table */
-  shared_header->opaque[STAT_SEGMENT_OPAQUE_DIR] = sm->counter_vector_by_name;
-
-  ssvm_pop_heap (oldheap);
+  clib_mem_set_heap (oldheap);
 
   return 0;
 }
 
-typedef struct
-{
-  u8 *name;
-  stat_segment_directory_entry_t *dir_entry;
-} show_stat_segment_t;
-
 static int
 name_sort_cmp (void *a1, void *a2)
 {
-  show_stat_segment_t *n1 = a1;
-  show_stat_segment_t *n2 = a2;
+  stat_segment_directory_entry_t *n1 = a1;
+  stat_segment_directory_entry_t *n2 = a2;
 
   return strcmp ((char *) n1->name, (char *) n2->name);
 }
@@ -316,30 +299,21 @@
   char *type_name;
   char *format_string;
 
-  format_string = "%-10s %20llx";
+  format_string = "%-74s %-10s %10lld";
 
   switch (ep->type)
     {
-    case STAT_DIR_TYPE_SCALAR_POINTER:
+    case STAT_DIR_TYPE_SCALAR_INDEX:
       type_name = "ScalarPtr";
       break;
 
-    case STAT_DIR_TYPE_VECTOR_POINTER:
-      type_name = "VectorPtr";
-      break;
-
     case STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE:
     case STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED:
       type_name = "CMainPtr";
       break;
 
-    case STAT_DIR_TYPE_SERIALIZED_NODES:
-      type_name = "SerNodesPtr";
-      break;
-
     case STAT_DIR_TYPE_ERROR_INDEX:
       type_name = "ErrIndex";
-      format_string = "%-10s %20lld";
       break;
 
     default:
@@ -347,7 +321,7 @@
       break;
     }
 
-  return format (s, format_string, type_name, ep->value);
+  return format (s, format_string, ep->name, type_name, ep->offset);
 }
 
 static clib_error_t *
@@ -356,13 +330,10 @@
 			      vlib_cli_command_t * cmd)
 {
   stats_main_t *sm = &stats_main;
-  ssvm_private_t *ssvmp = &sm->stat_segment;
-  ssvm_shared_header_t *shared_header;
   counter_t *counter;
   hash_pair_t *p;
-  show_stat_segment_t *show_data = 0;
-  show_stat_segment_t *this;
-  int i;
+  stat_segment_directory_entry_t *show_data, *this;
+  int i, j;
 
   int verbose = 0;
   u8 *s;
@@ -370,40 +341,25 @@
   if (unformat (input, "verbose"))
     verbose = 1;
 
+  /* Lock even as reader, as this command doesn't handle epoch changes */
   vlib_stat_segment_lock ();
-
-  /* *INDENT-OFF* */
-  hash_foreach_pair (p, sm->counter_vector_by_name,
-  ({
-    vec_add2 (show_data, this, 1);
-
-    this->name = (u8 *) (p->key);
-    this->dir_entry = (stat_segment_directory_entry_t *)(p->value[0]);
-  }));
-  /* *INDENT-ON* */
-
+  show_data = vec_dup (sm->directory_vector);
   vlib_stat_segment_unlock ();
 
   vec_sort_with_function (show_data, name_sort_cmp);
 
-  vlib_cli_output (vm, "%-60s %10s %20s", "Name", "Type", "Value");
+  vlib_cli_output (vm, "%-74s %10s %10s", "Name", "Type", "Value");
 
   for (i = 0; i < vec_len (show_data); i++)
     {
-      this = vec_elt_at_index (show_data, i);
-
-      vlib_cli_output (vm, "%-60s %31U",
-		       this->name, format_stat_dir_entry, this->dir_entry);
+      vlib_cli_output (vm, "%-100U", format_stat_dir_entry,
+		       vec_elt_at_index (show_data, i));
     }
 
   if (verbose)
     {
-      ASSERT (ssvmp && ssvmp->sh);
-
-      shared_header = ssvmp->sh;
-
-      vlib_cli_output (vm, "%U", format_mheap,
-		       shared_header->heap, 0 /* verbose */ );
+      ASSERT (sm->heap);
+      vlib_cli_output (vm, "%U", format_mheap, sm->heap, 0 /* verbose */ );
     }
 
   return 0;
@@ -418,71 +374,95 @@
 };
 /* *INDENT-ON* */
 
+/*
+ * Node performance counters:
+ * total_calls [threads][node-index]
+ * total_vectors
+ * total_calls
+ * total suspends
+ */
+
 static inline void
-update_serialized_nodes (stats_main_t * sm)
+update_node_counters (stats_main_t * sm)
 {
-  int i;
   vlib_main_t *vm = vlib_mains[0];
-  ssvm_private_t *ssvmp = &sm->stat_segment;
-  ssvm_shared_header_t *shared_header;
-  void *oldheap;
-  stat_segment_directory_entry_t *ep;
-  hash_pair_t *hp;
-  u8 *name_copy;
+  vlib_main_t **stat_vms = 0;
+  vlib_node_t ***node_dups = 0;
+  int i, j;
+  stat_segment_shared_header_t *shared_header = sm->shared_header;
+  static u32 no_max_nodes = 0;
 
-  ASSERT (ssvmp && ssvmp->sh);
-
-  vec_reset_length (sm->serialized_nodes);
-
-  shared_header = ssvmp->sh;
-
-  oldheap = ssvm_push_heap (shared_header);
-
-  vlib_stat_segment_lock ();
   vlib_node_get_nodes (0 /* vm, for barrier sync */ ,
 		       (u32) ~ 0 /* all threads */ ,
 		       1 /* include stats */ ,
 		       0 /* barrier sync */ ,
-		       &sm->node_dups, &sm->stat_vms);
+		       &node_dups, &stat_vms);
 
-  sm->serialized_nodes = vlib_node_serialize (vm, sm->node_dups,
-					      sm->serialized_nodes,
-					      0 /* include nexts */ ,
-					      1 /* include stats */ );
+  u32 l = vec_len (node_dups[0]);
 
-  hp = hash_get_pair (sm->counter_vector_by_name, "serialized_nodes");
-  if (hp)
+  /*
+   * Extend performance nodes if necessary
+   */
+  if (l > no_max_nodes)
     {
-      name_copy = (u8 *) hp->key;
-      ep = (stat_segment_directory_entry_t *) (hp->value[0]);
+      void *oldheap = clib_mem_set_heap (sm->heap);
+      vlib_stat_segment_lock ();
 
-      if (ep->value != sm->serialized_nodes)
+      stat_validate_counter_vector (&sm->directory_vector
+				    [STAT_COUNTER_NODE_CLOCKS], l);
+      stat_validate_counter_vector (&sm->directory_vector
+				    [STAT_COUNTER_NODE_VECTORS], l);
+      stat_validate_counter_vector (&sm->directory_vector
+				    [STAT_COUNTER_NODE_CALLS], l);
+      stat_validate_counter_vector (&sm->directory_vector
+				    [STAT_COUNTER_NODE_SUSPENDS], l);
+
+      vlib_stat_segment_unlock ();
+      clib_mem_set_heap (oldheap);
+      no_max_nodes = l;
+    }
+
+  for (j = 0; j < vec_len (node_dups); j++)
+    {
+      vlib_node_t **nodes = node_dups[j];
+      u32 l = vec_len (nodes);
+
+      for (i = 0; i < vec_len (nodes); i++)
 	{
-	  ep->value = sm->serialized_nodes;
-	  /* Warn clients to refresh any pointers they might be holding */
-	  shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] = (void *)
-	    ((u64) shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] + 1);
+	  counter_t **counters;
+	  counter_t *c;
+	  vlib_node_t *n = nodes[i];
+
+	  counters =
+	    stat_segment_pointer (shared_header,
+				  sm->directory_vector
+				  [STAT_COUNTER_NODE_CLOCKS].offset);
+	  c = counters[j];
+	  c[n->index] = n->stats_total.clocks - n->stats_last_clear.clocks;
+
+	  counters =
+	    stat_segment_pointer (shared_header,
+				  sm->directory_vector
+				  [STAT_COUNTER_NODE_VECTORS].offset);
+	  c = counters[j];
+	  c[n->index] = n->stats_total.vectors - n->stats_last_clear.vectors;
+
+	  counters =
+	    stat_segment_pointer (shared_header,
+				  sm->directory_vector
+				  [STAT_COUNTER_NODE_CALLS].offset);
+	  c = counters[j];
+	  c[n->index] = n->stats_total.calls - n->stats_last_clear.calls;
+
+	  counters =
+	    stat_segment_pointer (shared_header,
+				  sm->directory_vector
+				  [STAT_COUNTER_NODE_SUSPENDS].offset);
+	  c = counters[j];
+	  c[n->index] =
+	    n->stats_total.suspends - n->stats_last_clear.suspends;
 	}
     }
-  else
-    {
-      name_copy = format (0, "%s%c", "serialized_nodes", 0);
-      ep = clib_mem_alloc (sizeof (*ep));
-      ep->type = STAT_DIR_TYPE_SERIALIZED_NODES;
-      ep->value = sm->serialized_nodes;
-      hash_set_mem (sm->counter_vector_by_name, name_copy, ep);
-
-      /* Reset the client hash table pointer */
-      shared_header->opaque[STAT_SEGMENT_OPAQUE_DIR]
-	= sm->counter_vector_by_name;
-
-      /* Warn clients to refresh any pointers they might be holding */
-      shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] = (void *)
-	((u64) shared_header->opaque[STAT_SEGMENT_OPAQUE_EPOCH] + 1);
-    }
-
-  vlib_stat_segment_unlock ();
-  ssvm_pop_heap (oldheap);
 }
 
 /*
@@ -515,25 +495,27 @@
     }
   vector_rate /= (f64) (i - start);
 
-  *sm->vector_rate_ptr = vector_rate / ((f64) (vec_len (vlib_mains) - start));
+  sm->directory_vector[STAT_COUNTER_VECTOR_RATE].value =
+    vector_rate / ((f64) (vec_len (vlib_mains) - start));
 
   /*
    * Compute the aggregate input rate
    */
   now = vlib_time_now (vm);
-  dt = now - sm->last_runtime_ptr[0];
+  dt = now - sm->directory_vector[STAT_COUNTER_LAST_UPDATE].value;
   input_packets = vnet_get_aggregate_rx_packets ();
-  *sm->input_rate_ptr = (f64) (input_packets - sm->last_input_packets) / dt;
-  sm->last_runtime_ptr[0] = now;
+  sm->directory_vector[STAT_COUNTER_INPUT_RATE].value =
+    (f64) (input_packets - sm->last_input_packets) / dt;
+  sm->directory_vector[STAT_COUNTER_LAST_UPDATE].value = now;
   sm->last_input_packets = input_packets;
-  sm->last_runtime_stats_clear_ptr[0] =
+  sm->directory_vector[STAT_COUNTER_LAST_STATS_CLEAR].value =
     vm->node_main.time_last_runtime_stats_clear;
 
-  if (sm->serialize_nodes)
-    update_serialized_nodes (sm);
+  if (sm->node_counters_enabled)
+    update_node_counters (sm);
 
   /* Heartbeat, so clients detect we're still here */
-  (*sm->heartbeat_ptr)++;
+  sm->directory_vector[STAT_COUNTER_HEARTBEAT].value++;
 }
 
 static clib_error_t *
@@ -546,10 +528,10 @@
     {
       if (unformat (input, "size %U", unformat_memory_size, &sm->memory_size))
 	;
-      else if (unformat (input, "serialize-nodes on"))
-	sm->serialize_nodes = 1;
-      else if (unformat (input, "serialize-nodes off"))
-	sm->serialize_nodes = 0;
+      else if (unformat (input, "per-node-counters on"))
+	sm->node_counters_enabled = 1;
+      else if (unformat (input, "per-node-counters off"))
+	sm->node_counters_enabled = 0;
       else
 	return clib_error_return (0, "unknown input `%U'",
 				  format_unformat_error, input);
diff --git a/src/vpp/stats/stat_segment.h b/src/vpp/stats/stat_segment.h
new file mode 100644
index 0000000..0efd45a
--- /dev/null
+++ b/src/vpp/stats/stat_segment.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ * Licensed 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.
+ */
+
+#ifndef included_stat_segment_h
+#define included_stat_segment_h
+
+#include <stdatomic.h>
+
+/* Default socket to exchange segment fd */
+#define STAT_SEGMENT_SOCKET_FILE "/run/vpp/stats.sock"
+
+typedef enum
+{
+  STAT_DIR_TYPE_ILLEGAL = 0,
+  STAT_DIR_TYPE_SCALAR_INDEX,
+  STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE,
+  STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED,
+  STAT_DIR_TYPE_ERROR_INDEX,
+} stat_directory_type_t;
+
+typedef enum
+{
+ STAT_COUNTER_VECTOR_RATE = 0,
+ STAT_COUNTER_INPUT_RATE,
+ STAT_COUNTER_LAST_UPDATE,
+ STAT_COUNTER_LAST_STATS_CLEAR,
+ STAT_COUNTER_HEARTBEAT,
+ STAT_COUNTER_NODE_CLOCKS,
+ STAT_COUNTER_NODE_VECTORS,
+ STAT_COUNTER_NODE_CALLS,
+ STAT_COUNTER_NODE_SUSPENDS,
+ STAT_COUNTERS
+} stat_segment_counter_t;
+
+#define foreach_stat_segment_counter_name			\
+  _(VECTOR_RATE, SCALAR_INDEX, vector_rate,)			\
+  _(INPUT_RATE, SCALAR_INDEX, input_rate,)			\
+  _(LAST_UPDATE, SCALAR_INDEX, last_update,)			\
+  _(LAST_STATS_CLEAR, SCALAR_INDEX, last_stats_clear,)		\
+  _(HEARTBEAT, SCALAR_INDEX, heartbeat,)			\
+  _(NODE_CLOCKS, COUNTER_VECTOR_SIMPLE, clocks, /node)		\
+  _(NODE_VECTORS, COUNTER_VECTOR_SIMPLE, vectors, /node)	\
+  _(NODE_CALLS, COUNTER_VECTOR_SIMPLE, calls, /node)		\
+  _(NODE_SUSPENDS, COUNTER_VECTOR_SIMPLE, suspends, /node)
+
+typedef struct
+{
+  stat_directory_type_t type;
+  union {
+    uint64_t offset;
+    uint64_t index;
+    uint64_t value;
+  };
+  uint64_t offset_vector;
+  char name[128]; // TODO change this to pointer to "somewhere"
+} stat_segment_directory_entry_t;
+
+/* Default stat segment 32m */
+#define STAT_SEGMENT_DEFAULT_SIZE	(32<<20)
+
+/*
+ * Shared header first in the shared memory segment.
+ */
+typedef struct
+{
+  atomic_int_fast64_t epoch;
+  atomic_int_fast64_t in_progress;
+  atomic_int_fast64_t directory_offset;
+  atomic_int_fast64_t error_offset;
+  atomic_int_fast64_t stats_offset;
+} stat_segment_shared_header_t;
+
+static inline uint64_t
+stat_segment_offset (void *start, void *data)
+{
+  return (char *) data - (char *) start;
+}
+
+static inline void *
+stat_segment_pointer (void *start, uint64_t offset)
+{
+  return ((char *) start + offset);
+}
+
+#endif
diff --git a/src/vpp/stats/stats.c b/src/vpp/stats/stats.c
index d075374..5eea25e 100644
--- a/src/vpp/stats/stats.c
+++ b/src/vpp/stats/stats.c
@@ -2348,7 +2348,6 @@
 stats_socket_accept_ready (clib_file_t * uf)
 {
   stats_main_t *sm = &stats_main;
-  ssvm_private_t *ssvmp = &sm->stat_segment;
   clib_error_t *err;
   clib_socket_t client = { 0 };
 
@@ -2360,7 +2359,7 @@
     }
 
   /* Send the fd across and close */
-  err = clib_socket_sendmsg (&client, 0, 0, &ssvmp->fd, 1);
+  err = clib_socket_sendmsg (&client, 0, 0, &sm->memfd, 1);
   if (err)
     clib_error_report (err);
   clib_socket_close (&client);
diff --git a/src/vpp/stats/stats.h b/src/vpp/stats/stats.h
index 911706c..f21451d 100644
--- a/src/vpp/stats/stats.h
+++ b/src/vpp/stats/stats.h
@@ -26,11 +26,7 @@
 #include <vlib/unix/unix.h>
 #include <vlibmemory/api.h>
 #include <vlibapi/api_helper_macros.h>
-#include <svm/queue.h>
-#include <svm/ssvm.h>
-
-/* Default socket to exchange segment fd */
-#define STAT_SEGMENT_SOCKET_FILE "/run/vpp/stats.sock"
+#include <vpp/stats/stat_segment.h>
 
 typedef struct
 {
@@ -99,7 +95,6 @@
 
 } vpe_client_stats_registration_t;
 
-
 typedef struct
 {
   void *mheap;
@@ -162,33 +157,19 @@
   vpe_client_registration_t **clients_tmp;
 
   /* statistics segment */
-  ssvm_private_t stat_segment;
-  uword *counter_vector_by_name;
+  uword *directory_vector_by_name;
+  stat_segment_directory_entry_t *directory_vector;
   clib_spinlock_t *stat_segment_lockp;
   clib_socket_t *socket;
   u8 *socket_name;
-  uword memory_size;
-  u8 serialize_nodes;
+  ssize_t memory_size;
+  u8 node_counters_enabled;
+  void *heap;
+  stat_segment_shared_header_t *shared_header;	/* pointer to shared memory segment */
+  int memfd;
 
-  /* Pointers to scalar stats maintained by the stat thread */
-  f64 *input_rate_ptr;
-  f64 *last_runtime_ptr;
-  f64 *last_runtime_stats_clear_ptr;
-  f64 *vector_rate_ptr;
-  f64 *heartbeat_ptr;
   u64 last_input_packets;
 
-  /* Pointers to vector stats maintained by the stat thread */
-  u8 *serialized_nodes;
-  vlib_main_t **stat_vms;
-  vlib_node_t ***node_dups;
-
-  f64 *vectors_per_node;
-  f64 *vector_rate_in;
-  f64 *vector_rate_out;
-  f64 *vector_rate_drop;
-  f64 *vector_rate_punt;
-
   /* convenience */
   vlib_main_t *vlib_main;
   vnet_main_t *vnet_main;
@@ -198,30 +179,6 @@
 
 extern stats_main_t stats_main;
 
-/* Default stat segment 32m */
-#define STAT_SEGMENT_DEFAULT_SIZE	(32<<20)
-
-#define STAT_SEGMENT_OPAQUE_LOCK	0
-#define STAT_SEGMENT_OPAQUE_DIR		1
-#define STAT_SEGMENT_OPAQUE_EPOCH	2
-
-typedef enum
-{
-  STAT_DIR_TYPE_ILLEGAL = 0,
-  STAT_DIR_TYPE_SCALAR_POINTER,
-  STAT_DIR_TYPE_VECTOR_POINTER,
-  STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE,
-  STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED,
-  STAT_DIR_TYPE_ERROR_INDEX,
-  STAT_DIR_TYPE_SERIALIZED_NODES,
-} stat_directory_type_t;
-
-typedef struct
-{
-  stat_directory_type_t type;
-  void *value;
-} stat_segment_directory_entry_t;
-
 void do_stat_segment_updates (stats_main_t * sm);
 
 #endif /* __included_stats_h__ */
