diff --git a/src/svm/queue.h b/src/svm/queue.h
index 3e8031e..de79caa 100644
--- a/src/svm/queue.h
+++ b/src/svm/queue.h
@@ -39,12 +39,13 @@
 
 typedef enum
 {
-  SVM_Q_WAIT = 0,	/**< blocking call - must be used only in combination
-			     with condvars */
+  SVM_Q_WAIT = 0,	/**< blocking call - best used in combination with
+			     condvars, for eventfds we don't yield the cpu */
   SVM_Q_NOWAIT,		/**< non-blocking call - works with both condvar and
 			     eventfd signaling */
   SVM_Q_TIMEDWAIT,	/**< blocking call, returns on signal or time-out -
-			     must be used only in combination with condvars */
+			     best used in combination with condvars, with
+			     eventfds we don't yield the cpu */
 } svm_q_conditional_wait_t;
 
 /**
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c
index 55c3803..e63696a 100644
--- a/src/vcl/vcl_bapi.c
+++ b/src/vcl/vcl_bapi.c
@@ -215,7 +215,7 @@
   ctr->peer_mq = uword_to_pointer (mp->peer_evt_q_address, svm_msg_q_t *);
   VDBG (0, "Adding ct registration %u", vcl_ct_registration_index (ctr));
 
-  if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD)
+  if (mp->n_fds && (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD))
     {
       svm_msg_q_set_consumer_eventfd (ctr->mq, fds[0]);
       svm_msg_q_set_producer_eventfd (ctr->peer_mq, fds[1]);
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 99f3ec8..1ad94cc 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -18,20 +18,34 @@
 #include <vnet/session/application_namespace.h>
 #include <vnet/session/session.h>
 
-/**
- * Pool from which we allocate all applications
- */
-static application_t *app_pool;
+static app_main_t app_main;
 
-/**
- * Hash table of apps by api client index
- */
-static uword *app_by_api_client_index;
+static app_worker_map_t *
+app_worker_map_alloc (application_t * app)
+{
+  app_worker_map_t *map;
+  pool_get (app->worker_maps, map);
+  memset (map, 0, sizeof (*map));
+  return map;
+}
 
-/**
- * Hash table of builtin apps by name
- */
-static uword *app_by_name;
+static u32
+app_worker_map_index (application_t * app, app_worker_map_t * map)
+{
+  return (map - app->worker_maps);
+}
+
+static void
+app_worker_map_free (application_t * app, app_worker_map_t * map)
+{
+  pool_put (app->worker_maps, map);
+}
+
+static app_worker_map_t *
+app_worker_map_get (application_t * app, u32 map_index)
+{
+  return pool_elt_at_index (app->worker_maps, map_index);
+}
 
 static u8 *
 app_get_name_from_reg_index (application_t * app)
@@ -41,7 +55,7 @@
   vl_api_registration_t *regp;
   regp = vl_api_client_index_to_registration (app->api_client_index);
   if (!regp)
-    app_name = format (0, "builtin-%d%c", app->index, 0);
+    app_name = format (0, "builtin-%d%c", app->app_index, 0);
   else
     app_name = format (0, "%s%c", regp->name, 0);
 
@@ -118,25 +132,26 @@
 application_table_add (application_t * app)
 {
   if (app->api_client_index != APP_INVALID_INDEX)
-    hash_set (app_by_api_client_index, app->api_client_index, app->index);
+    hash_set (app_main.app_by_api_client_index, app->api_client_index,
+	      app->app_index);
   else if (app->name)
-    hash_set_mem (app_by_name, app->name, app->index);
+    hash_set_mem (app_main.app_by_name, app->name, app->app_index);
 }
 
 static void
 application_table_del (application_t * app)
 {
   if (app->api_client_index != APP_INVALID_INDEX)
-    hash_unset (app_by_api_client_index, app->api_client_index);
+    hash_unset (app_main.app_by_api_client_index, app->api_client_index);
   else if (app->name)
-    hash_unset_mem (app_by_name, app->name);
+    hash_unset_mem (app_main.app_by_name, app->name);
 }
 
 application_t *
 application_lookup (u32 api_client_index)
 {
   uword *p;
-  p = hash_get (app_by_api_client_index, api_client_index);
+  p = hash_get (app_main.app_by_api_client_index, api_client_index);
   if (p)
     return application_get (p[0]);
 
@@ -147,7 +162,7 @@
 application_lookup_name (const u8 * name)
 {
   uword *p;
-  p = hash_get_mem (app_by_name, name);
+  p = hash_get_mem (app_main.app_by_name, name);
   if (p)
     return application_get (p[0]);
 
@@ -155,96 +170,36 @@
 }
 
 application_t *
-application_new ()
+application_alloc (void)
 {
   application_t *app;
-  pool_get (app_pool, app);
+  pool_get (app_main.app_pool, app);
   memset (app, 0, sizeof (*app));
-  app->index = application_get_index (app);
-  app->connects_seg_manager = APP_INVALID_SEGMENT_MANAGER_INDEX;
-  app->first_segment_manager = APP_INVALID_SEGMENT_MANAGER_INDEX;
-  app->local_segment_manager = APP_INVALID_SEGMENT_MANAGER_INDEX;
-  if (CLIB_DEBUG > 1)
-    clib_warning ("[%d] New app (%d)", getpid (), app->index);
+  app->app_index = app - app_main.app_pool;
   return app;
 }
 
-void
-application_del (application_t * app)
+application_t *
+application_get (u32 app_index)
 {
-  vnet_unbind_args_t _a, *a = &_a;
-  u64 handle, *handles = 0;
-  segment_manager_t *sm;
-  u32 index;
-  int i;
+  if (app_index == APP_INVALID_INDEX)
+    return 0;
+  return pool_elt_at_index (app_main.app_pool, app_index);
+}
 
-  /*
-   * The app event queue allocated in first segment is cleared with
-   * the segment manager. No need to explicitly free it.
-   */
-  if (CLIB_DEBUG > 1)
-    clib_warning ("[%d] Delete app (%d)", getpid (), app->index);
+application_t *
+application_get_if_valid (u32 app_index)
+{
+  if (pool_is_free_index (app_main.app_pool, app_index))
+    return 0;
 
-  if (application_is_proxy (app))
-    application_remove_proxy (app);
+  return pool_elt_at_index (app_main.app_pool, app_index);
+}
 
-  /*
-   *  Listener cleanup
-   */
-
-  /* *INDENT-OFF* */
-  hash_foreach (handle, index, app->listeners_table,
-  ({
-    vec_add1 (handles, handle);
-    sm = segment_manager_get (index);
-    sm->app_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
-  }));
-  /* *INDENT-ON* */
-
-  for (i = 0; i < vec_len (handles); i++)
-    {
-      a->app_index = app->index;
-      a->handle = handles[i];
-      /* seg manager is removed when unbind completes */
-      vnet_unbind (a);
-    }
-
-  /*
-   * Connects segment manager cleanup
-   */
-
-  if (app->connects_seg_manager != APP_INVALID_SEGMENT_MANAGER_INDEX)
-    {
-      sm = segment_manager_get (app->connects_seg_manager);
-      sm->app_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
-      segment_manager_init_del (sm);
-    }
-
-  /* If first segment manager is used by a listener */
-  if (app->first_segment_manager != APP_INVALID_SEGMENT_MANAGER_INDEX
-      && app->first_segment_manager != app->connects_seg_manager)
-    {
-      sm = segment_manager_get (app->first_segment_manager);
-      /* .. and has no fifos, e.g. it might be used for redirected sessions,
-       * remove it */
-      if (!segment_manager_has_fifos (sm))
-	{
-	  sm->app_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
-	  segment_manager_del (sm);
-	}
-    }
-
-  /*
-   * Local connections cleanup
-   */
-  application_local_sessions_del (app);
-
-  vec_free (app->tls_cert);
-  vec_free (app->tls_key);
-
-  application_table_del (app);
-  vec_free (app->name);
-  pool_put (app_pool, app);
+u32
+application_index (application_t * app)
+{
+  return app - app_main.app_pool;
 }
 
 static void
@@ -288,23 +243,22 @@
 }
 
 int
-application_init (application_t * app, u32 api_client_index, u8 * app_name,
-		  u64 * options, session_cb_vft_t * cb_fns)
+application_alloc_and_init (app_init_args_t * a)
 {
   ssvm_segment_type_t seg_type = SSVM_SEGMENT_MEMFD;
-  u32 first_seg_size, prealloc_fifo_pairs;
   segment_manager_properties_t *props;
   vl_api_registration_t *reg;
-  segment_manager_t *sm;
-  int rv;
+  application_t *app;
+  u64 *options;
 
+  app = application_alloc ();
+  options = a->options;
   /*
    * Make sure we support the requested configuration
    */
-
   if (!(options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_IS_BUILTIN))
     {
-      reg = vl_api_client_index_to_registration (api_client_index);
+      reg = vl_api_client_index_to_registration (a->api_client_index);
       if (!reg)
 	return VNET_API_ERROR_APP_UNSUPPORTED_CFG;
       if (vl_api_registration_file_index (reg) == VL_API_INVALID_FI)
@@ -324,13 +278,25 @@
   if (!application_verify_cfg (seg_type))
     return VNET_API_ERROR_APP_UNSUPPORTED_CFG;
 
-  /*
-   * Setup segment manager
-   */
-  sm = segment_manager_new ();
-  sm->app_index = app->index;
+  /* Check that the obvious things are properly set up */
+  application_verify_cb_fns (a->session_cb_vft);
+
+  app->api_client_index = a->api_client_index;
+  app->flags = options[APP_OPTIONS_FLAGS];
+  app->cb_fns = *a->session_cb_vft;
+  app->ns_index = options[APP_OPTIONS_NAMESPACE];
+  app->proxied_transports = options[APP_OPTIONS_PROXY_TRANSPORT];
+  app->name = vec_dup (a->name);
+
+  /* If no scope enabled, default to global */
+  if (!application_has_global_scope (app)
+      && !application_has_local_scope (app))
+    app->flags |= APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
+
   props = application_segment_manager_properties (app);
   segment_manager_properties_init (props);
+  props->segment_size = options[APP_OPTIONS_ADD_SEGMENT_SIZE];
+  props->prealloc_fifos = options[APP_OPTIONS_PREALLOC_FIFO_PAIRS];
   if (options[APP_OPTIONS_ADD_SEGMENT_SIZE])
     {
       props->add_segment_size = options[APP_OPTIONS_ADD_SEGMENT_SIZE];
@@ -348,87 +314,224 @@
     app->tls_engine = options[APP_OPTIONS_TLS_ENGINE];
   props->segment_type = seg_type;
 
-  first_seg_size = options[APP_OPTIONS_SEGMENT_SIZE];
-  prealloc_fifo_pairs = options[APP_OPTIONS_PREALLOC_FIFO_PAIRS];
+  /* Add app to lookup by api_client_index table */
+  application_table_add (app);
+  a->app_index = application_index (app);
 
-  if ((rv = segment_manager_init (sm, first_seg_size, prealloc_fifo_pairs)))
-    return rv;
+  APP_DBG ("New app name: %v api index: %u index %u", app->name,
+	   app->api_client_index, app->app_index);
+
+  return 0;
+}
+
+void
+application_free (application_t * app)
+{
+  app_worker_map_t *wrk_map;
+  app_worker_t *app_wrk;
+
+  /*
+   * The app event queue allocated in first segment is cleared with
+   * the segment manager. No need to explicitly free it.
+   */
+  APP_DBG ("Delete app name %v api index: %d index: %d", app->name,
+	   app->api_client_index, app->app_index);
+
+  if (application_is_proxy (app))
+    application_remove_proxy (app);
+
+  /* *INDENT-OFF* */
+  pool_flush (wrk_map, app->worker_maps, ({
+    app_wrk = app_worker_get (wrk_map->wrk_index);
+    app_worker_free (app_wrk);
+  }));
+  /* *INDENT-ON* */
+  pool_free (app->worker_maps);
+
+  application_table_del (app);
+  vec_free (app->name);
+  vec_free (app->tls_cert);
+  vec_free (app->tls_key);
+  pool_put (app_main.app_pool, app);
+}
+
+app_worker_t *
+application_get_worker (application_t * app, u32 wrk_map_index)
+{
+  app_worker_map_t *map;
+  map = app_worker_map_get (app, wrk_map_index);
+  if (!map)
+    return 0;
+  return app_worker_get (map->wrk_index);
+}
+
+app_worker_t *
+application_get_default_worker (application_t * app)
+{
+  return application_get_worker (app, 0);
+}
+
+app_worker_t *
+app_worker_alloc (application_t * app)
+{
+  app_worker_t *app_wrk;
+  pool_get (app_main.workers, app_wrk);
+  memset (app_wrk, 0, sizeof (*app_wrk));
+  app_wrk->wrk_index = app_wrk - app_main.workers;
+  app_wrk->app_index = app->app_index;
+  app_wrk->wrk_map_index = ~0;
+  app_wrk->connects_seg_manager = APP_INVALID_SEGMENT_MANAGER_INDEX;
+  app_wrk->first_segment_manager = APP_INVALID_SEGMENT_MANAGER_INDEX;
+  app_wrk->local_segment_manager = APP_INVALID_SEGMENT_MANAGER_INDEX;
+  APP_DBG ("New app %v worker %u", app_get_name (app), app_wrk->wrk_index);
+  return app_wrk;
+}
+
+app_worker_t *
+app_worker_get (u32 wrk_index)
+{
+  return pool_elt_at_index (app_main.workers, wrk_index);
+}
+
+app_worker_t *
+app_worker_get_if_valid (u32 wrk_index)
+{
+  if (pool_is_free_index (app_main.workers, wrk_index))
+    return 0;
+  return pool_elt_at_index (app_main.workers, wrk_index);
+}
+
+void
+app_worker_free (app_worker_t * app_wrk)
+{
+  application_t *app = application_get (app_wrk->app_index);
+  vnet_unbind_args_t _a, *a = &_a;
+  u64 handle, *handles = 0;
+  segment_manager_t *sm;
+  u32 sm_index;
+  int i;
+
+  /*
+   *  Listener cleanup
+   */
+
+  /* *INDENT-OFF* */
+  hash_foreach (handle, sm_index, app_wrk->listeners_table,
+  ({
+    vec_add1 (handles, handle);
+    sm = segment_manager_get (sm_index);
+    sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
+  }));
+  /* *INDENT-ON* */
+
+  for (i = 0; i < vec_len (handles); i++)
+    {
+      a->app_index = app->app_index;
+      a->app_wrk_index = app_wrk->wrk_map_index;
+      a->handle = handles[i];
+      /* seg manager is removed when unbind completes */
+      vnet_unbind (a);
+    }
+
+  /*
+   * Connects segment manager cleanup
+   */
+
+  if (app_wrk->connects_seg_manager != APP_INVALID_SEGMENT_MANAGER_INDEX)
+    {
+      sm = segment_manager_get (app_wrk->connects_seg_manager);
+      sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
+      segment_manager_init_del (sm);
+    }
+
+  /* If first segment manager is used by a listener */
+  if (app_wrk->first_segment_manager != APP_INVALID_SEGMENT_MANAGER_INDEX
+      && app_wrk->first_segment_manager != app_wrk->connects_seg_manager)
+    {
+      sm = segment_manager_get (app_wrk->first_segment_manager);
+      /* .. and has no fifos, e.g. it might be used for redirected sessions,
+       * remove it */
+      if (!segment_manager_has_fifos (sm))
+	{
+	  sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
+	  segment_manager_del (sm);
+	}
+    }
+
+  /*
+   * Local sessions
+   */
+  application_local_sessions_free (app_wrk);
+
+  pool_put (app_main.workers, app_wrk);
+  if (CLIB_DEBUG)
+    memset (app_wrk, 0xfe, sizeof (*app_wrk));
+}
+
+int
+app_worker_alloc_and_init (application_t * app, app_worker_t ** wrk)
+{
+  app_worker_map_t *wrk_map;
+  app_worker_t *app_wrk;
+  segment_manager_t *sm;
+  int rv;
+
+  app_wrk = app_worker_alloc (app);
+  wrk_map = app_worker_map_alloc (app);
+  wrk_map->wrk_index = app_wrk->wrk_index;
+  app_wrk->wrk_map_index = app_worker_map_index (app, wrk_map);
+
+  /*
+   * Setup first segment manager
+   */
+  sm = segment_manager_new ();
+  sm->app_wrk_index = app_wrk->wrk_index;
+
+  if ((rv = segment_manager_init (sm, app->sm_properties.segment_size,
+				  app->sm_properties.prealloc_fifos)))
+    {
+      app_worker_free (app_wrk);
+      return rv;
+    }
   sm->first_is_protected = 1;
 
   /*
-   * Setup application
+   * Setup app worker
    */
-  app->first_segment_manager = segment_manager_index (sm);
-  app->api_client_index = api_client_index;
-  app->flags = options[APP_OPTIONS_FLAGS];
-  app->cb_fns = *cb_fns;
-  app->ns_index = options[APP_OPTIONS_NAMESPACE];
-  app->listeners_table = hash_create (0, sizeof (u64));
-  app->local_connects = hash_create (0, sizeof (u64));
-  app->proxied_transports = options[APP_OPTIONS_PROXY_TRANSPORT];
-  app->event_queue = segment_manager_event_queue (sm);
-  app->name = vec_dup (app_name);
-
-  /* If no scope enabled, default to global */
-  if (!application_has_global_scope (app)
-      && !application_has_local_scope (app))
-    app->flags |= APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
-
-  /* Check that the obvious things are properly set up */
-  application_verify_cb_fns (cb_fns);
-
-  /* Add app to lookup by api_client_index table */
-  application_table_add (app);
+  app_wrk->first_segment_manager = segment_manager_index (sm);
+  app_wrk->listeners_table = hash_create (0, sizeof (u64));
+  app_wrk->event_queue = segment_manager_event_queue (sm);
+  app_wrk->app_is_builtin = application_is_builtin (app);
 
   /*
    * Segment manager for local sessions
    */
   sm = segment_manager_new ();
-  sm->app_index = app->index;
-  app->local_segment_manager = segment_manager_index (sm);
+  sm->app_wrk_index = app_wrk->wrk_index;
+  app_wrk->local_segment_manager = segment_manager_index (sm);
+  app_wrk->local_connects = hash_create (0, sizeof (u64));
+
+  *wrk = app_wrk;
 
   return 0;
 }
 
-application_t *
-application_get (u32 index)
-{
-  if (index == APP_INVALID_INDEX)
-    return 0;
-  return pool_elt_at_index (app_pool, index);
-}
-
-application_t *
-application_get_if_valid (u32 index)
-{
-  if (pool_is_free_index (app_pool, index))
-    return 0;
-
-  return pool_elt_at_index (app_pool, index);
-}
-
-u32
-application_get_index (application_t * app)
-{
-  return app - app_pool;
-}
-
 static segment_manager_t *
-application_alloc_segment_manager (application_t * app)
+application_alloc_segment_manager (app_worker_t * app_wrk)
 {
   segment_manager_t *sm = 0;
 
   /* If the first segment manager is not in use, don't allocate a new one */
-  if (app->first_segment_manager != APP_INVALID_SEGMENT_MANAGER_INDEX
-      && app->first_segment_manager_in_use == 0)
+  if (app_wrk->first_segment_manager != APP_INVALID_SEGMENT_MANAGER_INDEX
+      && app_wrk->first_segment_manager_in_use == 0)
     {
-      sm = segment_manager_get (app->first_segment_manager);
-      app->first_segment_manager_in_use = 1;
+      sm = segment_manager_get (app_wrk->first_segment_manager);
+      app_wrk->first_segment_manager_in_use = 1;
       return sm;
     }
 
   sm = segment_manager_new ();
-  sm->app_index = app->index;
+  sm->app_wrk_index = app_wrk->wrk_index;
 
   return sm;
 }
@@ -441,8 +544,8 @@
  * it's own specific listening connection.
  */
 int
-application_start_listen (application_t * srv, session_endpoint_t * sep,
-			  session_handle_t * res)
+app_worker_start_listen (app_worker_t * app_wrk, session_endpoint_t * sep,
+			 session_handle_t * res)
 {
   segment_manager_t *sm;
   stream_session_t *s;
@@ -451,22 +554,22 @@
 
   sst = session_type_from_proto_and_ip (sep->transport_proto, sep->is_ip4);
   s = listen_session_new (0, sst);
-  s->app_index = srv->index;
+  s->app_wrk_index = app_wrk->wrk_index;
 
   /* Allocate segment manager. All sessions derived out of a listen session
    * have fifos allocated by the same segment manager. */
-  if (!(sm = application_alloc_segment_manager (srv)))
+  if (!(sm = application_alloc_segment_manager (app_wrk)))
     goto err;
 
   /* Add to app's listener table. Useful to find all child listeners
    * when app goes down, although, just for unbinding this is not needed */
   handle = listen_session_get_handle (s);
-  hash_set (srv->listeners_table, handle, segment_manager_index (sm));
+  hash_set (app_wrk->listeners_table, handle, segment_manager_index (sm));
 
   if (stream_session_listen (s, sep))
     {
       segment_manager_del (sm);
-      hash_unset (srv->listeners_table, handle);
+      hash_unset (app_wrk->listeners_table, handle);
       goto err;
     }
 
@@ -480,83 +583,94 @@
 
 /**
  * Stop listening on session associated to handle
+ *
+ * @param handle	listener handle
+ * @param app_index	index of the app owning the handle. This is used
+ * 			only for validating ownership
  */
 int
-application_stop_listen (application_t * srv, session_handle_t handle)
+app_worker_stop_listen (session_handle_t handle, u32 app_index)
 {
   stream_session_t *listener;
-  uword *indexp;
   segment_manager_t *sm;
+  app_worker_t *app_wrk;
+  uword *indexp;
 
-  if (srv && hash_get (srv->listeners_table, handle) == 0)
+  listener = listen_session_get_from_handle (handle);
+  app_wrk = app_worker_get (listener->app_wrk_index);
+  if (PREDICT_FALSE (!app_wrk || app_wrk->app_index != app_index))
     {
       clib_warning ("app doesn't own handle %llu!", handle);
       return -1;
     }
+  if (PREDICT_FALSE (hash_get (app_wrk->listeners_table, handle) == 0))
+    {
+      clib_warning ("listener handle was removed %llu!", handle);
+      return -1;
+    }
 
-  listener = listen_session_get_from_handle (handle);
   stream_session_stop_listen (listener);
 
-  indexp = hash_get (srv->listeners_table, handle);
+  indexp = hash_get (app_wrk->listeners_table, handle);
   ASSERT (indexp);
 
   sm = segment_manager_get (*indexp);
-  if (srv->first_segment_manager == *indexp)
+  if (app_wrk->first_segment_manager == *indexp)
     {
       /* Delete sessions but don't remove segment manager */
-      srv->first_segment_manager_in_use = 0;
+      app_wrk->first_segment_manager_in_use = 0;
       segment_manager_del_sessions (sm);
     }
   else
     {
       segment_manager_init_del (sm);
     }
-  hash_unset (srv->listeners_table, handle);
+  hash_unset (app_wrk->listeners_table, handle);
   listen_session_del (listener);
 
   return 0;
 }
 
 int
-application_open_session (application_t * app, session_endpoint_t * sep,
-			  u32 api_context)
+app_worker_open_session (app_worker_t * app, session_endpoint_t * sep,
+			 u32 api_context)
 {
   int rv;
 
   /* Make sure we have a segment manager for connects */
-  application_alloc_connects_segment_manager (app);
+  app_worker_alloc_connects_segment_manager (app);
 
-  if ((rv = session_open (app->index, sep, api_context)))
+  if ((rv = session_open (app->wrk_index, sep, api_context)))
     return rv;
 
   return 0;
 }
 
 int
-application_alloc_connects_segment_manager (application_t * app)
+app_worker_alloc_connects_segment_manager (app_worker_t * app_wrk)
 {
   segment_manager_t *sm;
 
-  if (app->connects_seg_manager == APP_INVALID_SEGMENT_MANAGER_INDEX)
+  if (app_wrk->connects_seg_manager == APP_INVALID_SEGMENT_MANAGER_INDEX)
     {
-      sm = application_alloc_segment_manager (app);
+      sm = application_alloc_segment_manager (app_wrk);
       if (sm == 0)
 	return -1;
-      app->connects_seg_manager = segment_manager_index (sm);
+      app_wrk->connects_seg_manager = segment_manager_index (sm);
     }
   return 0;
 }
 
 segment_manager_t *
-application_get_connect_segment_manager (application_t * app)
+app_worker_get_connect_segment_manager (app_worker_t * app)
 {
   ASSERT (app->connects_seg_manager != (u32) ~ 0);
   return segment_manager_get (app->connects_seg_manager);
 }
 
 segment_manager_t *
-application_get_listen_segment_manager (application_t * app,
-					stream_session_t * s)
+app_worker_get_listen_segment_manager (app_worker_t * app,
+				       stream_session_t * s)
 {
   uword *smp;
   smp = hash_get (app->listeners_table, listen_session_get_handle (s));
@@ -564,21 +678,63 @@
   return segment_manager_get (*smp);
 }
 
+clib_error_t *
+vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a)
+{
+  svm_fifo_segment_private_t *fs;
+  app_worker_map_t *wrk_map;
+  app_worker_t *app_wrk;
+  segment_manager_t *sm;
+  application_t *app;
+  int rv;
+
+  app = application_get (a->app_index);
+  if (!app)
+    return clib_error_return_code (0, VNET_API_ERROR_INVALID_VALUE, 0,
+				   "App %u does not exist", a->app_index);
+
+  if (a->is_add)
+    {
+      if ((rv = app_worker_alloc_and_init (app, &app_wrk)))
+	return clib_error_return_code (0, rv, 0, "app wrk init: %d", rv);
+      sm = segment_manager_get (app_wrk->first_segment_manager);
+      fs = segment_manager_get_segment_w_lock (sm, 0);
+      a->segment = &fs->ssvm;
+      segment_manager_segment_reader_unlock (sm);
+      a->evt_q = app_wrk->event_queue;
+    }
+  else
+    {
+      wrk_map = app_worker_map_get (app, a->wrk_index);
+      if (!wrk_map)
+	return clib_error_return_code (0, VNET_API_ERROR_INVALID_VALUE, 0,
+				       "App %u does not have worker %u",
+				       app->app_index, a->wrk_index);
+      app_wrk = app_worker_get (wrk_map->wrk_index);
+      app_worker_map_free (app, wrk_map);
+      if (!app_wrk)
+	return clib_error_return_code (0, VNET_API_ERROR_INVALID_VALUE, 0,
+				       "No worker %u", a->wrk_index);
+      app_worker_free (app_wrk);
+    }
+  return 0;
+}
+
 segment_manager_t *
-application_get_local_segment_manager (application_t * app)
+application_get_local_segment_manager (app_worker_t * app)
 {
   return segment_manager_get (app->local_segment_manager);
 }
 
 segment_manager_t *
-application_get_local_segment_manager_w_session (application_t * app,
+application_get_local_segment_manager_w_session (app_worker_t * app,
 						 local_session_t * ls)
 {
   stream_session_t *listener;
   if (application_local_session_listener_has_transport (ls))
     {
       listener = listen_session_get (ls->listener_index);
-      return application_get_listen_segment_manager (app, listener);
+      return app_worker_get_listen_segment_manager (app, listener);
     }
   return segment_manager_get (app->local_segment_manager);
 }
@@ -601,16 +757,6 @@
   return (application_is_proxy (app) && application_is_builtin (app));
 }
 
-/**
- * Send an API message to the external app, to map new segment
- */
-int
-application_add_segment_notify (u32 app_index, ssvm_private_t * fs)
-{
-  application_t *app = application_get (app_index);
-  return app->cb_fns.add_segment_callback (app->api_client_index, fs);
-}
-
 u8
 application_has_local_scope (application_t * app)
 {
@@ -623,15 +769,26 @@
   return app->flags & APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
 }
 
+/**
+ * Send an API message to the external app, to map new segment
+ */
+int
+app_worker_add_segment_notify (u32 app_wrk_index, ssvm_private_t * fs)
+{
+  app_worker_t *app_wrk = app_worker_get (app_wrk_index);
+  application_t *app = application_get (app_wrk->app_index);
+  return app->cb_fns.add_segment_callback (app->api_client_index, fs);
+}
+
 u32
-application_n_listeners (application_t * app)
+application_n_listeners (app_worker_t * app)
 {
   return hash_elts (app->listeners_table);
 }
 
 stream_session_t *
-application_first_listener (application_t * app, u8 fib_proto,
-			    u8 transport_proto)
+app_worker_first_listener (app_worker_t * app, u8 fib_proto,
+			   u8 transport_proto)
 {
   stream_session_t *listener;
   u64 handle;
@@ -653,8 +810,14 @@
   return 0;
 }
 
+u8
+app_worker_application_is_builtin (app_worker_t * app_wrk)
+{
+  return app_wrk->app_is_builtin;
+}
+
 stream_session_t *
-application_proxy_listener (application_t * app, u8 fib_proto,
+application_proxy_listener (app_worker_t * app, u8 fib_proto,
 			    u8 transport_proto)
 {
   stream_session_t *listener;
@@ -685,26 +848,29 @@
   u8 is_ip4 = (fib_proto == FIB_PROTOCOL_IP4);
   session_endpoint_t sep = SESSION_ENDPOINT_NULL;
   transport_connection_t *tc;
+  app_worker_t *app_wrk;
   stream_session_t *s;
   u64 handle;
 
+  /* TODO decide if we want proxy to be enabled for all workers */
+  app_wrk = application_get_default_worker (app);
   if (is_start)
     {
-      s = application_first_listener (app, fib_proto, transport_proto);
+      s = app_worker_first_listener (app_wrk, fib_proto, transport_proto);
       if (!s)
 	{
 	  sep.is_ip4 = is_ip4;
 	  sep.fib_index = app_namespace_get_fib_index (app_ns, fib_proto);
 	  sep.sw_if_index = app_ns->sw_if_index;
 	  sep.transport_proto = transport_proto;
-	  application_start_listen (app, &sep, &handle);
+	  app_worker_start_listen (app_wrk, &sep, &handle);
 	  s = listen_session_get_from_handle (handle);
 	  s->listener_index = SESSION_PROXY_LISTENER_INDEX;
 	}
     }
   else
     {
-      s = application_proxy_listener (app, fib_proto, transport_proto);
+      s = application_proxy_listener (app_wrk, fib_proto, transport_proto);
       ASSERT (s);
     }
 
@@ -741,10 +907,10 @@
   if (is_start)
     {
       session_lookup_add_session_endpoint (app_ns->local_table_index, &sep,
-					   app->index);
+					   app->app_index);
       sep.is_ip4 = 0;
       session_lookup_add_session_endpoint (app_ns->local_table_index, &sep,
-					   app->index);
+					   app->app_index);
     }
   else
     {
@@ -843,7 +1009,7 @@
 }
 
 static inline int
-app_send_io_evt_rx (application_t * app, stream_session_t * s, u8 lock)
+app_send_io_evt_rx (app_worker_t * app_wrk, stream_session_t * s, u8 lock)
 {
   session_event_t *evt;
   svm_msg_q_msg_t msg;
@@ -858,14 +1024,17 @@
       return 0;
     }
 
-  if (app->cb_fns.builtin_app_rx_callback)
-    return app->cb_fns.builtin_app_rx_callback (s);
+  if (app_worker_application_is_builtin (app_wrk))
+    {
+      application_t *app = application_get (app_wrk->app_index);
+      return app->cb_fns.builtin_app_rx_callback (s);
+    }
 
   if (svm_fifo_has_event (s->server_rx_fifo)
       || svm_fifo_is_empty (s->server_rx_fifo))
     return 0;
 
-  mq = app->event_queue;
+  mq = app_wrk->event_queue;
   if (lock)
     svm_msg_q_lock (mq);
 
@@ -891,16 +1060,16 @@
 }
 
 static inline int
-app_send_io_evt_tx (application_t * app, stream_session_t * s, u8 lock)
+app_send_io_evt_tx (app_worker_t * app_wrk, stream_session_t * s, u8 lock)
 {
   svm_msg_q_t *mq;
   session_event_t *evt;
   svm_msg_q_msg_t msg;
 
-  if (application_is_builtin (app))
+  if (app_worker_application_is_builtin (app_wrk))
     return 0;
 
-  mq = app->event_queue;
+  mq = app_wrk->event_queue;
   if (lock)
     svm_msg_q_lock (mq);
 
@@ -923,7 +1092,7 @@
 }
 
 /* *INDENT-OFF* */
-typedef int (app_send_evt_handler_fn) (application_t *app,
+typedef int (app_send_evt_handler_fn) (app_worker_t *app,
 				       stream_session_t *s,
 				       u8 lock);
 static app_send_evt_handler_fn * const app_send_evt_handler_fns[3] = {
@@ -941,34 +1110,33 @@
  * flag is set, we do wait for queue mutex.
  */
 int
-application_send_event (application_t * app, stream_session_t * s,
-			u8 evt_type)
+application_send_event (app_worker_t * app, stream_session_t * s, u8 evt_type)
 {
   ASSERT (app && evt_type <= FIFO_EVENT_APP_TX);
   return app_send_evt_handler_fns[evt_type] (app, s, 0 /* lock */ );
 }
 
 int
-application_lock_and_send_event (application_t * app, stream_session_t * s,
+application_lock_and_send_event (app_worker_t * app, stream_session_t * s,
 				 u8 evt_type)
 {
   return app_send_evt_handler_fns[evt_type] (app, s, 1 /* lock */ );
 }
 
 local_session_t *
-application_alloc_local_session (application_t * app)
+application_alloc_local_session (app_worker_t * app)
 {
   local_session_t *s;
   pool_get (app->local_sessions, s);
   memset (s, 0, sizeof (*s));
-  s->app_index = app->index;
+  s->app_wrk_index = app->app_index;
   s->session_index = s - app->local_sessions;
   s->session_type = session_type_from_proto_and_ip (TRANSPORT_PROTO_NONE, 0);
   return s;
 }
 
 void
-application_free_local_session (application_t * app, local_session_t * s)
+application_free_local_session (app_worker_t * app, local_session_t * s)
 {
   pool_put (app->local_sessions, s);
   if (CLIB_DEBUG)
@@ -976,23 +1144,23 @@
 }
 
 local_session_t *
-application_get_local_session (application_t * app, u32 session_index)
+application_get_local_session (app_worker_t * app_wrk, u32 session_index)
 {
-  if (pool_is_free_index (app->local_sessions, session_index))
+  if (pool_is_free_index (app_wrk->local_sessions, session_index))
     return 0;
-  return pool_elt_at_index (app->local_sessions, session_index);
+  return pool_elt_at_index (app_wrk->local_sessions, session_index);
 }
 
 local_session_t *
 application_get_local_session_from_handle (session_handle_t handle)
 {
-  application_t *server;
-  u32 session_index, server_index;
-  local_session_parse_handle (handle, &server_index, &session_index);
-  server = application_get_if_valid (server_index);
-  if (!server)
+  app_worker_t *server_wrk;
+  u32 session_index, server_wrk_index;
+  local_session_parse_handle (handle, &server_wrk_index, &session_index);
+  server_wrk = app_worker_get_if_valid (server_wrk_index);
+  if (!server_wrk)
     return 0;
-  return application_get_local_session (server, session_index);
+  return application_get_local_session (server_wrk, session_index);
 }
 
 always_inline void
@@ -1006,26 +1174,28 @@
 }
 
 int
-application_start_local_listen (application_t * server,
+application_start_local_listen (app_worker_t * app_wrk,
 				session_endpoint_t * sep,
 				session_handle_t * handle)
 {
   session_handle_t lh;
   local_session_t *ll;
+  application_t *app;
   u32 table_index;
 
-  table_index = application_local_session_table (server);
+  app = application_get (app_wrk->app_index);
+  table_index = application_local_session_table (app);
 
   /* An exact sep match, as opposed to session_lookup_local_listener */
   lh = session_lookup_endpoint_listener (table_index, sep, 1);
   if (lh != SESSION_INVALID_HANDLE)
     return VNET_API_ERROR_ADDRESS_IN_USE;
 
-  pool_get (server->local_listen_sessions, ll);
+  pool_get (app_wrk->local_listen_sessions, ll);
   memset (ll, 0, sizeof (*ll));
   ll->session_type = session_type_from_proto_and_ip (TRANSPORT_PROTO_NONE, 0);
-  ll->app_index = server->index;
-  ll->session_index = ll - server->local_listen_sessions;
+  ll->app_wrk_index = app_wrk->app_index;
+  ll->session_index = ll - app_wrk->local_listen_sessions;
   ll->port = sep->port;
   /* Store the original session type for the unbind */
   ll->listener_session_type =
@@ -1044,13 +1214,16 @@
  * so parse it.
  */
 int
-application_stop_local_listen (application_t * server, session_handle_t lh)
+application_stop_local_listen (session_handle_t lh, u32 app_index)
 {
   session_endpoint_t sep = SESSION_ENDPOINT_NULL;
-  u32 table_index, ll_index, server_index;
+  u32 table_index, ll_index, server_wrk_index;
+  app_worker_t *server_wrk;
   stream_session_t *sl = 0;
   local_session_t *ll, *ls;
+  application_t *server;
 
+  server = application_get (app_index);
   table_index = application_local_session_table (server);
 
   /* We have both local and global table binds. Figure from global what
@@ -1069,9 +1242,14 @@
 	return -1;
     }
 
-  local_session_parse_handle (lh, &server_index, &ll_index);
-  ASSERT (server->index == server_index);
-  if (!(ll = application_get_local_listen_session (server, ll_index)))
+  local_session_parse_handle (lh, &server_wrk_index, &ll_index);
+  server_wrk = app_worker_get (server_wrk_index);
+  if (PREDICT_FALSE (server_wrk->app_index != app_index))
+    {
+      clib_warning ("app %u does not own local handle 0x%lx", app_index, lh);
+    }
+  ll = application_get_local_listen_session (server_wrk, ll_index);
+  if (PREDICT_FALSE (!ll))
     {
       clib_warning ("no local listener");
       return -1;
@@ -1080,12 +1258,12 @@
   session_lookup_del_session_endpoint (table_index, &sep);
 
   /* *INDENT-OFF* */
-  pool_foreach (ls, server->local_sessions, ({
+  pool_foreach (ls, server_wrk->local_sessions, ({
     if (ls->listener_index == ll->session_index)
-      application_local_session_disconnect (server->index, ls);
+      application_local_session_disconnect (server_wrk->app_index, ls);
   }));
   /* *INDENT-ON* */
-  pool_put_index (server->local_listen_sessions, ll->session_index);
+  pool_put_index (server_wrk->local_listen_sessions, ll->session_index);
 
   return 0;
 }
@@ -1108,8 +1286,8 @@
 }
 
 int
-application_local_session_connect (u32 table_index, application_t * client,
-				   application_t * server,
+application_local_session_connect (app_worker_t * client_wrk,
+				   app_worker_t * server_wrk,
 				   local_session_t * ll, u32 opaque)
 {
   u32 seg_size, evt_q_sz, evt_q_elts, margin = 16 << 10;
@@ -1117,11 +1295,15 @@
   u32 round_rx_fifo_sz, round_tx_fifo_sz;
   int rv, has_transport, seg_index;
   svm_fifo_segment_private_t *seg;
+  application_t *server, *client;
   segment_manager_t *sm;
   local_session_t *ls;
   svm_msg_q_t *sq, *cq;
 
-  ls = application_alloc_local_session (server);
+  ls = application_alloc_local_session (server_wrk);
+
+  server = application_get (server_wrk->app_index);
+  client = application_get (client_wrk->app_index);
 
   props = application_segment_manager_properties (server);
   cprops = application_segment_manager_properties (client);
@@ -1136,7 +1318,7 @@
     {
       /* Local sessions don't have backing transport */
       ls->port = ll->port;
-      sm = application_get_local_segment_manager (server);
+      sm = application_get_local_segment_manager (server_wrk);
     }
   else
     {
@@ -1144,7 +1326,7 @@
       transport_connection_t *tc;
       tc = listen_session_get_transport (sl);
       ls->port = tc->lcl_port;
-      sm = application_get_listen_segment_manager (server, sl);
+      sm = app_worker_get_listen_segment_manager (server_wrk, sl);
     }
 
   seg_index = segment_manager_add_segment (sm, seg_size);
@@ -1178,7 +1360,7 @@
   ls->server_tx_fifo->master_thread_index = ~0;
   ls->svm_segment_index = seg_index;
   ls->listener_index = ll->session_index;
-  ls->client_index = client->index;
+  ls->client_wrk_index = client_wrk->wrk_index;
   ls->client_opaque = opaque;
   ls->listener_session_type = ll->session_type;
 
@@ -1209,14 +1391,14 @@
 static uword
 application_client_local_connect_key (local_session_t * ls)
 {
-  return ((uword) ls->app_index << 32 | (uword) ls->session_index);
+  return ((uword) ls->app_wrk_index << 32 | (uword) ls->session_index);
 }
 
 static void
-application_client_local_connect_key_parse (uword key, u32 * app_index,
+application_client_local_connect_key_parse (uword key, u32 * app_wrk_index,
 					    u32 * session_index)
 {
-  *app_index = key >> 32;
+  *app_wrk_index = key >> 32;
   *session_index = key & 0xFFFFFFFF;
 }
 
@@ -1224,22 +1406,25 @@
 application_local_session_connect_notify (local_session_t * ls)
 {
   svm_fifo_segment_private_t *seg;
-  application_t *client, *server;
+  app_worker_t *client_wrk, *server_wrk;
   segment_manager_t *sm;
+  application_t *client;
   int rv, is_fail = 0;
   uword client_key;
 
-  client = application_get (ls->client_index);
-  server = application_get (ls->app_index);
-  sm = application_get_local_segment_manager_w_session (server, ls);
+  client_wrk = app_worker_get (ls->client_wrk_index);
+  server_wrk = app_worker_get (ls->app_wrk_index);
+  client = application_get (client_wrk->app_index);
+
+  sm = application_get_local_segment_manager_w_session (server_wrk, ls);
   seg = segment_manager_get_segment_w_lock (sm, ls->svm_segment_index);
   if ((rv = client->cb_fns.add_segment_callback (client->api_client_index,
 						 &seg->ssvm)))
     {
       clib_warning ("failed to notify client %u of new segment",
-		    ls->client_index);
+		    ls->client_wrk_index);
       segment_manager_segment_reader_unlock (sm);
-      application_local_session_disconnect (ls->client_index, ls);
+      application_local_session_disconnect (ls->client_wrk_index, ls);
       is_fail = 1;
     }
   else
@@ -1247,18 +1432,19 @@
       segment_manager_segment_reader_unlock (sm);
     }
 
-  client->cb_fns.session_connected_callback (client->index, ls->client_opaque,
+  client->cb_fns.session_connected_callback (client_wrk->wrk_index,
+					     ls->client_opaque,
 					     (stream_session_t *) ls,
 					     is_fail);
 
   client_key = application_client_local_connect_key (ls);
-  hash_set (client->local_connects, client_key, client_key);
+  hash_set (client_wrk->local_connects, client_key, client_key);
   return 0;
 }
 
 int
-application_local_session_cleanup (application_t * client,
-				   application_t * server,
+application_local_session_cleanup (app_worker_t * client_wrk,
+				   app_worker_t * server_wrk,
 				   local_session_t * ls)
 {
   svm_fifo_segment_private_t *seg;
@@ -1269,63 +1455,71 @@
   has_transport = session_has_transport ((stream_session_t *) ls);
   client_key = application_client_local_connect_key (ls);
   if (!has_transport)
-    sm = application_get_local_segment_manager_w_session (server, ls);
+    sm = application_get_local_segment_manager_w_session (server_wrk, ls);
   else
-    sm = application_get_listen_segment_manager (server,
-						 (stream_session_t *) ls);
+    sm = app_worker_get_listen_segment_manager (server_wrk,
+						(stream_session_t *) ls);
 
   seg = segment_manager_get_segment (sm, ls->svm_segment_index);
-  if (client)
-    hash_unset (client->local_connects, client_key);
+  if (client_wrk)
+    hash_unset (client_wrk->local_connects, client_key);
 
   if (!has_transport)
     {
+      application_t *server = application_get (server_wrk->app_index);
       server->cb_fns.del_segment_callback (server->api_client_index,
 					   &seg->ssvm);
-      if (client)
-	client->cb_fns.del_segment_callback (client->api_client_index,
-					     &seg->ssvm);
+      if (client_wrk)
+	{
+	  application_t *client = application_get (client_wrk->app_index);
+	  client->cb_fns.del_segment_callback (client->api_client_index,
+					       &seg->ssvm);
+	}
       segment_manager_del_segment (sm, seg);
     }
 
-  application_free_local_session (server, ls);
+  application_free_local_session (server_wrk, ls);
 
   return 0;
 }
 
 int
-application_local_session_disconnect (u32 app_index, local_session_t * ls)
+application_local_session_disconnect (u32 app_wrk_index, local_session_t * ls)
 {
-  application_t *client, *server;
+  app_worker_t *client_wrk, *server_wrk;
 
-  client = application_get_if_valid (ls->client_index);
-  server = application_get (ls->app_index);
+  client_wrk = app_worker_get_if_valid (ls->client_wrk_index);
+  server_wrk = app_worker_get (ls->app_wrk_index);
+
 
   if (ls->session_state == SESSION_STATE_CLOSED)
-    return application_local_session_cleanup (client, server, ls);
+    return application_local_session_cleanup (client_wrk, server_wrk, ls);
 
-  if (app_index == ls->client_index)
+  if (app_wrk_index == ls->client_wrk_index)
     {
-      mq_send_local_session_disconnected_cb (ls->app_index, ls);
+      mq_send_local_session_disconnected_cb (ls->app_wrk_index, ls);
     }
   else
     {
-      if (!client)
+      if (!client_wrk)
 	{
-	  return application_local_session_cleanup (client, server, ls);
+	  return application_local_session_cleanup (client_wrk, server_wrk,
+						    ls);
 	}
       else if (ls->session_state < SESSION_STATE_READY)
 	{
-	  client->cb_fns.session_connected_callback (client->index,
+	  application_t *client = application_get (client_wrk->app_index);
+	  client->cb_fns.session_connected_callback (client_wrk->wrk_index,
 						     ls->client_opaque,
 						     (stream_session_t *) ls,
 						     1 /* is_fail */ );
 	  ls->session_state = SESSION_STATE_CLOSED;
-	  return application_local_session_cleanup (client, server, ls);
+	  return application_local_session_cleanup (client_wrk, server_wrk,
+						    ls);
 	}
       else
 	{
-	  mq_send_local_session_disconnected_cb (client->index, ls);
+	  mq_send_local_session_disconnected_cb (client_wrk->wrk_index, ls);
 	}
     }
 
@@ -1335,32 +1529,34 @@
 }
 
 int
-application_local_session_disconnect_w_index (u32 app_index, u32 ls_index)
+application_local_session_disconnect_w_index (u32 app_wrk_index, u32 ls_index)
 {
-  application_t *app;
+  app_worker_t *app_wrk;
   local_session_t *ls;
-  app = application_get (app_index);
-  ls = application_get_local_session (app, ls_index);
-  return application_local_session_disconnect (app_index, ls);
+  app_wrk = app_worker_get (app_wrk_index);
+  ls = application_get_local_session (app_wrk, ls_index);
+  return application_local_session_disconnect (app_wrk_index, ls);
 }
 
 void
-application_local_sessions_del (application_t * app)
+application_local_sessions_free (app_worker_t * app_wrk)
 {
-  u32 index, server_index, session_index, table_index;
+  u32 index, server_wrk_index, session_index, table_index;
   segment_manager_t *sm;
   u64 handle, *handles = 0;
   local_session_t *ls, *ll;
-  application_t *server;
+  app_worker_t *server_wrk;
   session_endpoint_t sep;
+  application_t *app;
   int i;
 
   /*
    * Local listens. Don't bother with local sessions, we clean them lower
    */
+  app = application_get (app_wrk->app_index);
   table_index = application_local_session_table (app);
   /* *INDENT-OFF* */
-  pool_foreach (ll, app->local_listen_sessions, ({
+  pool_foreach (ll, app_wrk->local_listen_sessions, ({
     application_local_listener_session_endpoint (ll, &sep);
     session_lookup_del_session_endpoint (table_index, &sep);
   }));
@@ -1369,11 +1565,11 @@
   /*
    * Local sessions
    */
-  if (app->local_sessions)
+  if (app_wrk->local_sessions)
     {
       /* *INDENT-OFF* */
-      pool_foreach (ls, app->local_sessions, ({
-	application_local_session_disconnect (app->index, ls);
+      pool_foreach (ls, app_wrk->local_sessions, ({
+	application_local_session_disconnect (app_wrk->wrk_index, ls);
       }));
       /* *INDENT-ON* */
     }
@@ -1383,25 +1579,26 @@
    */
   vec_reset_length (handles);
   /* *INDENT-OFF* */
-  hash_foreach (handle, index, app->local_connects, ({
+  hash_foreach (handle, index, app_wrk->local_connects, ({
     vec_add1 (handles, handle);
   }));
   /* *INDENT-ON* */
 
   for (i = 0; i < vec_len (handles); i++)
     {
-      application_client_local_connect_key_parse (handles[i], &server_index,
+      application_client_local_connect_key_parse (handles[i],
+						  &server_wrk_index,
 						  &session_index);
-      server = application_get_if_valid (server_index);
-      if (server)
+      server_wrk = app_worker_get_if_valid (server_wrk_index);
+      if (server_wrk)
 	{
-	  ls = application_get_local_session (server, session_index);
-	  application_local_session_disconnect (app->index, ls);
+	  ls = application_get_local_session (server_wrk, session_index);
+	  application_local_session_disconnect (app_wrk->wrk_index, ls);
 	}
     }
 
-  sm = segment_manager_get (app->local_segment_manager);
-  sm->app_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
+  sm = segment_manager_get (app_wrk->local_segment_manager);
+  sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
   segment_manager_del (sm);
 }
 
@@ -1430,52 +1627,84 @@
 }
 
 u8 *
-format_application_listener (u8 * s, va_list * args)
+format_app_worker_listener (u8 * s, va_list * args)
 {
-  application_t *app = va_arg (*args, application_t *);
+  app_worker_t *app_wrk = va_arg (*args, app_worker_t *);
   u64 handle = va_arg (*args, u64);
   u32 sm_index = va_arg (*args, u32);
   int verbose = va_arg (*args, int);
   stream_session_t *listener;
+  application_t *app;
   u8 *app_name, *str;
 
-  if (app == 0)
+  if (!app_wrk)
     {
       if (verbose)
-	s = format (s, "%-40s%-20s%-15s%-15s%-10s", "Connection", "App",
+	s = format (s, "%-40s%-25s%-15s%-15s%-10s", "Connection", "App",
 		    "API Client", "ListenerID", "SegManager");
       else
-	s = format (s, "%-40s%-20s", "Connection", "App");
+	s = format (s, "%-40s%-25s", "Connection", "App");
 
       return s;
     }
 
+  app = application_get (app_wrk->app_index);
   app_name = app_get_name_from_reg_index (app);
   listener = listen_session_get_from_handle (handle);
   str = format (0, "%U", format_stream_session, listener, verbose);
 
   if (verbose)
     {
-      s = format (s, "%-40s%-20s%-15u%-15u%-10u", str, app_name,
+      s = format (s, "%-40s%-25s%-15u%-15u%-10u", str, app_name,
 		  app->api_client_index, handle, sm_index);
     }
   else
-    s = format (s, "%-40s%-20s", str, app_name);
+    s = format (s, "%-40s%-25s", str, app_name);
 
   vec_free (app_name);
   return s;
 }
 
-void
-application_format_connects (application_t * app, int verbose)
+static void
+application_format_listeners (application_t * app, int verbose)
+{
+  vlib_main_t *vm = vlib_get_main ();
+  app_worker_map_t *wrk_map;
+  app_worker_t *app_wrk;
+  u32 sm_index;
+  u64 handle;
+
+  if (!app)
+    {
+      vlib_cli_output (vm, "%U", format_app_worker_listener, 0 /* header */ ,
+		       0, 0, verbose);
+      return;
+    }
+
+  /* *INDENT-OFF* */
+  pool_foreach (wrk_map, app->worker_maps, ({
+    app_wrk = app_worker_get (wrk_map->wrk_index);
+    if (hash_elts (app_wrk->listeners_table) == 0)
+      continue;
+    hash_foreach (handle, sm_index, app_wrk->listeners_table, ({
+      vlib_cli_output (vm, "%U", format_app_worker_listener, app_wrk,
+                       handle, sm_index, verbose);
+    }));
+  }));
+  /* *INDENT-ON* */
+}
+
+static void
+app_worker_format_connects (app_worker_t * app_wrk, int verbose)
 {
   svm_fifo_segment_private_t *fifo_segment;
   vlib_main_t *vm = vlib_get_main ();
   segment_manager_t *sm;
   u8 *app_name, *s = 0;
+  application_t *app;
 
   /* Header */
-  if (app == 0)
+  if (!app_wrk)
     {
       if (verbose)
 	vlib_cli_output (vm, "%-40s%-20s%-15s%-10s", "Connection", "App",
@@ -1485,14 +1714,14 @@
       return;
     }
 
-  /* make sure */
-  if (app->connects_seg_manager == (u32) ~ 0)
+  app = application_get (app_wrk->app_index);
+  if (app_wrk->connects_seg_manager == (u32) ~ 0)
     return;
 
   app_name = app_get_name_from_reg_index (app);
 
   /* Across all fifo segments */
-  sm = segment_manager_get (app->connects_seg_manager);
+  sm = segment_manager_get (app_wrk->connects_seg_manager);
 
   /* *INDENT-OFF* */
   segment_manager_foreach_segment_w_lock (fifo_segment, sm, ({
@@ -1513,7 +1742,7 @@
 
 	  if (verbose)
 	    s = format (s, "%-40s%-20s%-15u%-10u", str, app_name,
-			app->api_client_index, app->connects_seg_manager);
+			app->api_client_index, app_wrk->connects_seg_manager);
 	  else
 	    s = format (s, "%-40s%-20s", str, app_name);
 
@@ -1530,8 +1759,28 @@
   vec_free (app_name);
 }
 
-void
-application_format_local_sessions (application_t * app, int verbose)
+static void
+application_format_connects (application_t * app, int verbose)
+{
+  app_worker_map_t *wrk_map;
+  app_worker_t *app_wrk;
+
+  if (!app)
+    {
+      app_worker_format_connects (0, verbose);
+      return;
+    }
+
+  /* *INDENT-OFF* */
+  pool_foreach (wrk_map, app->worker_maps, ({
+    app_wrk = app_worker_get (wrk_map->wrk_index);
+    app_worker_format_connects (app_wrk, verbose);
+  }));
+  /* *INDENT-ON* */
+}
+
+static void
+app_worker_format_local_sessions (app_worker_t * app_wrk, int verbose)
 {
   vlib_main_t *vm = vlib_get_main ();
   local_session_t *ls;
@@ -1539,27 +1788,31 @@
   u8 *conn = 0;
 
   /* Header */
-  if (app == 0)
+  if (app_wrk == 0)
     {
       vlib_cli_output (vm, "%-40s%-15s%-20s", "Connection", "ServerApp",
 		       "ClientApp");
       return;
     }
 
+  if (!pool_elts (app_wrk->local_sessions)
+      && !pool_elts (app_wrk->local_connects))
+    return;
+
   /* *INDENT-OFF* */
-  pool_foreach (ls, app->local_listen_sessions, ({
+  pool_foreach (ls, app_wrk->local_listen_sessions, ({
     tp = session_type_transport_proto(ls->listener_session_type);
     conn = format (0, "[L][%U] *:%u", format_transport_proto_short, tp,
                    ls->port);
-    vlib_cli_output (vm, "%-40v%-15u%-20s", conn, ls->app_index, "*");
+    vlib_cli_output (vm, "%-40v%-15u%-20s", conn, ls->app_wrk_index, "*");
     vec_reset_length (conn);
   }));
-  pool_foreach (ls, app->local_sessions, ({
+  pool_foreach (ls, app_wrk->local_sessions, ({
     tp = session_type_transport_proto(ls->listener_session_type);
     conn = format (0, "[L][%U] *:%u", format_transport_proto_short, tp,
                    ls->port);
-    vlib_cli_output (vm, "%-40v%-15u%-20u", conn, ls->app_index,
-                     ls->client_index);
+    vlib_cli_output (vm, "%-40v%-15u%-20u", conn, ls->app_wrk_index,
+                     ls->client_wrk_index);
     vec_reset_length (conn);
   }));
   /* *INDENT-ON* */
@@ -1567,12 +1820,32 @@
   vec_free (conn);
 }
 
-void
-application_format_local_connects (application_t * app, int verbose)
+static void
+application_format_local_sessions (application_t * app, int verbose)
+{
+  app_worker_map_t *wrk_map;
+  app_worker_t *app_wrk;
+
+  if (!app)
+    {
+      app_worker_format_local_sessions (0, verbose);
+      return;
+    }
+
+  /* *INDENT-OFF* */
+  pool_foreach (wrk_map, app->worker_maps, ({
+    app_wrk = app_worker_get (wrk_map->wrk_index);
+    app_worker_format_local_sessions (app_wrk, verbose);
+  }));
+  /* *INDENT-ON* */
+}
+
+static void
+app_worker_format_local_connects (app_worker_t * app, int verbose)
 {
   vlib_main_t *vm = vlib_get_main ();
-  u32 app_index, session_index;
-  application_t *server;
+  u32 app_wrk_index, session_index;
+  app_worker_t *server_wrk;
   local_session_t *ls;
   uword client_key;
   u64 value;
@@ -1589,13 +1862,37 @@
       return;
     }
 
+  if (!app->local_connects)
+    return;
+
   /* *INDENT-OFF* */
   hash_foreach (client_key, value, app->local_connects, ({
-    application_client_local_connect_key_parse (client_key, &app_index,
+    application_client_local_connect_key_parse (client_key, &app_wrk_index,
                                                 &session_index);
-    server = application_get (app_index);
-    ls = application_get_local_session (server, session_index);
-    vlib_cli_output (vm, "%-40s%-15s%-20s", "TODO", ls->app_index, ls->client_index);
+    server_wrk = app_worker_get (app_wrk_index);
+    ls = application_get_local_session (server_wrk, session_index);
+    vlib_cli_output (vm, "%-40s%-15s%-20s", "TODO", ls->app_wrk_index,
+                     ls->client_wrk_index);
+  }));
+  /* *INDENT-ON* */
+}
+
+static void
+application_format_local_connects (application_t * app, int verbose)
+{
+  app_worker_map_t *wrk_map;
+  app_worker_t *app_wrk;
+
+  if (!app)
+    {
+      app_worker_format_local_connects (0, verbose);
+      return;
+    }
+
+  /* *INDENT-OFF* */
+  pool_foreach (wrk_map, app->worker_maps, ({
+    app_wrk = app_worker_get (wrk_map->wrk_index);
+    app_worker_format_local_connects (app_wrk, verbose);
   }));
   /* *INDENT-ON* */
 }
@@ -1625,26 +1922,23 @@
   app_ns_name = app_namespace_id_from_index (app->ns_index);
   props = application_segment_manager_properties (app);
   if (verbose)
-    s = format (s, "%-10u%-20s%-15d%-15u%-15U%-15U%-15U", app->index,
+    s = format (s, "%-10u%-20s%-15d%-15u%-15U%-15U%-15U", app->app_index,
 		app_name, app->api_client_index, app->ns_index,
 		format_memory_size, props->add_segment_size,
 		format_memory_size, props->rx_fifo_size, format_memory_size,
 		props->tx_fifo_size);
   else
-    s = format (s, "%-10u%-20s%-15d%-40s", app->index, app_name,
+    s = format (s, "%-10u%-20s%-15d%-40s", app->app_index, app_name,
 		app->api_client_index, app_ns_name);
   return s;
 }
 
-
 void
 application_format_all_listeners (vlib_main_t * vm, int do_local, int verbose)
 {
   application_t *app;
-  u32 sm_index;
-  u64 handle;
 
-  if (!pool_elts (app_pool))
+  if (!pool_elts (app_main.app_pool))
     {
       vlib_cli_output (vm, "No active server bindings");
       return;
@@ -1654,27 +1948,18 @@
     {
       application_format_local_sessions (0, verbose);
       /* *INDENT-OFF* */
-      pool_foreach (app, app_pool, ({
-        if (!pool_elts (app->local_sessions)
-            && !pool_elts(app->local_connects))
-          continue;
+      pool_foreach (app, app_main.app_pool, ({
         application_format_local_sessions (app, verbose);
       }));
       /* *INDENT-ON* */
     }
   else
     {
-      vlib_cli_output (vm, "%U", format_application_listener, 0 /* header */ ,
-		       0, 0, verbose);
+      application_format_listeners (0, verbose);
 
       /* *INDENT-OFF* */
-      pool_foreach (app, app_pool, ({
-        if (hash_elts (app->listeners_table) == 0)
-          continue;
-        hash_foreach (handle, sm_index, app->listeners_table, ({
-          vlib_cli_output (vm, "%U", format_application_listener, app,
-                           handle, sm_index, verbose);
-        }));
+      pool_foreach (app, app_main.app_pool, ({
+        application_format_listeners (app, verbose);
       }));
       /* *INDENT-ON* */
     }
@@ -1685,7 +1970,7 @@
 {
   application_t *app;
 
-  if (!pool_elts (app_pool))
+  if (!pool_elts (app_main.app_pool))
     {
       vlib_cli_output (vm, "No active apps");
       return;
@@ -1696,9 +1981,8 @@
       application_format_local_connects (0, verbose);
 
       /* *INDENT-OFF* */
-      pool_foreach (app, app_pool, ({
-        if (app->local_connects)
-          application_format_local_connects (app, verbose);
+      pool_foreach (app, app_main.app_pool, ({
+	application_format_local_connects (app, verbose);
       }));
       /* *INDENT-ON* */
     }
@@ -1707,9 +1991,7 @@
       application_format_connects (0, verbose);
 
       /* *INDENT-OFF* */
-      pool_foreach (app, app_pool, ({
-        if (app->connects_seg_manager == (u32)~0)
-          continue;
+      pool_foreach (app, app_main.app_pool, ({
         application_format_connects (app, verbose);
       }));
       /* *INDENT-ON* */
@@ -1751,7 +2033,7 @@
     {
       vlib_cli_output (vm, "%U", format_application, 0, verbose);
       /* *INDENT-OFF* */
-      pool_foreach (app, app_pool, ({
+      pool_foreach (app, app_main.app_pool, ({
 	vlib_cli_output (vm, "%U", format_application, app, verbose);
       }));
       /* *INDENT-ON* */
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index 22df21e..cf85566 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -20,6 +20,14 @@
 #include <vnet/session/segment_manager.h>
 #include <vnet/session/application_namespace.h>
 
+#define APP_DEBUG 0
+
+#if APP_DEBUG > 0
+#define APP_DBG(_fmt, _args...) clib_warning (_fmt, ##_args)
+#else
+#define APP_DBG(_fmt, _args...)
+#endif
+
 typedef struct _stream_session_cb_vft
 {
   /** Notify server of new segment */
@@ -33,7 +41,7 @@
   int (*session_accept_callback) (stream_session_t * new_session);
 
   /** Connection request callback */
-  int (*session_connected_callback) (u32 app_index, u32 opaque,
+  int (*session_connected_callback) (u32 app_wrk_index, u32 opaque,
 				     stream_session_t * s, u8 code);
 
   /** Notify app that session is closing */
@@ -50,39 +58,20 @@
 
 } session_cb_vft_t;
 
-typedef struct _application
+typedef struct app_worker_
 {
-  /** Index in server pool */
-  u32 index;
+  /** Worker index in global worker pool*/
+  u32 wrk_index;
 
-  /** Flags */
-  u32 flags;
+  /** Worker index in app's map pool */
+  u32 wrk_map_index;
 
-  /** Name registered by builtin apps */
-  u8 *name;
-
-  /*
-   * Binary API interface to external app
-   */
-
-  /** Binary API connection index, ~0 if internal */
-  u32 api_client_index;
-
-  /** Namespace the application belongs to */
-  u32 ns_index;
+  /** Index of owning app */
+  u32 app_index;
 
   /** Application listens for events on this svm queue */
   svm_msg_q_t *event_queue;
 
-  /*
-   * Callbacks: shoulder-taps for the server/client
-   */
-
-  session_cb_vft_t cb_fns;
-
-  /*
-   * ssvm (fifo) segment management
-   */
   /** Segment manager used for outgoing connects issued by the app */
   u32 connects_seg_manager;
 
@@ -97,11 +86,6 @@
   u32 first_segment_manager;
   u8 first_segment_manager_in_use;
 
-  /** Segment manager properties. Shared by all segment managers */
-  segment_manager_properties_t sm_properties;
-
-  u16 proxied_transports;
-
   /*
    * Local "cut through" connections specific
    */
@@ -118,6 +102,42 @@
   /** Hash table of the app's local connects */
   uword *local_connects;
 
+  u8 app_is_builtin;
+} app_worker_t;
+
+typedef struct app_worker_map_
+{
+  u32 wrk_index;
+} app_worker_map_t;
+
+typedef struct application_
+{
+  /** App index in app pool */
+  u32 app_index;
+
+  /** Binary API connection index, ~0 if internal */
+  u32 api_client_index;
+
+  /** Flags */
+  u32 flags;
+
+  /** Callbacks: shoulder-taps for the server/client */
+  session_cb_vft_t cb_fns;
+
+  /** Segment manager properties. Shared by all segment managers */
+  segment_manager_properties_t sm_properties;
+
+  /** Pool of mappings that keep track of workers associated to this app */
+  app_worker_map_t *worker_maps;
+
+  /** Name registered by builtin apps */
+  u8 *name;
+
+  /** Namespace the application belongs to */
+  u32 ns_index;
+
+  u16 proxied_transports;
+
   /*
    * TLS Specific
    */
@@ -132,97 +152,145 @@
   u8 tls_engine;
 } application_t;
 
+typedef struct app_main_
+{
+  /**
+   * Pool from which we allocate all applications
+   */
+  application_t *app_pool;
+
+  /**
+   * Pool of workers associated to apps
+   */
+  app_worker_t *workers;
+
+  /**
+   * Hash table of apps by api client index
+   */
+  uword *app_by_api_client_index;
+
+  /**
+   * Hash table of builtin apps by name
+   */
+  uword *app_by_name;
+} app_main_t;
+
+#define foreach_app_init_args			\
+  _(u32, api_client_index)			\
+  _(u8 *, name)					\
+  _(u64 *, options)				\
+  _(u8 *, namespace_id)				\
+  _(session_cb_vft_t *, session_cb_vft)		\
+  _(u32, app_index)				\
+
+typedef struct app_init_args_
+{
+#define _(_type, _name) _type _name;
+  foreach_app_init_args
+#undef _
+} app_init_args_t;
+
+typedef struct _vnet_app_worker_add_del_args
+{
+  u32 app_index;		/**< App for which a new worker is requested */
+  u32 wrk_index;		/**< Index to delete or return value if add */
+  ssvm_private_t *segment;	/**< First segment in segment manager */
+  svm_msg_q_t *evt_q;		/**< Worker message queue */
+  u8 is_add;			/**< Flag set if addition */
+} vnet_app_worker_add_del_args_t;
+
 #define APP_INVALID_INDEX ((u32)~0)
 #define APP_NS_INVALID_INDEX ((u32)~0)
 #define APP_INVALID_SEGMENT_MANAGER_INDEX ((u32) ~0)
 
-application_t *application_new ();
-int application_init (application_t * app, u32 api_client_index,
-		      u8 * name, u64 * options, session_cb_vft_t * cb_fns);
-void application_del (application_t * app);
+app_worker_t *app_worker_alloc (application_t * app);
+int app_worker_alloc_and_init (application_t * app, app_worker_t ** wrk);
+app_worker_t *app_worker_get (u32 wrk_index);
+app_worker_t *app_worker_get_if_valid (u32 wrk_index);
+void app_worker_free (app_worker_t * app_wrk);
+int app_worker_start_listen (app_worker_t * app,
+			     session_endpoint_t * tep,
+			     session_handle_t * handle);
+int app_worker_stop_listen (session_handle_t handle, u32 app_wrk_index);
+int app_worker_open_session (app_worker_t * app, session_endpoint_t * tep,
+			     u32 api_context);
+segment_manager_t *app_worker_get_listen_segment_manager (app_worker_t *,
+							  stream_session_t *);
+segment_manager_t *app_worker_get_connect_segment_manager (app_worker_t *);
+int app_worker_alloc_connects_segment_manager (app_worker_t * app);
+int app_worker_add_segment_notify (u32 app_wrk_index, ssvm_private_t * fs);
+u32 app_worker_n_listeners (app_worker_t * app);
+stream_session_t *app_worker_first_listener (app_worker_t * app,
+					     u8 fib_proto,
+					     u8 transport_proto);
+u8 app_worker_application_is_builtin (app_worker_t * app_wrk);
+clib_error_t *vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a);
+
+application_t *application_alloc (void);
+int application_alloc_and_init (app_init_args_t * args);
+void application_free (application_t * app);
 application_t *application_get (u32 index);
 application_t *application_get_if_valid (u32 index);
 application_t *application_lookup (u32 api_client_index);
 application_t *application_lookup_name (const u8 * name);
-u32 application_get_index (application_t * app);
-
-int application_start_listen (application_t * app,
-			      session_endpoint_t * tep,
-			      session_handle_t * handle);
-int application_start_local_listen (application_t * server,
-				    session_endpoint_t * sep,
-				    session_handle_t * handle);
-int application_stop_listen (application_t * srv, session_handle_t handle);
-int application_stop_local_listen (application_t * server,
-				   session_handle_t listener_handle);
-int application_open_session (application_t * app, session_endpoint_t * tep,
-			      u32 api_context);
+u32 application_index (application_t * app);
+app_worker_t *application_get_worker (application_t * app, u32 wrk_index);
+app_worker_t *application_get_default_worker (application_t * app);
 int application_api_queue_is_full (application_t * app);
 
-segment_manager_t *application_get_listen_segment_manager (application_t *
-							   app,
-							   stream_session_t *
-							   ls);
-segment_manager_t *application_get_connect_segment_manager (application_t *
-							    app);
-int application_alloc_connects_segment_manager (application_t * app);
 
 int application_is_proxy (application_t * app);
 int application_is_builtin (application_t * app);
 int application_is_builtin_proxy (application_t * app);
-int application_add_segment_notify (u32 app_index, ssvm_private_t * fs);
 u32 application_session_table (application_t * app, u8 fib_proto);
 u32 application_local_session_table (application_t * app);
-u8 *application_name_from_index (u32 app_index);
-
+u8 *application_name_from_index (u32 app_wrk_index);
 u8 application_has_local_scope (application_t * app);
 u8 application_has_global_scope (application_t * app);
-u32 application_n_listeners (application_t * app);
-stream_session_t *application_first_listener (application_t * app,
-					      u8 fib_proto,
-					      u8 transport_proto);
 void application_setup_proxy (application_t * app);
 void application_remove_proxy (application_t * app);
 
 segment_manager_properties_t *application_get_segment_manager_properties (u32
-									  app_index);
+									  app_wrk_index);
 segment_manager_properties_t
   * application_segment_manager_properties (application_t * app);
 
-local_session_t *application_alloc_local_session (application_t * app);
-void application_free_local_session (application_t * app,
+local_session_t *application_alloc_local_session (app_worker_t * app);
+void application_free_local_session (app_worker_t * app,
 				     local_session_t * ls);
-local_session_t *application_get_local_session (application_t * app,
+local_session_t *application_get_local_session (app_worker_t * app,
 						u32 session_index);
 local_session_t *application_get_local_session_from_handle (session_handle_t
 							    handle);
-int application_local_session_connect (u32 table_index,
-				       application_t * client,
-				       application_t * server,
+int application_start_local_listen (app_worker_t * server,
+				    session_endpoint_t * sep,
+				    session_handle_t * handle);
+int application_stop_local_listen (session_handle_t lh, u32 app_wrk_index);
+int application_local_session_connect (app_worker_t * client,
+				       app_worker_t * server,
 				       local_session_t * ll, u32 opaque);
 int application_local_session_connect_notify (local_session_t * ls);
-int application_local_session_disconnect (u32 app_index,
+int application_local_session_disconnect (u32 app_wrk_index,
 					  local_session_t * ls);
-int application_local_session_disconnect_w_index (u32 app_index,
+int application_local_session_disconnect_w_index (u32 app_wrk_index,
 						  u32 ls_index);
-void application_local_sessions_del (application_t * app);
+void application_local_sessions_free (app_worker_t * app);
 
-int application_send_event (application_t * app, stream_session_t * s,
-			    u8 evt);
-int application_lock_and_send_event (application_t * app,
+int application_send_event (app_worker_t * app, stream_session_t * s, u8 evt);
+int application_lock_and_send_event (app_worker_t * app,
 				     stream_session_t * s, u8 evt_type);
 
 always_inline u32
 local_session_id (local_session_t * ll)
 {
-  ASSERT (ll->app_index < (2 << 16) && ll->session_index < (2 << 16));
-  return ((u32) ll->app_index << 16 | (u32) ll->session_index);
+  ASSERT (ll->app_wrk_index < (2 << 16) && ll->session_index < (2 << 16));
+  return ((u32) ll->app_wrk_index << 16 | (u32) ll->session_index);
 }
 
 always_inline void
-local_session_parse_id (u32 ls_id, u32 * app_index, u32 * session_index)
+local_session_parse_id (u32 ls_id, u32 * app_wrk_index, u32 * session_index)
 {
-  *app_index = ls_id >> 16;
+  *app_wrk_index = ls_id >> 16;
   *session_index = ls_id & 0xFFF;
 }
 
@@ -244,7 +312,7 @@
 }
 
 always_inline local_session_t *
-application_get_local_listen_session (application_t * app, u32 session_index)
+application_get_local_listen_session (app_worker_t * app, u32 session_index)
 {
   return pool_elt_at_index (app->local_listen_sessions, session_index);
 }
@@ -252,10 +320,10 @@
 always_inline local_session_t *
 application_get_local_listener_w_handle (session_handle_t handle)
 {
-  u32 server_index, session_index;
-  application_t *app;
-  local_session_parse_handle (handle, &server_index, &session_index);
-  app = application_get (server_index);
+  u32 server_wrk_index, session_index;
+  app_worker_t *app;
+  local_session_parse_handle (handle, &server_wrk_index, &session_index);
+  app = app_worker_get (server_wrk_index);
   return application_get_local_listen_session (app, session_index);
 }
 
@@ -267,12 +335,9 @@
   return (tp != TRANSPORT_PROTO_NONE);
 }
 
-void mq_send_local_session_disconnected_cb (u32 app_index,
+void mq_send_local_session_disconnected_cb (u32 app_wrk_index,
 					    local_session_t * ls);
 
-int application_connect (u32 client_index, u32 api_context,
-			 session_endpoint_t * sep);
-
 uword unformat_application_proto (unformat_input_t * input, va_list * args);
 
 #endif /* SRC_VNET_SESSION_APPLICATION_H_ */
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index 524e7b5..f8d43d4 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -148,27 +148,29 @@
 }
 
 static int
-vnet_bind_i (u32 app_index, session_endpoint_t * sep, u64 * handle)
+vnet_bind_i (vnet_bind_args_t * a)
 {
   u64 lh, ll_handle = SESSION_INVALID_HANDLE;
+  u32 table_index, fib_proto;
+  app_worker_t *app_wrk;
   application_t *app;
-  u32 table_index;
   int rv;
 
-  app = application_get_if_valid (app_index);
+  app = application_get_if_valid (a->app_index);
   if (!app)
     {
       SESSION_DBG ("app not attached");
       return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
     }
+  app_wrk = application_get_worker (app, a->wrk_map_index);
 
-  session_endpoint_update_for_app (sep, app);
-  if (!session_endpoint_in_ns (sep))
+  session_endpoint_update_for_app (&a->sep, app);
+  if (!session_endpoint_in_ns (&a->sep))
     return VNET_API_ERROR_INVALID_VALUE_2;
 
-  table_index = application_session_table (app,
-					   session_endpoint_fib_proto (sep));
-  lh = session_lookup_endpoint_listener (table_index, sep, 1);
+  fib_proto = session_endpoint_fib_proto (&a->sep);
+  table_index = application_session_table (app, fib_proto);
+  lh = session_lookup_endpoint_listener (table_index, &a->sep, 1);
   if (lh != SESSION_INVALID_HANDLE)
     return VNET_API_ERROR_ADDRESS_IN_USE;
 
@@ -176,11 +178,13 @@
    * Add session endpoint to local session table. Only binds to "inaddr_any"
    * (i.e., zero address) are added to local scope table.
    */
-  if (application_has_local_scope (app) && session_endpoint_is_local (sep))
+  if (application_has_local_scope (app)
+      && session_endpoint_is_local (&a->sep))
     {
-      if ((rv = application_start_local_listen (app, sep, handle)))
+      if ((rv =
+	   application_start_local_listen (app_wrk, &a->sep, &a->handle)))
 	return rv;
-      ll_handle = *handle;
+      ll_handle = a->handle;
     }
 
   if (!application_has_global_scope (app))
@@ -191,9 +195,9 @@
    */
 
   /* Setup listen path down to transport */
-  rv = application_start_listen (app, sep, handle);
+  rv = app_worker_start_listen (app_wrk, &a->sep, &a->handle);
   if (rv && ll_handle != SESSION_INVALID_HANDLE)
-    session_lookup_del_session_endpoint (table_index, sep);
+    session_lookup_del_session_endpoint (table_index, &a->sep);
 
   /*
    * Store in local table listener the index of the transport layer
@@ -205,7 +209,7 @@
       local_session_t *ll;
       stream_session_t *tl;
       ll = application_get_local_listener_w_handle (ll_handle);
-      tl = listen_session_get_from_handle (*handle);
+      tl = listen_session_get_from_handle (a->handle);
       ll->transport_listener_index = tl->session_index;
     }
   return rv;
@@ -219,13 +223,13 @@
 
   if (!(app = application_get_if_valid (app_index)))
     {
-      SESSION_DBG ("app (%d) not attached", app_index);
+      SESSION_DBG ("app (%d) not attached", wrk_map_index);
       return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
     }
 
   if (application_has_local_scope (app))
     {
-      if ((rv = application_stop_local_listen (app, handle)))
+      if ((rv = application_stop_local_listen (handle, app_index)))
 	return rv;
     }
 
@@ -233,25 +237,27 @@
    * Clear the global scope table of the listener
    */
   if (application_has_global_scope (app))
-    return application_stop_listen (app, handle);
+    return app_worker_stop_listen (handle, app_index);
   return 0;
 }
 
-int
-application_connect (u32 client_index, u32 api_context,
-		     session_endpoint_t * sep)
+static int
+application_connect (vnet_connect_args_t * a)
 {
-  application_t *server, *client;
+  app_worker_t *server_wrk, *client_wrk;
   u32 table_index, server_index, li;
   stream_session_t *listener;
+  application_t *client;
   local_session_t *ll;
+  u8 fib_proto;
   u64 lh;
 
-  if (session_endpoint_is_zero (sep))
+  if (session_endpoint_is_zero (&a->sep))
     return VNET_API_ERROR_INVALID_VALUE;
 
-  client = application_get (client_index);
-  session_endpoint_update_for_app (sep, client);
+  client = application_get (a->app_index);
+  session_endpoint_update_for_app (&a->sep, client);
+  client_wrk = application_get_worker (client, a->wrk_map_index);
 
   /*
    * First check the local scope for locally attached destinations.
@@ -261,7 +267,7 @@
   if (application_has_local_scope (client))
     {
       table_index = application_local_session_table (client);
-      lh = session_lookup_local_endpoint (table_index, sep);
+      lh = session_lookup_local_endpoint (table_index, &a->sep);
       if (lh == SESSION_DROP_HANDLE)
 	return VNET_API_ERROR_APP_CONNECT_FILTERED;
 
@@ -275,12 +281,13 @@
        * can happen if client is a generic proxy. Route connect through
        * global table instead.
        */
-      if (server_index != client_index)
+      if (server_index != a->app_index)
 	{
-	  server = application_get (server_index);
-	  ll = application_get_local_listen_session (server, li);
-	  return application_local_session_connect (table_index, client,
-						    server, ll, api_context);
+	  server_wrk = app_worker_get (server_index);
+	  ll = application_get_local_listen_session (server_wrk, li);
+	  return application_local_session_connect (client_wrk,
+						    server_wrk, ll,
+						    a->api_context);
 	}
     }
 
@@ -290,28 +297,30 @@
    */
 
 global_scope:
-  if (session_endpoint_is_local (sep))
+  if (session_endpoint_is_local (&a->sep))
     return VNET_API_ERROR_SESSION_CONNECT;
 
   if (!application_has_global_scope (client))
     return VNET_API_ERROR_APP_CONNECT_SCOPE;
 
-  table_index = application_session_table (client,
-					   session_endpoint_fib_proto (sep));
-  listener = session_lookup_listener (table_index, sep);
+  fib_proto = session_endpoint_fib_proto (&a->sep);
+  table_index = application_session_table (client, fib_proto);
+  listener = session_lookup_listener (table_index, &a->sep);
   if (listener)
     {
-      server = application_get (listener->app_index);
-      if (server)
-	return application_local_session_connect (table_index, client, server,
-						  (local_session_t *)
-						  listener, api_context);
+      server_wrk = app_worker_get (listener->app_wrk_index);
+      if (server_wrk)
+	{
+	  ll = (local_session_t *) listener;
+	  return application_local_session_connect (client_wrk, server_wrk,
+						    ll, a->api_context);
+	}
     }
 
   /*
    * Not connecting to a local server, propagate to transport
    */
-  if (application_open_session (client, sep, api_context))
+  if (app_worker_open_session (client_wrk, &a->sep, a->api_context))
     return VNET_API_ERROR_SESSION_CONNECT;
   return 0;
 }
@@ -415,7 +424,7 @@
 }
 
 static int
-session_validate_namespace (u8 * namespace_id, u64 secret, u32 * app_ns_index)
+app_validate_namespace (u8 * namespace_id, u64 secret, u32 * app_ns_index)
 {
   app_namespace_t *app_ns;
   if (vec_len (namespace_id) == 0)
@@ -448,6 +457,7 @@
 {
   svm_fifo_segment_private_t *fs;
   application_t *app = 0;
+  app_worker_t *app_wrk;
   segment_manager_t *sm;
   u32 app_ns_index = 0;
   u64 secret;
@@ -466,17 +476,19 @@
 				   "app already attached");
 
   secret = a->options[APP_OPTIONS_NAMESPACE_SECRET];
-  if ((rv = session_validate_namespace (a->namespace_id, secret,
-					&app_ns_index)))
+  if ((rv = app_validate_namespace (a->namespace_id, secret, &app_ns_index)))
     return clib_error_return_code (0, rv, 0, "namespace validation: %d", rv);
   a->options[APP_OPTIONS_NAMESPACE] = app_ns_index;
-  app = application_new ();
-  if ((rv = application_init (app, a->api_client_index, a->name, a->options,
-			      a->session_cb_vft)))
+
+  if ((rv = application_alloc_and_init ((app_init_args_t *) a)))
     return clib_error_return_code (0, rv, 0, "app init: %d", rv);
 
-  a->app_evt_q = app->event_queue;
-  sm = segment_manager_get (app->first_segment_manager);
+  app = application_get (a->app_index);
+  if ((rv = app_worker_alloc_and_init (app, &app_wrk)))
+    return clib_error_return_code (0, rv, 0, "app default wrk init: %d", rv);
+
+  a->app_evt_q = app_wrk->event_queue;
+  sm = segment_manager_get (app_wrk->first_segment_manager);
   fs = segment_manager_get_segment_w_lock (sm, 0);
 
   if (application_is_proxy (app))
@@ -484,7 +496,6 @@
 
   ASSERT (vec_len (fs->ssvm.name) <= 128);
   a->segment = &fs->ssvm;
-  a->app_index = app->index;
 
   segment_manager_segment_reader_unlock (sm);
 
@@ -506,7 +517,7 @@
       return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
     }
 
-  application_del (app);
+  application_free (app);
   return 0;
 }
 
@@ -519,8 +530,8 @@
   rv = parse_uri (a->uri, &sep);
   if (rv)
     return rv;
-
-  return vnet_bind_i (a->app_index, (session_endpoint_t *) & sep, &a->handle);
+  clib_memcpy (&a->sep, &sep, sizeof (sep));
+  return vnet_bind_i (a);
 }
 
 int
@@ -557,8 +568,8 @@
   if (rv)
     return clib_error_return_code (0, rv, 0, "app init: %d", rv);
 
-  if ((rv = application_connect (a->app_index, a->api_context,
-				 (session_endpoint_t *) & sep)))
+  clib_memcpy (&a->sep, &sep, sizeof (sep));
+  if ((rv = application_connect (a)))
     return clib_error_return_code (0, rv, 0, "connect failed");
   return 0;
 }
@@ -581,7 +592,8 @@
       if (!(ls = application_get_local_session_from_handle (a->handle)))
 	return 0;
 
-      if (ls->app_index != a->app_index && ls->client_index != a->app_index)
+      if (ls->app_wrk_index != a->app_index
+	  && ls->client_wrk_index != a->app_index)
 	{
 	  clib_warning ("app %u is neither client nor server for session %u",
 			a->app_index, a->app_index);
@@ -593,7 +605,7 @@
     {
       stream_session_t *s;
       s = session_get_from_handle_if_valid (a->handle);
-      if (!s || s->app_index != a->app_index)
+      if (!s || s->app_wrk_index != a->app_index)
 	return VNET_API_ERROR_INVALID_VALUE;
 
       /* We're peeking into another's thread pool. Make sure */
@@ -608,7 +620,7 @@
 vnet_bind (vnet_bind_args_t * a)
 {
   int rv;
-  if ((rv = vnet_bind_i (a->app_index, &a->sep, &a->handle)))
+  if ((rv = vnet_bind_i (a)))
     return clib_error_return_code (0, rv, 0, "bind failed: %d", rv);
   return 0;
 }
@@ -625,10 +637,9 @@
 clib_error_t *
 vnet_connect (vnet_connect_args_t * a)
 {
-  session_endpoint_t *sep = (session_endpoint_t *) & a->sep;
   int rv;
 
-  if ((rv = application_connect (a->app_index, a->api_context, sep)))
+  if ((rv = application_connect (a)))
     return clib_error_return_code (0, rv, 0, "connect failed: %d", rv);
   return 0;
 }
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index ba6d266..13ec73a 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -23,27 +23,11 @@
 
 typedef struct _vnet_app_attach_args_t
 {
-  /** Binary API client index */
-  u32 api_client_index;
-
-  /** Application name. Used by builtin apps */
-  u8 *name;
-
-  /** Application and segment manager options */
-  u64 *options;
-
-  /** ID of the namespace the app has access to */
-  u8 *namespace_id;
-
-  /** Session to application callback functions */
-  session_cb_vft_t *session_cb_vft;
-
-  /*
-   * Results
-   */
-  ssvm_private_t *segment;
+#define _(_type, _name) _type _name;
+  foreach_app_init_args
+#undef _
+  ssvm_private_t * segment;
   svm_msg_q_t *app_evt_q;
-  u32 app_index;
 } vnet_app_attach_args_t;
 
 typedef struct _vnet_app_detach_args_t
@@ -55,11 +39,13 @@
 {
   union
   {
-    char *uri;
+    session_endpoint_extended_t sep_ext;
     session_endpoint_t sep;
+    char *uri;
   };
 
   u32 app_index;
+  u32 wrk_map_index;
 
   /*
    * Results
@@ -75,19 +61,22 @@
   union
   {
     char *uri;
-    u64 handle;
+    u64 handle;			/**< Session handle */
   };
-  u32 app_index;
+  u32 app_index;		/**< Owning application index */
+  u32 app_wrk_index;		/**< App's local pool worker index */
 } vnet_unbind_args_t;
 
 typedef struct _vnet_connect_args
 {
   union
   {
+    session_endpoint_extended_t sep_ext;
+    session_endpoint_t sep;
     char *uri;
-    session_endpoint_extended_t sep;
   };
   u32 app_index;
+  u32 wrk_map_index;
   u32 api_context;
 
   session_handle_t session_handle;
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index 6f149ad..158a8e8 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -34,7 +34,7 @@
 segment_manager_properties_t *
 segment_manager_properties_get (segment_manager_t * sm)
 {
-  return application_get_segment_manager_properties (sm->app_index);
+  return application_get_segment_manager_properties (sm->app_wrk_index);
 }
 
 segment_manager_properties_t *
@@ -50,13 +50,13 @@
 static u8
 segment_manager_app_detached (segment_manager_t * sm)
 {
-  return (sm->app_index == SEGMENT_MANAGER_INVALID_APP_INDEX);
+  return (sm->app_wrk_index == SEGMENT_MANAGER_INVALID_APP_INDEX);
 }
 
 void
 segment_manager_app_detach (segment_manager_t * sm)
 {
-  sm->app_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
+  sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
 }
 
 always_inline u32
@@ -369,7 +369,7 @@
 	if (fifo->master_thread_index == 255)
 	  {
 	    svm_fifo_t *next = fifo->next;
-	    application_local_session_disconnect_w_index (sm->app_index,
+	    application_local_session_disconnect_w_index (sm->app_wrk_index,
 	                                                  fifo->master_session_index);
 	    fifo = next;
 	    continue;
@@ -518,8 +518,8 @@
       *fifo_segment_index = segment_manager_segment_index (sm, fifo_segment);
 
       if (added_a_segment)
-	rv = application_add_segment_notify (sm->app_index,
-					     &fifo_segment->ssvm);
+	rv = app_worker_add_segment_notify (sm->app_wrk_index,
+					    &fifo_segment->ssvm);
       /* Drop the lock after app is notified */
       segment_manager_segment_reader_unlock (sm);
       return rv;
@@ -721,8 +721,8 @@
 
       /* *INDENT-OFF* */
       pool_foreach (sm, smm->segment_managers, ({
-	vlib_cli_output (vm, "%-10d%=15d%=12d", segment_manager_index(sm),
-			   sm->app_index, pool_elts (sm->segments));
+	vlib_cli_output (vm, "%-10d%=15d%=12d", segment_manager_index (sm),
+			   sm->app_wrk_index, pool_elts (sm->segments));
       }));
       /* *INDENT-ON* */
 
diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h
index aae4f2e..0e5f624 100644
--- a/src/vnet/session/segment_manager.h
+++ b/src/vnet/session/segment_manager.h
@@ -24,22 +24,17 @@
 
 typedef struct _segment_manager_properties
 {
-  /** Session fifo sizes.  */
-  u32 rx_fifo_size;
-  u32 tx_fifo_size;
-  u32 evt_q_size;
-
-  /** Configured additional segment size */
-  u32 add_segment_size;
-
-  /** Flags */
-  u8 add_segment:1;		/**< can add new segments */
-  u8 use_mq_eventfd:1;		/**< use eventfds for mqs */
-  u8 reserved:6;
-
-  /** Segment type: if set to SSVM_N_TYPES, private segments are used */
-  ssvm_segment_type_t segment_type;
-
+  u32 rx_fifo_size;			/**< receive fifo size */
+  u32 tx_fifo_size;			/**< transmit fifo size */
+  u32 evt_q_size;			/**< event queue length */
+  u32 segment_size;			/**< first segment size */
+  u32 prealloc_fifos;			/**< preallocated fifo pairs */
+  u32 add_segment_size;			/**< additional segment size */
+  u8 add_segment:1;			/**< can add new segments flag */
+  u8 use_mq_eventfd:1;			/**< use eventfds for mqs flag */
+  u8 reserved:6;			/**< reserved flags */
+  ssvm_segment_type_t segment_type;	/**< seg type: if set to SSVM_N_TYPES,
+					     private segments are used */
 } segment_manager_properties_t;
 
 typedef struct _segment_manager
@@ -50,8 +45,8 @@
   /** rwlock that protects the segments pool */
   clib_rwlock_t segments_rwlock;
 
-  /** Owner app index */
-  u32 app_index;
+  /** Owner app worker index */
+  u32 app_wrk_index;
 
   /**
    * First segment should not be deleted unless segment manger is deleted.
diff --git a/src/vnet/session/session.api b/src/vnet/session/session.api
index c60e99e..5a38340 100644
--- a/src/vnet/session/session.api
+++ b/src/vnet/session/session.api
@@ -13,7 +13,7 @@
  * limitations under the License.
  */
 
-option version = "1.1.0";
+option version = "1.2.0";
 
 /** \brief client->vpp, attach application to session layer
     @param client_index - opaque cookie to identify the sender
@@ -271,6 +271,7 @@
 /** \brief Bind to an ip:port pair for a given transport protocol
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
+    @param wrk_index - index of worker requesting the bind
     @param vrf - bind namespace
     @param is_ip4 - flag that is 1 if ip address family is IPv4
     @param ip - ip address
@@ -281,6 +282,7 @@
 define bind_sock {
   u32 client_index;
   u32 context;
+  u32 wrk_index;
   u32 vrf;
   u8 is_ip4;
   u8 ip[16];
@@ -303,6 +305,7 @@
 /** \brief Connect to a remote peer
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
+    @param wrk_index - worker that requests the connect
     @param client_queue_address - client's API queue address. Non-zero when 
                                   used to perform redirects
     @param options - socket options, fifo sizes, etc. when doing redirects
@@ -318,6 +321,7 @@
 autoreply define connect_sock {
   u32 client_index;
   u32 context;
+  u32 wrk_index;
   u64 client_queue_address;
   u64 options[16];
   u32 vrf;
@@ -418,6 +422,47 @@
   u8 fd_flags;
 };
 
+/** \brief add/del application worker
+    @param client_index - opaque cookie to identify the sender
+                          client to vpp direction only
+    @param context - sender context, to match reply w/ request
+    @param app_api_index - explicit client api index
+    @param wrk_index - worker index, if a delete
+    @param is_add - set if an add
+*/
+define app_worker_add_del
+{
+  u32 client_index;
+  u32 context;
+  u32 app_api_index;
+  u32 wrk_index;
+  u8 is_add;
+};
+
+/** \brief Reply for app worker add/del
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+    @param wrk_index - worker index, if add
+    @param app_event_queue_address - vpp event queue address of new worker
+    @param n_fds - number of fds exchanged
+    @param fd_flags - set of flags that indicate which fds are to be expected
+    				  over the socket (set only if socket transport available) 
+    @param segment_name_length - length of segment name 
+    @param segment_name - name of segment client needs to attach to
+*/
+define app_worker_add_del_reply
+{
+  u32 context;
+  i32 retval;
+  u32 wrk_index;
+  u64 app_event_queue_address;
+  u8 n_fds;
+  u8 fd_flags;
+  u8 segment_name_length;
+  u8 segment_name[128];
+  u8 is_add;
+};
+
 /** \brief enable/disable session layer
     @param client_index - opaque cookie to identify the sender
                           client to vpp direction only
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 9790ec2..57ac384 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -488,12 +488,12 @@
 static inline int
 session_enqueue_notify (stream_session_t * s, u8 lock)
 {
-  application_t *app;
+  app_worker_t *app;
 
-  app = application_get_if_valid (s->app_index);
+  app = app_worker_get_if_valid (s->app_wrk_index);
   if (PREDICT_FALSE (!app))
     {
-      TCP_DBG ("invalid s->app_index = %d", s->app_index);
+      SESSION_DBG ("invalid s->app_index = %d", s->app_wrk_index);
       return 0;
     }
 
@@ -513,9 +513,9 @@
 int
 session_dequeue_notify (stream_session_t * s)
 {
-  application_t *app;
+  app_worker_t *app;
 
-  app = application_get_if_valid (s->app_index);
+  app = app_worker_get_if_valid (s->app_wrk_index);
   if (PREDICT_FALSE (!app))
     return -1;
 
@@ -596,6 +596,7 @@
   u32 opaque = 0, new_ti, new_si;
   stream_session_t *new_s = 0;
   segment_manager_t *sm;
+  app_worker_t *app_wrk;
   application_t *app;
   u8 alloc_fifos;
   int error = 0;
@@ -615,17 +616,18 @@
   /* Get the app's index from the handle we stored when opening connection
    * and the opaque (api_context for external apps) from transport session
    * index */
-  app = application_get_if_valid (handle >> 32);
-  if (!app)
+  app_wrk = app_worker_get_if_valid (handle >> 32);
+  if (!app_wrk)
     return -1;
   opaque = tc->s_index;
+  app = application_get (app_wrk->app_index);
 
   /*
    * Allocate new session with fifos (svm segments are allocated if needed)
    */
   if (!is_fail)
     {
-      sm = application_get_connect_segment_manager (app);
+      sm = app_worker_get_connect_segment_manager (app_wrk);
       alloc_fifos = !application_is_builtin_proxy (app);
       if (session_alloc_and_init (sm, tc, alloc_fifos, &new_s))
 	{
@@ -634,7 +636,7 @@
 	}
       else
 	{
-	  new_s->app_index = app->index;
+	  new_s->app_wrk_index = app_wrk->wrk_index;
 	  new_si = new_s->session_index;
 	  new_ti = new_s->thread_index;
 	}
@@ -643,8 +645,8 @@
   /*
    * Notify client application
    */
-  if (app->cb_fns.session_connected_callback (app->index, opaque, new_s,
-					      is_fail))
+  if (app->cb_fns.session_connected_callback (app_wrk->wrk_index, opaque,
+					      new_s, is_fail))
     {
       SESSION_DBG ("failed to notify app");
       if (!is_fail)
@@ -731,12 +733,16 @@
 void
 stream_session_accept_notify (transport_connection_t * tc)
 {
-  application_t *server;
+  app_worker_t *app_wrk;
+  application_t *app;
   stream_session_t *s;
 
   s = session_get (tc->s_index, tc->thread_index);
-  server = application_get (s->app_index);
-  server->cb_fns.session_accept_callback (s);
+  app_wrk = app_worker_get_if_valid (s->app_wrk_index);
+  if (!app_wrk)
+    return;
+  app = application_get (app_wrk->app_index);
+  app->cb_fns.session_accept_callback (s);
 }
 
 /**
@@ -749,14 +755,17 @@
 void
 stream_session_disconnect_notify (transport_connection_t * tc)
 {
-  application_t *server;
+  app_worker_t *app_wrk;
+  application_t *app;
   stream_session_t *s;
 
   s = session_get (tc->s_index, tc->thread_index);
   s->session_state = SESSION_STATE_CLOSING;
-  server = application_get_if_valid (s->app_index);
-  if (server)
-    server->cb_fns.session_disconnect_callback (s);
+  app_wrk = app_worker_get_if_valid (s->app_wrk_index);
+  if (!app_wrk)
+    return;
+  app = application_get (app_wrk->app_index);
+  app->cb_fns.session_disconnect_callback (s);
 }
 
 /**
@@ -806,10 +815,12 @@
 stream_session_reset_notify (transport_connection_t * tc)
 {
   stream_session_t *s;
+  app_worker_t *app_wrk;
   application_t *app;
   s = session_get (tc->s_index, tc->thread_index);
   s->session_state = SESSION_STATE_CLOSED;
-  app = application_get (s->app_index);
+  app_wrk = app_worker_get (s->app_wrk_index);
+  app = application_get (app_wrk->app_index);
   app->cb_fns.session_reset_callback (s);
 }
 
@@ -820,38 +831,40 @@
 stream_session_accept (transport_connection_t * tc, u32 listener_index,
 		       u8 notify)
 {
-  application_t *server;
   stream_session_t *s, *listener;
+  app_worker_t *app_wrk;
   segment_manager_t *sm;
   int rv;
 
   /* Find the server */
   listener = listen_session_get (listener_index);
-  server = application_get (listener->app_index);
+  app_wrk = app_worker_get (listener->app_wrk_index);
 
-  sm = application_get_listen_segment_manager (server, listener);
+  sm = app_worker_get_listen_segment_manager (app_wrk, listener);
   if ((rv = session_alloc_and_init (sm, tc, 1, &s)))
     return rv;
 
-  s->app_index = server->index;
+  s->app_wrk_index = app_wrk->wrk_index;
   s->listener_index = listener_index;
   s->session_state = SESSION_STATE_ACCEPTING;
 
   /* Shoulder-tap the server */
   if (notify)
     {
-      server->cb_fns.session_accept_callback (s);
+      application_t *app = application_get (app_wrk->app_index);
+      app->cb_fns.session_accept_callback (s);
     }
 
   return 0;
 }
 
 int
-session_open_cl (u32 app_index, session_endpoint_t * rmt, u32 opaque)
+session_open_cl (u32 app_wrk_index, session_endpoint_t * rmt, u32 opaque)
 {
   transport_connection_t *tc;
   transport_endpoint_t *tep;
   segment_manager_t *sm;
+  app_worker_t *app_wrk;
   stream_session_t *s;
   application_t *app;
   int rv;
@@ -868,22 +881,23 @@
 
   /* For dgram type of service, allocate session and fifos now.
    */
-  app = application_get (app_index);
-  sm = application_get_connect_segment_manager (app);
+  app_wrk = app_worker_get (app_wrk_index);
+  sm = app_worker_get_connect_segment_manager (app_wrk);
 
   if (session_alloc_and_init (sm, tc, 1, &s))
     return -1;
-  s->app_index = app->index;
+  s->app_wrk_index = app_wrk->wrk_index;
   s->session_state = SESSION_STATE_OPENED;
 
   /* Tell the app about the new event fifo for this session */
-  app->cb_fns.session_connected_callback (app->index, opaque, s, 0);
+  app = application_get (app_wrk->app_index);
+  app->cb_fns.session_connected_callback (app_wrk->wrk_index, opaque, s, 0);
 
   return 0;
 }
 
 int
-session_open_vc (u32 app_index, session_endpoint_t * rmt, u32 opaque)
+session_open_vc (u32 app_wrk_index, session_endpoint_t * rmt, u32 opaque)
 {
   transport_connection_t *tc;
   transport_endpoint_t *tep;
@@ -907,7 +921,7 @@
    * is needed when the connect notify comes and we have to notify the
    * external app
    */
-  handle = (((u64) app_index) << 32) | (u64) tc->c_index;
+  handle = (((u64) app_wrk_index) << 32) | (u64) tc->c_index;
   session_lookup_add_half_open (tc, handle);
 
   /* Store api_context (opaque) for when the reply comes. Not the nicest
@@ -918,10 +932,10 @@
 }
 
 int
-session_open_app (u32 app_index, session_endpoint_t * rmt, u32 opaque)
+session_open_app (u32 app_wrk_index, session_endpoint_t * rmt, u32 opaque)
 {
   session_endpoint_extended_t *sep = (session_endpoint_extended_t *) rmt;
-  sep->app_index = app_index;
+  sep->app_wrk_index = app_wrk_index;
   sep->opaque = opaque;
 
   return tp_vfts[rmt->transport_proto].open ((transport_endpoint_t *) sep);
@@ -951,10 +965,10 @@
  * 		 on open completion.
  */
 int
-session_open (u32 app_index, session_endpoint_t * rmt, u32 opaque)
+session_open (u32 app_wrk_index, session_endpoint_t * rmt, u32 opaque)
 {
   transport_service_type_t tst = tp_vfts[rmt->transport_proto].service_type;
-  return session_open_srv_fns[tst] (app_index, rmt, opaque);
+  return session_open_srv_fns[tst] (app_wrk_index, rmt, opaque);
 }
 
 int
@@ -988,7 +1002,7 @@
 session_listen_cl (stream_session_t * s, session_endpoint_t * sep)
 {
   transport_connection_t *tc;
-  application_t *server;
+  app_worker_t *server;
   segment_manager_t *sm;
   u32 tci;
 
@@ -1008,8 +1022,8 @@
   if (tc == 0)
     return -1;
 
-  server = application_get (s->app_index);
-  sm = application_get_listen_segment_manager (server, s);
+  server = app_worker_get (s->app_wrk_index);
+  sm = app_worker_get_listen_segment_manager (server, s);
   if (session_alloc_fifos (sm, s))
     return -1;
 
@@ -1023,7 +1037,7 @@
 {
   session_endpoint_extended_t esep;
   clib_memcpy (&esep, sep, sizeof (*sep));
-  esep.app_index = s->app_index;
+  esep.app_wrk_index = s->app_wrk_index;
 
   return tp_vfts[sep->transport_proto].bind (s->session_index,
 					     (transport_endpoint_t *) & esep);
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index dddc1f5..d573261 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -58,6 +58,7 @@
 _(SESSION_RULES_DUMP, session_rules_dump)				\
 _(APPLICATION_TLS_CERT_ADD, application_tls_cert_add)			\
 _(APPLICATION_TLS_KEY_ADD, application_tls_key_add)			\
+_(APP_WORKER_ADD_DEL, app_worker_add_del)				\
 
 static int
 session_send_fds (vl_api_registration_t * reg, int fds[], int n_fds)
@@ -137,7 +138,8 @@
   mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
   memset (mp, 0, sizeof (*mp));
   mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_UNMAP_SEGMENT);
-  strcpy ((char *) mp->segment_name, (char *) fs->name);
+  strncpy ((char *) mp->segment_name, (char *) fs->name,
+	   sizeof (mp->segment_name) - 1);
 
   vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
 
@@ -193,14 +195,16 @@
 static int
 send_session_accept_callback (stream_session_t * s)
 {
-  application_t *server = application_get (s->app_index);
+  app_worker_t *server_wrk = app_worker_get (s->app_wrk_index);
   transport_proto_vft_t *tp_vft;
   vl_api_accept_session_t *mp;
   vl_api_registration_t *reg;
   transport_connection_t *tc;
   stream_session_t *listener;
   svm_msg_q_t *vpp_queue;
+  application_t *server;
 
+  server = application_get (server_wrk->app_index);
   reg = vl_mem_api_client_index_to_registration (server->api_client_index);
   if (!reg)
     {
@@ -212,7 +216,7 @@
   memset (mp, 0, sizeof (*mp));
 
   mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_ACCEPT_SESSION);
-  mp->context = server->index;
+  mp->context = server_wrk->wrk_index;
   mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
   mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
 
@@ -223,8 +227,8 @@
       if (application_is_proxy (server))
 	{
 	  listener =
-	    application_first_listener (server, session_get_fib_proto (s),
-					session_get_transport_proto (s));
+	    app_worker_first_listener (server_wrk, session_get_fib_proto (s),
+				       session_get_transport_proto (s));
 	  if (listener)
 	    mp->listener_handle = listen_session_get_handle (listener);
 	}
@@ -249,7 +253,7 @@
 	}
       else
 	{
-	  ll = application_get_local_listen_session (server,
+	  ll = application_get_local_listen_session (server_wrk,
 						     ls->listener_index);
 	  if (ll->transport_listener_index != ~0)
 	    {
@@ -273,15 +277,18 @@
 }
 
 void
-mq_send_local_session_disconnected_cb (u32 app_index, local_session_t * ls)
+mq_send_local_session_disconnected_cb (u32 app_wrk_index,
+				       local_session_t * ls)
 {
-  application_t *app = application_get (app_index);
+  app_worker_t *app_wrk = app_worker_get (app_wrk_index);
   svm_msg_q_msg_t _msg, *msg = &_msg;
   session_disconnected_msg_t *mp;
   svm_msg_q_t *app_mq;
   session_event_t *evt;
+  application_t *app;
 
-  app_mq = app->event_queue;
+  app = application_get (app_wrk->app_index);
+  app_mq = app_wrk->event_queue;
   svm_msg_q_lock_and_alloc_msg_w_ring (app_mq, SESSION_MQ_CTRL_EVT_RING,
 				       SVM_Q_WAIT, msg);
   svm_msg_q_unlock (app_mq);
@@ -297,10 +304,12 @@
 static void
 send_session_disconnect_callback (stream_session_t * s)
 {
-  application_t *app = application_get (s->app_index);
+  app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
   vl_api_disconnect_session_t *mp;
   vl_api_registration_t *reg;
+  application_t *app;
 
+  app = application_get (app_wrk->app_index);
   reg = vl_mem_api_client_index_to_registration (app->api_client_index);
   if (!reg)
     {
@@ -319,10 +328,12 @@
 static void
 send_session_reset_callback (stream_session_t * s)
 {
-  application_t *app = application_get (s->app_index);
+  app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
   vl_api_registration_t *reg;
   vl_api_reset_session_t *mp;
+  application_t *app;
 
+  app = application_get (app_wrk->app_index);
   reg = vl_mem_api_client_index_to_registration (app->api_client_index);
   if (!reg)
     {
@@ -338,16 +349,18 @@
 }
 
 int
-send_session_connected_callback (u32 app_index, u32 api_context,
+send_session_connected_callback (u32 app_wrk_index, u32 api_context,
 				 stream_session_t * s, u8 is_fail)
 {
   vl_api_connect_session_reply_t *mp;
   transport_connection_t *tc;
   vl_api_registration_t *reg;
   svm_msg_q_t *vpp_queue;
+  app_worker_t *app_wrk;
   application_t *app;
 
-  app = application_get (app_index);
+  app_wrk = app_worker_get (app_wrk_index);
+  app = application_get (app_wrk->app_index);
   reg = vl_mem_api_client_index_to_registration (app->api_client_index);
   if (!reg)
     {
@@ -410,7 +423,7 @@
 static int
 mq_send_session_accepted_cb (stream_session_t * s)
 {
-  application_t *app = application_get (s->app_index);
+  app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
   svm_msg_q_msg_t _msg, *msg = &_msg;
   svm_msg_q_t *vpp_queue, *app_mq;
   transport_proto_vft_t *tp_vft;
@@ -418,8 +431,10 @@
   stream_session_t *listener;
   session_accepted_msg_t *mp;
   session_event_t *evt;
+  application_t *app;
 
-  app_mq = app->event_queue;
+  app = application_get (app_wrk->app_index);
+  app_mq = app_wrk->event_queue;
   svm_msg_q_lock_and_alloc_msg_w_ring (app_mq, SESSION_MQ_CTRL_EVT_RING,
 				       SVM_Q_WAIT, msg);
   svm_msg_q_unlock (app_mq);
@@ -428,7 +443,7 @@
   memset (evt, 0, sizeof (*evt));
   evt->event_type = SESSION_CTRL_EVT_ACCEPTED;
   mp = (session_accepted_msg_t *) evt->data;
-  mp->context = app->index;
+  mp->context = app_wrk->wrk_index;
   mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
   mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
 
@@ -439,8 +454,8 @@
       if (application_is_proxy (app))
 	{
 	  listener =
-	    application_first_listener (app, session_get_fib_proto (s),
-					session_get_transport_proto (s));
+	    app_worker_first_listener (app_wrk, session_get_fib_proto (s),
+				       session_get_transport_proto (s));
 	  if (listener)
 	    mp->listener_handle = listen_session_get_handle (listener);
 	}
@@ -471,7 +486,9 @@
 	}
       else
 	{
-	  ll = application_get_local_listen_session (app, ls->listener_index);
+	  ll =
+	    application_get_local_listen_session (app_wrk,
+						  ls->listener_index);
 	  if (ll->transport_listener_index != ~0)
 	    {
 	      listener = listen_session_get (ll->transport_listener_index);
@@ -498,13 +515,15 @@
 static void
 mq_send_session_disconnected_cb (stream_session_t * s)
 {
-  application_t *app = application_get (s->app_index);
+  app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
   svm_msg_q_msg_t _msg, *msg = &_msg;
   session_disconnected_msg_t *mp;
   svm_msg_q_t *app_mq;
   session_event_t *evt;
+  application_t *app;
 
-  app_mq = app->event_queue;
+  app = application_get (app_wrk->app_index);
+  app_mq = app_wrk->event_queue;
   svm_msg_q_lock_and_alloc_msg_w_ring (app_mq, SESSION_MQ_CTRL_EVT_RING,
 				       SVM_Q_WAIT, msg);
   svm_msg_q_unlock (app_mq);
@@ -520,7 +539,7 @@
 static void
 mq_send_session_reset_cb (stream_session_t * s)
 {
-  application_t *app = application_get (s->app_index);
+  app_worker_t *app = app_worker_get (s->app_wrk_index);
   svm_msg_q_msg_t _msg, *msg = &_msg;
   session_reset_msg_t *mp;
   svm_msg_q_t *app_mq;
@@ -539,21 +558,23 @@
 }
 
 static int
-mq_send_session_connected_cb (u32 app_index, u32 api_context,
+mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
 			      stream_session_t * s, u8 is_fail)
 {
   svm_msg_q_msg_t _msg, *msg = &_msg;
   session_connected_msg_t *mp;
   svm_msg_q_t *vpp_mq, *app_mq;
   transport_connection_t *tc;
+  app_worker_t *app_wrk;
   session_event_t *evt;
   application_t *app;
 
-  app = application_get (app_index);
-  app_mq = app->event_queue;
+  app_wrk = app_worker_get (app_wrk_index);
+  app = application_get (app_wrk->app_index);
+  app_mq = app_wrk->event_queue;
   if (!app_mq)
     {
-      clib_warning ("app %u with api index: %u not attached", app->index,
+      clib_warning ("app %u with api index: %u not attached", app->app_index,
 		    app->api_client_index);
       return -1;
     }
@@ -753,7 +774,7 @@
   app = application_lookup (mp->client_index);
   if (app)
     {
-      a->app_index = app->index;
+      a->app_index = app->app_index;
       rv = vnet_application_detach (a);
     }
 
@@ -783,7 +804,7 @@
     {
       memset (a, 0, sizeof (*a));
       a->uri = (char *) mp->uri;
-      a->app_index = app->index;
+      a->app_index = app->app_index;
       rv = vnet_bind_uri (a);
     }
   else
@@ -836,7 +857,7 @@
   if (app)
     {
       a->uri = (char *) mp->uri;
-      a->app_index = app->index;
+      a->app_index = app->app_index;
       rv = vnet_unbind_uri (a);
     }
   else
@@ -868,7 +889,7 @@
     {
       a->uri = (char *) mp->uri;
       a->api_context = mp->context;
-      a->app_index = app->index;
+      a->app_index = app->app_index;
       if ((error = vnet_connect_uri (a)))
 	{
 	  rv = clib_error_get_code (error);
@@ -912,7 +933,7 @@
   if (app)
     {
       a->handle = mp->handle;
-      a->app_index = app->index;
+      a->app_index = app->app_index;
       rv = vnet_disconnect_session (a);
     }
   else
@@ -943,7 +964,7 @@
   if (app)
     {
       a->handle = mp->handle;
-      a->app_index = app->index;
+      a->app_index = app->app_index;
       vnet_disconnect_session (a);
     }
 }
@@ -951,6 +972,7 @@
 static void
 vl_api_reset_session_reply_t_handler (vl_api_reset_session_reply_t * mp)
 {
+  app_worker_t *app_wrk;
   application_t *app;
   stream_session_t *s;
   u32 index, thread_index;
@@ -961,12 +983,20 @@
 
   session_parse_handle (mp->handle, &index, &thread_index);
   s = session_get_if_valid (index, thread_index);
-  if (s == 0 || app->index != s->app_index)
+  if (!s)
     {
       clib_warning ("Invalid session!");
       return;
     }
 
+  app_wrk = app_worker_get (s->app_wrk_index);
+  if (app_wrk->app_index != app->app_index)
+    {
+      clib_warning ("app %u does not own handle 0x%lx", app->app_index,
+		    mp->handle);
+      return;
+    }
+
   /* Client objected to resetting the session, log and continue */
   if (mp->retval)
     {
@@ -998,7 +1028,7 @@
   if (session_handle_is_local (mp->handle))
     {
       ls = application_get_local_session_from_handle (mp->handle);
-      if (!ls || ls->app_index != mp->context)
+      if (!ls || ls->app_wrk_index != mp->context)
 	{
 	  clib_warning ("server %u doesn't own local handle %llu",
 			mp->context, mp->handle);
@@ -1016,7 +1046,7 @@
 	  clib_warning ("session doesn't exist");
 	  return;
 	}
-      if (s->app_index != mp->context)
+      if (s->app_wrk_index != mp->context)
 	{
 	  clib_warning ("app doesn't own session");
 	  return;
@@ -1066,7 +1096,8 @@
   a->sep.fib_index = mp->vrf;
   a->sep.sw_if_index = ENDPOINT_INVALID_INDEX;
   a->sep.transport_proto = mp->proto;
-  a->app_index = app->index;
+  a->app_index = app->app_index;
+  a->wrk_map_index = mp->wrk_index;
 
   if ((error = vnet_bind (a)))
     {
@@ -1118,7 +1149,7 @@
   app = application_lookup (mp->client_index);
   if (app)
     {
-      a->app_index = app->index;
+      a->app_index = app->app_index;
       a->handle = mp->handle;
       if ((error = vnet_unbind (a)))
 	{
@@ -1163,17 +1194,18 @@
       a->sep.sw_if_index = ENDPOINT_INVALID_INDEX;
       if (mp->hostname_len)
 	{
-	  vec_validate (a->sep.hostname, mp->hostname_len - 1);
-	  clib_memcpy (a->sep.hostname, mp->hostname, mp->hostname_len);
+	  vec_validate (a->sep_ext.hostname, mp->hostname_len - 1);
+	  clib_memcpy (a->sep_ext.hostname, mp->hostname, mp->hostname_len);
 	}
       a->api_context = mp->context;
-      a->app_index = app->index;
+      a->app_index = app->app_index;
+      a->wrk_map_index = mp->wrk_index;
       if ((error = vnet_connect (a)))
 	{
 	  rv = clib_error_get_code (error);
 	  clib_error_report (error);
 	}
-      vec_free (a->sep.hostname);
+      vec_free (a->sep_ext.hostname);
     }
   else
     {
@@ -1190,6 +1222,84 @@
 }
 
 static void
+vl_api_app_worker_add_del_t_handler (vl_api_app_worker_add_del_t * mp)
+{
+  int rv = 0, fds[SESSION_N_FD_TYPE], n_fds = 0;
+  vl_api_app_worker_add_del_reply_t *rmp;
+  vl_api_registration_t *reg;
+  clib_error_t *error = 0;
+  application_t *app;
+  u8 fd_flags = 0;
+
+  if (!session_manager_is_enabled ())
+    {
+      rv = VNET_API_ERROR_FEATURE_DISABLED;
+      goto done;
+    }
+
+  reg = vl_api_client_index_to_registration (mp->client_index);
+  if (!reg)
+    return;
+
+  app = application_lookup (mp->app_api_index);
+  if (!app)
+    {
+      rv = VNET_API_ERROR_INVALID_VALUE;
+      goto done;
+    }
+
+  vnet_app_worker_add_del_args_t args = {
+    .app_index = app->app_index,
+    .wrk_index = clib_net_to_host_u32 (mp->wrk_index),
+    .is_add = mp->is_add
+  };
+  error = vnet_app_worker_add_del (&args);
+  if (error)
+    {
+      rv = clib_error_get_code (error);
+      clib_error_report (error);
+      goto done;
+    }
+
+  /* Send fifo segment fd if needed */
+  if (ssvm_type (args.segment) == SSVM_SEGMENT_MEMFD)
+    {
+      fd_flags |= SESSION_FD_F_MEMFD_SEGMENT;
+      fds[n_fds] = args.segment->fd;
+      n_fds += 1;
+    }
+  if (application_segment_manager_properties (app)->use_mq_eventfd)
+    {
+      fd_flags |= SESSION_FD_F_MQ_EVENTFD;
+      fds[n_fds] = svm_msg_q_get_producer_eventfd (args.evt_q);
+      n_fds += 1;
+    }
+
+  /* *INDENT-OFF* */
+done:
+  REPLY_MACRO2 (VL_API_APP_WORKER_ADD_DEL_REPLY, ({
+    rmp->is_add = mp->is_add;
+    if (!rv)
+      {
+	rmp->wrk_index = clib_host_to_net_u32 (args.wrk_index);
+	if (vec_len (args.segment->name))
+	  {
+	    memcpy (rmp->segment_name, args.segment->name,
+	            vec_len (args.segment->name));
+	    rmp->segment_name_length = vec_len (args.segment->name);
+	  }
+	rmp->app_event_queue_address = pointer_to_uword (args.evt_q);
+	rmp->n_fds = n_fds;
+	rmp->fd_flags = fd_flags;
+      }
+  }));
+  /* *INDENT-ON* */
+
+  if (n_fds)
+    session_send_fds (reg, fds, n_fds);
+}
+
+static void
 vl_api_app_namespace_add_del_t_handler (vl_api_app_namespace_add_del_t * mp)
 {
   vl_api_app_namespace_add_del_reply_t *rmp;
@@ -1444,7 +1554,7 @@
       goto done;
     }
   memset (a, 0, sizeof (*a));
-  a->app_index = app->index;
+  a->app_index = app->app_index;
   cert_len = clib_net_to_host_u16 (mp->cert_len);
   if (cert_len > 10000)
     {
@@ -1484,7 +1594,7 @@
       goto done;
     }
   memset (a, 0, sizeof (*a));
-  a->app_index = app->index;
+  a->app_index = app->app_index;
   key_len = clib_net_to_host_u16 (mp->key_len);
   if (key_len > 10000)
     {
@@ -1510,7 +1620,7 @@
   vnet_app_detach_args_t _a, *a = &_a;
   if (app)
     {
-      a->app_index = app->index;
+      a->app_index = app->app_index;
       vnet_application_detach (a);
     }
   return 0;
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index 3588bbc..3613352 100755
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -250,7 +250,7 @@
 	if (s->session_state != SESSION_STATE_LISTENING
 	    || s->session_type != sst)
 	  continue;
-	app_name = application_name_from_index (s->app_index);
+	app_name = application_name_from_index (s->app_wrk_index);
 	vlib_cli_output (vm, "%U%-25v%-10u", format_stream_session, s, 1,
 			 app_name, s->session_index);
 	vec_free (app_name);
@@ -314,7 +314,8 @@
 static int
 clear_session (stream_session_t * s)
 {
-  application_t *server = application_get (s->app_index);
+  app_worker_t *server_wrk = app_worker_get (s->app_wrk_index);
+  application_t *server = application_get (server_wrk->app_index);
   server->cb_fns.session_disconnect_callback (s);
   return 0;
 }
diff --git a/src/vnet/session/session_lookup.c b/src/vnet/session/session_lookup.c
index 37fccd9..19aeb0b 100644
--- a/src/vnet/session/session_lookup.c
+++ b/src/vnet/session/session_lookup.c
@@ -380,7 +380,8 @@
   if (!app)
     return 0;
 
-  return application_first_listener (app, fib_proto, transport_proto);
+  return app_worker_first_listener (application_get_default_worker (app),
+				    fib_proto, transport_proto);
 }
 
 static stream_session_t *
@@ -1299,15 +1300,17 @@
 format_ip4_session_lookup_kvp (u8 * s, va_list * args)
 {
   clib_bihash_kv_16_8_t *kvp = va_arg (*args, clib_bihash_kv_16_8_t *);
-  u32 is_local = va_arg (*args, u32), app_index, session_index;
+  u32 is_local = va_arg (*args, u32), app_wrk_index, session_index;
+  v4_connection_key_t *key = (v4_connection_key_t *) kvp->key;
   u8 *app_name, *str = 0;
   stream_session_t *session;
-  v4_connection_key_t *key = (v4_connection_key_t *) kvp->key;
+  app_worker_t *app_wrk;
 
   if (!is_local)
     {
       session = session_get_from_handle (kvp->value);
-      app_name = application_name_from_index (session->app_index);
+      app_wrk = app_worker_get (session->app_wrk_index);
+      app_name = application_name_from_index (app_wrk->app_index);
       str = format (0, "[%U] %U:%d->%U:%d", format_transport_proto_short,
 		    key->proto, format_ip4_address, &key->src,
 		    clib_net_to_host_u16 (key->src_port), format_ip4_address,
@@ -1316,8 +1319,9 @@
     }
   else
     {
-      local_session_parse_handle (kvp->value, &app_index, &session_index);
-      app_name = application_name_from_index (app_index);
+      local_session_parse_handle (kvp->value, &app_wrk_index, &session_index);
+      app_wrk = app_worker_get (app_wrk_index);
+      app_name = application_name_from_index (app_wrk->app_index);
       str = format (0, "[%U] %U:%d", format_transport_proto_short, key->proto,
 		    format_ip4_address, &key->src,
 		    clib_net_to_host_u16 (key->src_port));
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 30cd5ae..1656e2e 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -44,7 +44,7 @@
   if (session_handle_is_local (mp->handle))
     {
       ls = application_get_local_session_from_handle (mp->handle);
-      if (!ls || ls->app_index != mp->context)
+      if (!ls || ls->app_wrk_index != mp->context)
 	{
 	  clib_warning ("server %u doesn't own local handle %llu",
 			mp->context, mp->handle);
@@ -62,7 +62,7 @@
 	  clib_warning ("session doesn't exist");
 	  return;
 	}
-      if (s->app_index != mp->context)
+      if (s->app_wrk_index != mp->context)
 	{
 	  clib_warning ("app doesn't own session");
 	  return;
@@ -70,8 +70,8 @@
       s->session_state = SESSION_STATE_READY;
       if (!svm_fifo_is_empty (s->server_rx_fifo))
 	{
-	  application_t *app;
-	  app = application_get (s->app_index);
+	  app_worker_t *app;
+	  app = app_worker_get (s->app_wrk_index);
 	  application_send_event (app, s, FIFO_EVENT_APP_RX);
 	}
     }
@@ -81,8 +81,9 @@
 session_mq_reset_reply_handler (void *data)
 {
   session_reset_reply_msg_t *mp;
-  application_t *app;
+  app_worker_t *app_wrk;
   stream_session_t *s;
+  application_t *app;
   u32 index, thread_index;
 
   mp = (session_reset_reply_msg_t *) data;
@@ -92,11 +93,18 @@
 
   session_parse_handle (mp->handle, &index, &thread_index);
   s = session_get_if_valid (index, thread_index);
-  if (s == 0 || app->index != s->app_index)
+  if (!s)
     {
       clib_warning ("Invalid session!");
       return;
     }
+  app_wrk = app_worker_get (s->app_wrk_index);
+  if (!app_wrk || app_wrk->app_index != app->app_index)
+    {
+      clib_warning ("App % does not own handle 0x%lx!", app->app_index,
+		    mp->handle);
+      return;
+    }
 
   /* Client objected to resetting the session, log and continue */
   if (mp->retval)
@@ -117,37 +125,39 @@
   vnet_disconnect_args_t _a, *a = &_a;
   svm_msg_q_msg_t _msg, *msg = &_msg;
   session_disconnected_msg_t *mp;
+  app_worker_t *app_wrk;
   session_event_t *evt;
   stream_session_t *s;
   application_t *app;
   int rv = 0;
 
   mp = (session_disconnected_msg_t *) data;
-  app = application_lookup (mp->client_index);
   s = session_get_from_handle_if_valid (mp->handle);
-  if (!(app && s && s->app_index == app->index))
+  app_wrk = app_worker_get (s->app_wrk_index);
+  app = application_lookup (mp->client_index);
+  if (!(app_wrk && s && app->app_index == app_wrk->app_index))
     {
-      clib_warning ("could not disconnect session: %llu app: %u", mp->handle,
-		    mp->client_index);
+      clib_warning ("could not disconnect session: %llu app_wrk: %u",
+		    mp->handle, mp->client_index);
       return;
     }
 
   a->handle = mp->handle;
-  a->app_index = app->index;
+  a->app_index = app_wrk->wrk_index;
   rv = vnet_disconnect_session (a);
 
-  svm_msg_q_lock_and_alloc_msg_w_ring (app->event_queue,
+  svm_msg_q_lock_and_alloc_msg_w_ring (app_wrk->event_queue,
 				       SESSION_MQ_CTRL_EVT_RING,
 				       SVM_Q_WAIT, msg);
-  svm_msg_q_unlock (app->event_queue);
-  evt = svm_msg_q_msg_data (app->event_queue, msg);
+  svm_msg_q_unlock (app_wrk->event_queue);
+  evt = svm_msg_q_msg_data (app_wrk->event_queue, msg);
   memset (evt, 0, sizeof (*evt));
   evt->event_type = SESSION_CTRL_EVT_DISCONNECTED;
   rmp = (session_disconnected_reply_msg_t *) evt->data;
   rmp->handle = mp->handle;
   rmp->context = mp->context;
   rmp->retval = rv;
-  svm_msg_q_add (app->event_queue, msg, SVM_Q_WAIT);
+  svm_msg_q_add (app_wrk->event_queue, msg, SVM_Q_WAIT);
 }
 
 static void
@@ -171,7 +181,7 @@
   if (app)
     {
       a->handle = mp->handle;
-      a->app_index = app->index;
+      a->app_index = app->app_index;
       vnet_disconnect_session (a);
     }
 }
@@ -731,6 +741,7 @@
   svm_msg_q_msg_t _msg, *msg = &_msg;
   f64 now = vlib_time_now (vm);
   int n_tx_packets = 0, i, rv;
+  app_worker_t *app_wrk;
   application_t *app;
   svm_msg_q_t *mq;
   void (*fp) (void *);
@@ -858,7 +869,8 @@
 	  if (PREDICT_FALSE (!s))
 	    continue;
 	  svm_fifo_unset_event (s->server_rx_fifo);
-	  app = application_get (s->app_index);
+	  app_wrk = app_worker_get (s->app_wrk_index);
+	  app = application_get (app_wrk->app_index);
 	  app->cb_fns.builtin_app_rx_callback (s);
 	  break;
 	case FIFO_EVENT_RPC:
diff --git a/src/vnet/session/session_test.c b/src/vnet/session/session_test.c
index c12041a..6f162a8 100644
--- a/src/vnet/session/session_test.c
+++ b/src/vnet/session/session_test.c
@@ -212,7 +212,7 @@
 {
   u64 options[APP_OPTIONS_N_OPTIONS], dummy_secret = 1234;
   u32 server_index, server_st_index, server_local_st_index;
-  u32 dummy_port = 1234, client_index;
+  u32 dummy_port = 1234, client_index, server_wrk_index;
   u32 dummy_api_context = 4321, dummy_client_api_index = 1234;
   u32 dummy_server_api_index = ~0, sw_if_index = 0;
   session_endpoint_t server_sep = SESSION_ENDPOINT_NULL;
@@ -318,6 +318,7 @@
   SESSION_TEST ((error == 0), "server attachment should work");
   server_index = attach_args.app_index;
   server = application_get (server_index);
+  server_wrk_index = application_get_default_worker (server)->wrk_index;
   SESSION_TEST ((server->ns_index == 0),
 		"server should be in the default ns");
 
@@ -328,8 +329,8 @@
   server_st_index = application_session_table (server, FIB_PROTOCOL_IP4);
   s = session_lookup_listener (server_st_index, &server_sep);
   SESSION_TEST ((s != 0), "listener should exist in global table");
-  SESSION_TEST ((s->app_index == server_index), "app_index should be that of "
-		"the server");
+  SESSION_TEST ((s->app_wrk_index == server_wrk_index), "app_index should be"
+		" that of the server");
   server_local_st_index = application_local_session_table (server);
   SESSION_TEST ((server_local_st_index == APP_INVALID_INDEX),
 		"server shouldn't have access to local table");
@@ -357,6 +358,7 @@
   SESSION_TEST ((error == 0), "server attachment should work");
   server_index = attach_args.app_index;
   server = application_get (server_index);
+  server_wrk_index = application_get_default_worker (server)->wrk_index;
   SESSION_TEST ((server->ns_index == app_namespace_index (app_ns)),
 		"server should be in the right ns");
 
@@ -366,8 +368,8 @@
   server_st_index = application_session_table (server, FIB_PROTOCOL_IP4);
   s = session_lookup_listener (server_st_index, &server_sep);
   SESSION_TEST ((s != 0), "listener should exist in global table");
-  SESSION_TEST ((s->app_index == server_index), "app_index should be that of "
-		"the server");
+  SESSION_TEST ((s->app_wrk_index == server_wrk_index), "app_index should be"
+		" that of the server");
   server_local_st_index = application_local_session_table (server);
   handle = session_lookup_local_endpoint (server_local_st_index, &server_sep);
   SESSION_TEST ((handle != SESSION_INVALID_HANDLE),
@@ -506,6 +508,8 @@
   error = vnet_application_attach (&attach_args);
   SESSION_TEST ((error == 0), "server attachment should work");
   server_index = attach_args.app_index;
+  server = application_get (server_index);
+  server_wrk_index = application_get_default_worker (server)->wrk_index;
 
   bind_args.app_index = server_index;
   error = vnet_bind (&bind_args);
@@ -515,8 +519,8 @@
 
   s = session_lookup_listener (server_st_index, &intf_sep);
   SESSION_TEST ((s != 0), "intf listener should exist in global table");
-  SESSION_TEST ((s->app_index == server_index), "app_index should be that of "
-		"the server");
+  SESSION_TEST ((s->app_wrk_index == server_wrk_index), "app_index should be "
+		"that of the server");
   server_local_st_index = application_local_session_table (server);
   handle = session_lookup_local_endpoint (server_local_st_index, &server_sep);
   SESSION_TEST ((handle != SESSION_INVALID_HANDLE),
@@ -1372,7 +1376,7 @@
   char *show_listeners = "sh session listeners tcp verbose";
   char *show_local_listeners = "sh app ns table default";
   unformat_input_t tmp_input;
-  u32 server_index, app_index;
+  u32 server_index, app_index, server_wrk_index;
   u32 dummy_server_api_index = ~0, sw_if_index = 0;
   clib_error_t *error = 0;
   u8 is_filtered = 0;
@@ -1380,6 +1384,7 @@
   transport_connection_t *tc;
   u16 lcl_port = 1234, rmt_port = 4321;
   app_namespace_t *app_ns;
+  application_t *server;
   int verbose = 0;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -1439,6 +1444,8 @@
   error = vnet_application_attach (&attach_args);
   SESSION_TEST ((error == 0), "server attachment should work");
   server_index = attach_args.app_index;
+  server = application_get (server_index);
+  server_wrk_index = application_get_default_worker (server)->wrk_index;
 
   if (verbose)
     {
@@ -1455,8 +1462,8 @@
   SESSION_TEST ((tc != 0), "lookup 1.2.3.4 1234 5.6.7.8 4321 should be "
 		"successful");
   s = listen_session_get (tc->s_index);
-  SESSION_TEST ((s->app_index == server_index), "lookup should return the"
-		" server");
+  SESSION_TEST ((s->app_wrk_index == server_wrk_index), "lookup should return"
+		" the server");
 
   tc = session_lookup_connection_wt4 (0, &rmt_ip, &rmt_ip, lcl_port, rmt_port,
 				      TRANSPORT_PROTO_TCP, 0, &is_filtered);
diff --git a/src/vnet/session/stream_session.h b/src/vnet/session/stream_session.h
index 34f122f..567962a 100644
--- a/src/vnet/session/stream_session.h
+++ b/src/vnet/session/stream_session.h
@@ -60,8 +60,8 @@
   /** Session index in per_thread pool */
   u32 session_index;
 
-  /** stream server pool index */
-  u32 app_index;
+  /** app worker pool index */
+  u32 app_wrk_index;
 
   u8 thread_index;
 
@@ -101,7 +101,7 @@
   u32 session_index;
 
   /** Server index */
-  u32 app_index;
+  u32 app_wrk_index;
 
   /** Segment index where fifos were allocated */
   u32 svm_segment_index;
@@ -118,7 +118,7 @@
   /**
    * Client data
    */
-  u32 client_index;
+  u32 client_wrk_index;
   u32 client_opaque;
 
   u64 server_evt_q;
@@ -143,36 +143,36 @@
 #define _(type, name) type name;
   foreach_session_endpoint_fields
 #undef _
-  u32 app_index;
+  u32 app_wrk_index;
   u32 opaque;
   u8 *hostname;
 } session_endpoint_extended_t;
 
-#define SESSION_IP46_ZERO		\
-{					\
-    .ip6 = {				\
-	{ 0, 0, },			\
-    },					\
+#define SESSION_IP46_ZERO			\
+{						\
+    .ip6 = {					\
+	{ 0, 0, },				\
+    },						\
 }
-#define SESSION_ENDPOINT_NULL 		\
-{					\
+#define SESSION_ENDPOINT_NULL 			\
+{						\
   .sw_if_index = ENDPOINT_INVALID_INDEX,	\
-  .ip = SESSION_IP46_ZERO,		\
-  .fib_index = ENDPOINT_INVALID_INDEX,	\
-  .is_ip4 = 0,				\
-  .port = 0,				\
-  .transport_proto = 0,			\
+  .ip = SESSION_IP46_ZERO,			\
+  .fib_index = ENDPOINT_INVALID_INDEX,		\
+  .is_ip4 = 0,					\
+  .port = 0,					\
+  .transport_proto = 0,				\
 }
-#define SESSION_ENDPOINT_EXT_NULL 	\
-{					\
+#define SESSION_ENDPOINT_EXT_NULL 		\
+{						\
   .sw_if_index = ENDPOINT_INVALID_INDEX,	\
-  .ip = SESSION_IP46_ZERO,		\
-  .fib_index = ENDPOINT_INVALID_INDEX,	\
-  .is_ip4 = 0,				\
-  .port = 0,				\
-  .transport_proto = 0,			\
-  .app_index = ENDPOINT_INVALID_INDEX,	\
-  .opaque = ENDPOINT_INVALID_INDEX,	\
+  .ip = SESSION_IP46_ZERO,			\
+  .fib_index = ENDPOINT_INVALID_INDEX,		\
+  .is_ip4 = 0,					\
+  .port = 0,					\
+  .transport_proto = 0,				\
+  .app_wrk_index = ENDPOINT_INVALID_INDEX,	\
+  .opaque = ENDPOINT_INVALID_INDEX,		\
   .hostname = 0,				\
 }
 
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index 4b12248..7364ba3 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -47,7 +47,7 @@
 }
 
 static inline int
-tls_add_app_q_evt (application_t * app, stream_session_t * app_session)
+tls_add_app_q_evt (app_worker_t * app, stream_session_t * app_session)
 {
   return application_send_event (app, app_session, FIFO_EVENT_APP_RX);
 }
@@ -139,8 +139,8 @@
 void
 tls_notify_app_enqueue (tls_ctx_t * ctx, stream_session_t * app_session)
 {
-  application_t *app;
-  app = application_get_if_valid (app_session->app_index);
+  app_worker_t *app;
+  app = app_worker_get_if_valid (app_session->app_wrk_index);
   if (PREDICT_TRUE (app != 0))
     tls_add_app_q_evt (app, app_session);
 }
@@ -150,21 +150,25 @@
 {
   stream_session_t *app_listener, *app_session;
   segment_manager_t *sm;
+  app_worker_t *app_wrk;
   application_t *app;
   tls_ctx_t *lctx;
   int rv;
 
-  app = application_get (ctx->parent_app_index);
+  app_wrk = app_worker_get (ctx->parent_app_index);
+  app = application_get (app_wrk->app_index);
   lctx = tls_listener_ctx_get (ctx->listener_ctx_index);
 
   app_session = session_alloc (vlib_get_thread_index ());
-  app_session->app_index = ctx->parent_app_index;
+  app_session->app_wrk_index = ctx->parent_app_index;
   app_session->connection_index = ctx->tls_ctx_handle;
 
   app_listener = listen_session_get_from_handle (lctx->app_session_handle);
   app_session->session_type = app_listener->session_type;
   app_session->listener_index = app_listener->session_index;
-  sm = application_get_listen_segment_manager (app, app_listener);
+  sm = app_worker_get_listen_segment_manager (app_wrk, app_listener);
+  app_session->opaque = tls_main.app_index;
+
   if ((rv = session_alloc_fifos (sm, app_session)))
     {
       TLS_DBG (1, "failed to allocate fifos");
@@ -181,20 +185,24 @@
   int (*cb_fn) (u32, u32, stream_session_t *, u8);
   stream_session_t *app_session;
   segment_manager_t *sm;
+  app_worker_t *app_wrk;
   application_t *app;
 
-  app = application_get (ctx->parent_app_index);
+  app_wrk = app_worker_get (ctx->parent_app_index);
+  app = application_get (app_wrk->app_index);
   cb_fn = app->cb_fns.session_connected_callback;
 
   if (is_failed)
     goto failed;
 
-  sm = application_get_connect_segment_manager (app);
+  sm = app_worker_get_connect_segment_manager (app_wrk);
   app_session = session_alloc (vlib_get_thread_index ());
-  app_session->app_index = ctx->parent_app_index;
+  app_session->app_wrk_index = ctx->parent_app_index;
   app_session->connection_index = ctx->tls_ctx_handle;
   app_session->session_type =
     session_type_from_proto_and_ip (TRANSPORT_PROTO_TLS, ctx->tcp_is_ip4);
+  app_session->opaque = tls_main.app_index;
+
   if (session_alloc_fifos (sm, app_session))
     goto failed;
 
@@ -316,6 +324,7 @@
 {
   stream_session_t *app_session;
   tls_ctx_t *ctx;
+  app_worker_t *app_wrk;
   application_t *app;
 
   ctx = tls_ctx_get (tls_session->opaque);
@@ -325,7 +334,8 @@
       return;
     }
   ctx->is_passive_close = 1;
-  app = application_get (ctx->parent_app_index);
+  app_wrk = app_worker_get (ctx->parent_app_index);
+  app = application_get (app_wrk->app_index);
   app_session = session_get_from_handle (ctx->app_session_handle);
   app->cb_fns.session_disconnect_callback (app_session);
 }
@@ -382,12 +392,14 @@
 				stream_session_t * tls_session, u8 is_fail)
 {
   int (*cb_fn) (u32, u32, stream_session_t *, u8);
-  application_t *app;
   tls_ctx_t *ho_ctx, *ctx;
+  app_worker_t *app_wrk;
+  application_t *app;
   u32 ctx_handle;
 
   ho_ctx = tls_ctx_half_open_get (ho_ctx_index);
-  app = application_get (ho_ctx->parent_app_index);
+  app_wrk = app_worker_get (ho_ctx->parent_app_index);
+  app = application_get (app_wrk->app_index);
   cb_fn = app->cb_fns.session_connected_callback;
 
   if (is_fail)
@@ -434,17 +446,19 @@
 int
 tls_connect (transport_endpoint_t * tep)
 {
+  vnet_connect_args_t _cargs = { {}, }, *cargs = &_cargs;
   session_endpoint_extended_t *sep;
   tls_engine_type_t engine_type;
-  session_endpoint_t tls_sep;
   tls_main_t *tm = &tls_main;
+  app_worker_t *app_wrk;
+  clib_error_t *error;
   application_t *app;
   tls_ctx_t *ctx;
   u32 ctx_index;
-  int rv;
 
   sep = (session_endpoint_extended_t *) tep;
-  app = application_get (sep->app_index);
+  app_wrk = app_worker_get (sep->app_wrk_index);
+  app = application_get (app_wrk->app_index);
   engine_type = tls_get_engine_type (app->tls_engine);
   if (engine_type == TLS_ENGINE_NONE)
     {
@@ -454,7 +468,7 @@
 
   ctx_index = tls_ctx_half_open_alloc ();
   ctx = tls_ctx_half_open_get (ctx_index);
-  ctx->parent_app_index = sep->app_index;
+  ctx->parent_app_index = sep->app_wrk_index;
   ctx->parent_app_api_context = sep->opaque;
   ctx->tcp_is_ip4 = sep->is_ip4;
   if (sep->hostname)
@@ -464,13 +478,15 @@
     }
   tls_ctx_half_open_reader_unlock ();
 
-  application_alloc_connects_segment_manager (app);
+  app_worker_alloc_connects_segment_manager (app_wrk);
   ctx->tls_ctx_engine = engine_type;
 
-  clib_memcpy (&tls_sep, sep, sizeof (tls_sep));
-  tls_sep.transport_proto = TRANSPORT_PROTO_TCP;
-  if ((rv = application_connect (tm->app_index, ctx_index, &tls_sep)))
-    return rv;
+  clib_memcpy (&cargs->sep, sep, sizeof (session_endpoint_t));
+  cargs->sep.transport_proto = TRANSPORT_PROTO_TCP;
+  cargs->app_index = tm->app_index;
+  cargs->api_context = ctx_index;
+  if ((error = vnet_connect (cargs)))
+    return clib_error_get_code (error);
 
   TLS_DBG (1, "New connect request %u engine %d", ctx_index, engine_type);
   return 0;
@@ -502,18 +518,20 @@
 u32
 tls_start_listen (u32 app_listener_index, transport_endpoint_t * tep)
 {
+  app_worker_t *tls_app_wrk, *app_wrk;
   tls_main_t *tm = &tls_main;
-  application_t *tls_app, *app;
   session_handle_t tls_handle;
   session_endpoint_extended_t *sep;
   stream_session_t *tls_listener;
-  tls_ctx_t *lctx;
-  u32 lctx_index;
   stream_session_t *app_listener;
   tls_engine_type_t engine_type;
+  application_t *app, *tls_app;
+  tls_ctx_t *lctx;
+  u32 lctx_index;
 
   sep = (session_endpoint_extended_t *) tep;
-  app = application_get (sep->app_index);
+  app_wrk = app_worker_get (sep->app_wrk_index);
+  app = application_get (app_wrk->app_index);
   engine_type = tls_get_engine_type (app->tls_engine);
   if (engine_type == TLS_ENGINE_NONE)
     {
@@ -523,10 +541,12 @@
 
   lctx_index = tls_listener_ctx_alloc ();
 
+  /* TODO hide this by calling vnet_bind() */
   tls_app = application_get (tm->app_index);
+  tls_app_wrk = application_get_default_worker (tls_app);
   sep->transport_proto = TRANSPORT_PROTO_TCP;
-  if (application_start_listen (tls_app, (session_endpoint_t *) sep,
-				&tls_handle))
+  if (app_worker_start_listen (tls_app_wrk, (session_endpoint_t *) sep,
+			       &tls_handle))
     return ~0;
 
   tls_listener = listen_session_get_from_handle (tls_handle);
@@ -535,7 +555,7 @@
   app_listener = listen_session_get (app_listener_index);
 
   lctx = tls_listener_ctx_get (lctx_index);
-  lctx->parent_app_index = sep->app_index;
+  lctx->parent_app_index = sep->app_wrk_index;
   lctx->tls_session_handle = tls_handle;
   lctx->app_session_handle = listen_session_get_handle (app_listener);
   lctx->tcp_is_ip4 = sep->is_ip4;
@@ -552,14 +572,11 @@
 tls_stop_listen (u32 lctx_index)
 {
   tls_main_t *tm = &tls_main;
-  application_t *tls_app;
   tls_ctx_t *lctx;
   tls_engine_type_t engine_type;
 
   lctx = tls_listener_ctx_get (lctx_index);
-  tls_app = application_get (tm->app_index);
-  application_stop_listen (tls_app, lctx->tls_session_handle);
-
+  app_worker_stop_listen (lctx->tls_session_handle, tm->app_index);
   engine_type = lctx->tls_ctx_engine;
   tls_vfts[engine_type].ctx_stop_listen (lctx);
 
