Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/client.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/client.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/client.cpp	(revision 2453)
@@ -188,10 +188,20 @@
      
       CXios::launchDaemonsManager(false) ;
-      poolRessource_ = new CPoolRessource(clientComm, codeId) ;
+      poolRessource_ = new CPoolRessource(clientComm, codeId, false) ;
 
       /////////////////////////////////////////
       ///////////// PART 4 ////////////////////
       /////////////////////////////////////////      
-      
+/*
+      MPI_Request req ;
+      MPI_Status status ;
+      MPI_Ibarrier(xiosGlobalComm,&req) ; // be sure that all services are created now, could be remove later if more asynchronisity
+      int ok=false ;
+      while (!ok)
+      {
+        CXios::getDaemonsManager()->eventLoop() ;
+        MPI_Test(&req,&ok,&status) ;
+      }
+*/      
       returnComm = clientComm ;
     }
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/config/context_attribute.conf
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/config/context_attribute.conf	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/config/context_attribute.conf	(revision 2453)
@@ -1,2 +1,10 @@
 DECLARE_ATTRIBUTE(StdString, output_dir)
 DECLARE_ATTRIBUTE(bool, attached_mode)
+DECLARE_ATTRIBUTE(StdString, default_pool)
+DECLARE_ATTRIBUTE(StdString, default_pool_writer)
+DECLARE_ATTRIBUTE(StdString, default_pool_reader)
+DECLARE_ATTRIBUTE(StdString, default_pool_gatherer)
+DECLARE_ATTRIBUTE(StdString, default_writer)
+DECLARE_ATTRIBUTE(StdString, default_gatherer)
+DECLARE_ATTRIBUTE(StdString, default_reader)
+DECLARE_ATTRIBUTE(bool, default_using_server2)
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/config/file_attribute.conf
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/config/file_attribute.conf	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/config/file_attribute.conf	(revision 2453)
@@ -38,2 +38,10 @@
 DECLARE_ATTRIBUTE(StdString, uuid_name)
 DECLARE_ATTRIBUTE(StdString, uuid_format)
+
+DECLARE_ATTRIBUTE(StdString, pool_writer)
+DECLARE_ATTRIBUTE(StdString, writer)
+DECLARE_ATTRIBUTE(StdString, pool_gatherer)
+DECLARE_ATTRIBUTE(StdString, gatherer)
+DECLARE_ATTRIBUTE(StdString, pool_reader)
+DECLARE_ATTRIBUTE(StdString, reader)
+DECLARE_ATTRIBUTE(bool, using_server2)
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/config/node_type.conf
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/config/node_type.conf	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/config/node_type.conf	(revision 2453)
@@ -128,4 +128,8 @@
 #endif //__XIOS_CPoolNode__
 
+#ifdef __XIOS_CServiceNode__
+   DECLARE_NODE(ServiceNode, node)
+#endif //__XIOS_CServiceNode__
+
 #ifdef __XIOS_CContext__
    DECLARE_NODE_PAR(Context, context)
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/config/pool_attribute.conf
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/config/pool_attribute.conf	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/config/pool_attribute.conf	(revision 2453)
@@ -1,1 +1,5 @@
 DECLARE_ATTRIBUTE(StdString, name)
+DECLARE_ATTRIBUTE(int, nprocs)
+DECLARE_ATTRIBUTE(double, global_fraction)
+DECLARE_ATTRIBUTE(double, remain_fraction)
+DECLARE_ATTRIBUTE(bool, remain)
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/config/service_attribute.conf
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/config/service_attribute.conf	(revision 2453)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/config/service_attribute.conf	(revision 2453)
@@ -0,0 +1,7 @@
+DECLARE_ATTRIBUTE(StdString, name)
+DECLARE_ATTRIBUTE(int, nprocs)
+DECLARE_ATTRIBUTE(double, global_fraction)
+DECLARE_ATTRIBUTE(double, remain_fraction)
+DECLARE_ATTRIBUTE(bool, remain)
+DECLARE_ENUM3(type,  writer, reader, gatherer)
+DECLARE_ATTRIBUTE(int, nb_partitions)
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/group_factory_decl.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/group_factory_decl.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/group_factory_decl.cpp	(revision 2453)
@@ -49,4 +49,5 @@
   macro(CExtractDomainGroup)
   macro(CPoolNodeGroup)
+  macro(CServiceNodeGroup)
 
 }
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/group_template_decl.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/group_template_decl.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/group_template_decl.cpp	(revision 2453)
@@ -38,4 +38,5 @@
   macro(ExtractDomain)
   macro(PoolNode)
+  macro(ServiceNode)
 
 }
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/pool_ressource.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/pool_ressource.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/pool_ressource.cpp	(revision 2453)
@@ -10,5 +10,5 @@
 namespace xios
 {
-  CPoolRessource::CPoolRessource(MPI_Comm poolComm, const std::string& Id) : Id_(Id), finalizeSignal_(false)
+  CPoolRessource::CPoolRessource(MPI_Comm poolComm, const std::string& Id, bool isServer) : Id_(Id), finalizeSignal_(false)
   {
     int commRank, commSize ;
@@ -23,5 +23,5 @@
       int globalLeaderRank ;
       MPI_Comm_rank(CXios::getXiosComm(),&globalLeaderRank) ;
-      CXios::getRessourcesManager()->registerPool(Id, commSize, globalLeaderRank) ;
+      if (isServer) CXios::getRessourcesManager()->registerPoolServer(Id, commSize, globalLeaderRank) ;
     }
     
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/pool_ressource.hpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/pool_ressource.hpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/pool_ressource.hpp	(revision 2453)
@@ -27,5 +27,5 @@
 
     public:
-    CPoolRessource(MPI_Comm poolComm, const std::string& Id) ;
+    CPoolRessource(MPI_Comm poolComm, const std::string& Id, bool isServer) ;
     ~CPoolRessource() ;
     
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/ressources_manager.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/ressources_manager.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/ressources_manager.cpp	(revision 2453)
@@ -163,5 +163,5 @@
     buffer.realloc(maxBufferSize_) ;
     
-    buffer<<serverLeader_ ;  
+    buffer<<ressourcesSize_<<freeRessourcesSize_<<serverLeader_ ;  
     buffer<<(int) pools_.size();
     for(auto it=pools_.begin();it!=pools_.end(); ++it)
@@ -169,5 +169,5 @@
       auto key = it->first ;
       auto val = it->second ; 
-      buffer << key<<std::get<0>(val) << std::get<1>(val)  ;
+      buffer << key<<std::get<0>(val)  << std::get<1>(val)  << std::get<2>(val);
     }
   }
@@ -177,7 +177,8 @@
     std::string poolId ;
     int size ;
+    int freeSize ;
     int leader ;
    
-    buffer>>serverLeader_ ;
+    buffer>>ressourcesSize_>>freeRessourcesSize_>>serverLeader_ ;
     pools_.clear() ;
     int nbPools ;
@@ -185,6 +186,6 @@
     for(int i=0;i<nbPools;i++) 
     {
-      buffer>>poolId>>size>>leader ;
-      pools_[poolId]=std::make_tuple(size,leader) ;
+      buffer>>poolId>>size>>freeSize>>leader ;
+      pools_[poolId]=std::make_tuple(size, freeSize, leader) ;
     }
   }
@@ -210,9 +211,18 @@
 
  
-  void CRessourcesManager::registerPool(const string& poolId, int size, int leader)
-  {
-    winRessources_->lockWindow(managerGlobalLeader_,0) ;
-    winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;
-    pools_[poolId] = make_tuple(size,leader) ;
+  void CRessourcesManager::registerPoolClient(const string& poolId, int size, int leader)
+  {
+    winRessources_->lockWindow(managerGlobalLeader_,0) ;
+    winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;
+    pools_[poolId] = make_tuple(size, size, leader) ;
+    winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;
+    winRessources_->unlockWindow(managerGlobalLeader_,0) ;    
+  }
+
+  void CRessourcesManager::registerPoolServer(const string& poolId, int size, int leader)
+  {
+    winRessources_->lockWindow(managerGlobalLeader_,0) ;
+    winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;
+    pools_[poolId] = make_tuple(size, size, leader) ;
     freeRessourcesSize_-=size ;
     winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;
@@ -220,6 +230,5 @@
   }
 
-
-  bool CRessourcesManager::getPoolInfo(const string& poolId, int& size, int& leader)
+  bool CRessourcesManager::getPoolInfo(const string& poolId, int& size, int& freeSize, int& leader)
   {
     winRessources_->lockWindow(managerGlobalLeader_,0) ;
@@ -232,7 +241,28 @@
     {
       size=get<0>(it->second) ;
-      leader=get<1>(it->second) ;
+      freeSize=get<1>(it->second) ;
+      leader=get<2>(it->second) ;
       return true ;
     }
+  }
+
+  bool CRessourcesManager::decreasePoolFreeSize(const string& poolId, int size)
+  {
+    int ret ;
+
+    winRessources_->lockWindow(managerGlobalLeader_,0) ;
+    winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;
+   
+
+    auto it=pools_.find(poolId) ;
+    
+    if ( it == pools_.end()) ret=false ;
+    else 
+    {
+      get<1>(it->second)-=size ;
+      ret=true ;
+    }
+    winRessources_->updateToWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;
+    winRessources_->unlockWindow(managerGlobalLeader_,0) ;    
   }
 
@@ -257,18 +287,29 @@
   bool CRessourcesManager::getPoolLeader(const string& poolId, int& leader)
   {
-    int size ;
-    return getPoolInfo(poolId, size, leader) ;
+    int size, freeSize ;
+    return getPoolInfo(poolId, size, freeSize, leader) ;
   }
 
   bool CRessourcesManager::getPoolSize(const string& poolId, int& size)
   {
-    int leader ;
-    return getPoolInfo(poolId, size, leader) ;
+    int leader,freeSize ;
+    return getPoolInfo(poolId, size, freeSize, leader) ;
+  }
+
+  bool CRessourcesManager::getPoolFreeSize(const string& poolId, int& freeSize)
+  {
+    int leader,size ;
+    return getPoolInfo(poolId, size, freeSize, leader) ;
   }
 
   bool CRessourcesManager::hasPool(const string& poolId)
   {
-    int leader,size ;
-    return getPoolInfo(poolId, size, leader) ;
+    int leader,size,freeSize ;
+    return getPoolInfo(poolId, size, freeSize, leader) ;
+  }
+
+  void CRessourcesManager::waitPoolRegistration(const string& poolId)
+  {
+    while(!hasPool(poolId)) CXios::getDaemonsManager()->servicesEventLoop() ;
   }
 }
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/ressources_manager.hpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/ressources_manager.hpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/ressources_manager.hpp	(revision 2453)
@@ -45,12 +45,16 @@
     int  getRessourcesSize(void) ;
     int  getFreeRessourcesSize(void) ;
-    bool getPoolInfo(const string& poolId, int& size, int& leader) ;
+    bool getPoolInfo(const string& poolId, int& size, int& freeSize, int& leader) ;
     bool getPoolLeader(const string& poolId, int& leader) ;
     bool getPoolSize(const string& poolId, int& size) ;
+    bool getPoolFreeSize(const string& poolId, int& freeSize) ;
     bool hasPool(const string& poolId) ;
-
+    bool decreasePoolFreeSize(const string& poolId, int size) ;
+    void waitPoolRegistration(const string& poolId) ;
+    
     void registerServerLeader(int leaderRank) ;
     void registerRessourcesSize(int size) ;
-    void registerPool(const std::string& poolId,int size,int leader) ;
+    void registerPoolClient(const std::string& poolId,int size,int leader) ;
+    void registerPoolServer(const std::string& poolId,int size,int leader) ;
 
     int managerGlobalLeader_ ;
@@ -67,5 +71,5 @@
     tuple<std::string, int> notifyCreatePool_ ;
 
-    std::map<std::string, std::tuple<int,int>> pools_ ;
+    std::map<std::string, std::tuple<int,int,int>> pools_ ;
     int serverLeader_ ;
     int ressourcesSize_ ;
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/servers_ressource.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/servers_ressource.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/servers_ressource.cpp	(revision 2453)
@@ -50,5 +50,5 @@
     bool isPartOf ;
 
-    for(int i=0; i<freeRessourcesRank_.size();i++) 
+    for(int i=0, j=0; i<freeRessourcesRank_.size();i++) 
     {
        if (i<size) isPartOf=true ;
@@ -56,5 +56,6 @@
        {
          isPartOf=false ;
-         newFreeRessourcesRank[i]=freeRessourcesRank_[i] ;
+         newFreeRessourcesRank[j]=freeRessourcesRank_[i] ;
+         j++ ;
        }
        
@@ -165,5 +166,5 @@
     if (isPartOf)
     {  
-      poolRessource_ = new CPoolRessource(poolComm, poolId) ;
+      poolRessource_ = new CPoolRessource(poolComm, poolId, true) ;
       MPI_Comm_free(&poolComm) ;
     }
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/services_manager.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/services_manager.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/services_manager.cpp	(revision 2453)
@@ -54,8 +54,8 @@
 
     int leader ;
-    int poolSize ;
+    int poolSize, poolFreeSize ;
     
     info(40)<<"CServicesManager : waiting for pool info : "<<poolId<<endl ; ;
-    bool ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, leader) ;
+    bool ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, poolFreeSize, leader) ;
     if (wait)
     {
@@ -63,5 +63,5 @@
       {
         CXios::getDaemonsManager()->eventLoop() ;
-        ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, leader) ;
+        ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, poolFreeSize, leader) ;
       }
     }
@@ -70,4 +70,5 @@
     {
       info(40)<<"CServicesManager : create service notification to leader "<<leader<<", serviceId : "<<serviceId<<", size : "<<size<<endl ;
+      CXios::getRessourcesManager()->decreasePoolFreeSize(poolId ,size) ;
       createServicesNotify(leader, serviceId, type, size, nbPartitions) ;
       return true ;
@@ -81,7 +82,8 @@
     int leader ;
     int poolSize ;
+    int poolFreeSize ;
     
     info(40)<<"CServicesManager : waiting for pool info : "<<poolId<<endl ; ;
-    bool ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, leader) ;
+    bool ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, poolFreeSize, leader) ;
     if (wait)
     {
@@ -89,5 +91,5 @@
       {
         CXios::getDaemonsManager()->eventLoop() ;
-        ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, leader) ;
+        ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, poolFreeSize, leader) ;
       }
     }
@@ -251,5 +253,5 @@
 
   bool CServicesManager::getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, 
-                                        int& size, int& nbPartitions, int& leader)
+                                        int& size, int& nbPartitions, int& leader, bool wait)
   {
     
@@ -259,7 +261,8 @@
 
     auto it=services_.find(std::tuple<std::string,std::string,int>(poolId,serviceId,partitionId)) ;
-    if ( it == services_.end()) return false ;
+    if ( it == services_.end() && !wait) return false ;
     else
     {
+      if (wait) waitServiceRegistration(poolId, serviceId, partitionId) ;
       type= std::get<0>(it->second); 
       size= std::get<1>(it->second); 
@@ -270,5 +273,5 @@
   }
 
-  bool CServicesManager::getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader)
+  bool CServicesManager::getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader, bool wait)
   {
     int type;
@@ -278,5 +281,5 @@
   }
 
-  bool CServicesManager::getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type)
+  bool CServicesManager::getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, bool wait)
   {
     int size ;
@@ -286,5 +289,5 @@
   }
 
-  bool CServicesManager::getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartitions)
+  bool CServicesManager::getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartitions, bool wait)
   {
     int size ;
@@ -303,4 +306,9 @@
     else return true ;
   }
+ 
+  bool CServicesManager::waitServiceRegistration(const std::string& poolId, const std::string& serviceId, const int& partitionId)
+  {
+    while(!hasService(poolId,serviceId,partitionId)) CXios::getDaemonsManager()->servicesEventLoop() ;
+  }
 
 }
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/services_manager.hpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/services_manager.hpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/manager/services_manager.hpp	(revision 2453)
@@ -43,11 +43,14 @@
     
     void registerService(const std::string& poolId, const std::string& serviceId, const int& partitionId, int type, int size, int nbPartitions, int leader) ;
-    bool getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, int& size, int& nbPartition, int& leader) ;
-    bool getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader) ;
-    bool getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type) ;
-    bool getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartition) ;
+    bool getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, int& size, int& nbPartition, int& leader, bool wait=false) ;
+    bool getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader, bool wait=false) ;
+    bool getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, bool wait=false) ;
+    bool getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartition, bool wait=false) ;
     bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ;
+    bool waitServiceRegistration(const std::string& poolId, const std::string& serviceId, const int& partitionId);
     void servicesDumpOut(CBufferOut& buffer) ;
     void servicesDumpIn(CBufferIn& buffer) ;
+    int  getRessourcesSize(const std::string& poolId) ;
+    int  getFreeRessourcesSize(const std::string& poolId) ;
 
     private:
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/node/context.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/node/context.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/node/context.cpp	(revision 2453)
@@ -577,5 +577,5 @@
     if (commRank==0)
     {
-      CXios::getServicesManager()->getServiceNbPartitions(poolId, serverId, 0, nbPartitions) ;
+      CXios::getServicesManager()->getServiceNbPartitions(poolId, serverId, 0, nbPartitions, true) ;
       for(int i=0 ; i<nbPartitions; i++) CXios::getContextsManager()->createServerContext(poolId, serverId, i, getContextId()) ;
     }
@@ -588,5 +588,5 @@
       parentServerContext_->createIntercomm(poolId, serverId, i, getContextId(), intraComm_, interCommClient, interCommServer) ;
       int type ; 
-      if (commRank==0) CXios::getServicesManager()->getServiceType(poolId, serverId, 0, type) ;
+      if (commRank==0) CXios::getServicesManager()->getServiceType(poolId, serverId, 0, type, true) ;
       MPI_Bcast(&type,1,MPI_INT,0,intraComm_) ;
       string fullServerId=CXios::getContextsManager()->getServerContextName(poolId, serverId, i, type, getContextId()) ;
@@ -610,4 +610,6 @@
   CATCH_DUMP_ATTR
   
+  
+  // obsolete
   void CContext::createServerInterComm(void) 
   TRY
@@ -645,4 +647,42 @@
   }
   CATCH_DUMP_ATTR
+
+  
+  void CContext::getServerInterComm(const string& poolId, const string& serviceId,  vector<pair<CContextClient*,CContextServer*>>& clientServers)
+  {
+    vector<pair<string, pair<CContextClient*,CContextServer*>>> retClientServers ;
+
+    auto it=serversMap_.find(make_pair(poolId,serviceId)) ;
+    if (it!=serversMap_.end()) clientServers=it->second ;
+    else
+    {
+      if (attached_mode) createServerInterComm(CClient::getPoolRessource()->getId(), getContextId()+"_"+serviceId, retClientServers) ;
+      else createServerInterComm(poolId, serviceId, retClientServers) ;
+      for(auto& retClientServer : retClientServers)  clientServers.push_back(retClientServer.second) ;
+      
+      int serviceType ;
+      if (intraCommRank_==0) CXios::getServicesManager()->getServiceType(poolId, serviceId, 0, serviceType) ;
+      MPI_Bcast(&serviceType,1,MPI_INT,0,intraComm_) ;
+      
+      for(auto& clientServer : clientServers)     
+      {
+        if (serviceType==CServicesManager::WRITER) { writerClientOut_.push_back(clientServer.first)      ; writerServerOut_.push_back(clientServer.second) ; }
+        else if (serviceType==CServicesManager::READER) { readerClientOut_.push_back(clientServer.first) ; readerServerOut_.push_back(clientServer.second) ; }
+        else if (serviceType==CServicesManager::GATHERER) { writerClientOut_.push_back(clientServer.first) ; writerServerOut_.push_back(clientServer.second) ; }
+      }
+      serversMap_.insert(make_pair(make_pair(poolId,serviceId),clientServers)) ;
+    }
+
+  }
+
+  vector<CContextClient*> CContext::getContextClient(const string& poolId, const string& serviceId)
+  {
+    vector<pair<CContextClient*,CContextServer*>> clientServers ;
+    getServerInterComm(poolId, serviceId, clientServers ) ;
+    vector<CContextClient*> ret ;
+    for(auto& clientServer : clientServers) ret.push_back(clientServer.first) ;
+    return ret ;
+  }
+
 
   void CContext::globalEventLoop(void)
@@ -783,4 +823,5 @@
         CContextServer* server ;
 
+        /*
         if (writerClientOut_.size()!=0)
         {
@@ -803,4 +844,32 @@
           info(100)<<"DEBUG: context "<<getId()<<" release client writer ok"<<endl ;
         }
+        */
+
+        for(int n=0; n<writerClientOut_.size() ; n++)
+        {
+          client=writerClientOut_[n] ;
+          server=writerServerOut_[n] ;
+
+          info(100)<<"DEBUG: context "<<getId()<<" Send client finalize to writer"<<endl ;
+          client->finalize();
+          info(100)<<"DEBUG: context "<<getId()<<" Client finalize sent to writer"<<endl ;
+          bool bufferReleased;
+          do
+          {
+            client->eventLoop();
+            bufferReleased = !client->havePendingRequests();
+          } while (!bufferReleased);
+          info(100)<<"DEBUG: context "<<getId()<<" no pending request on writer ok"<<endl ;
+
+          bool notifiedFinalized=false ;
+          do
+          {
+            notifiedFinalized=client->isNotifiedFinalized() ;
+          } while (!notifiedFinalized) ;
+          server->releaseBuffers();
+          client->releaseBuffers();
+          info(100)<<"DEBUG: context "<<getId()<<" release client writer ok"<<endl ;
+        }
+        
 
         if (readerClientOut_.size()!=0)
@@ -879,4 +948,24 @@
 
    
+   void CContext::setDefaultServices(void)
+   {
+     defaultPoolWriterId_ = CXios::defaultPoolId ;
+     defaultPoolReaderId_ = CXios::defaultPoolId ;
+     defaultPoolGathererId_ = CXios::defaultPoolId ;
+     defaultWriterId_ = CXios::defaultWriterId ;
+     defaultReaderId_ = CXios::defaultReaderId ;
+     defaultGathererId_ = CXios::defaultGathererId ;
+     defaultUsingServer2_ = CXios::usingServer2 ;
+     
+     if (!default_pool.isEmpty())  defaultPoolWriterId_ = defaultPoolReaderId_= defaultPoolGathererId_= default_pool ;
+     if (!default_pool_writer.isEmpty()) defaultPoolWriterId_ = default_pool_writer ;
+     if (!default_pool_reader.isEmpty()) defaultPoolReaderId_ = default_pool_reader ;
+     if (!default_pool_gatherer.isEmpty()) defaultPoolGathererId_ = default_pool_gatherer ;
+     if (!default_writer.isEmpty()) defaultWriterId_ = default_writer ;
+     if (!default_reader.isEmpty()) defaultWriterId_ = default_reader ;
+     if (!default_gatherer.isEmpty()) defaultGathererId_ = default_gatherer ;
+     if (!default_using_server2.isEmpty()) defaultUsingServer2_ = default_using_server2 ;
+   }
+
    /*!
    \brief Close all the context defintion and do processing data
@@ -894,8 +983,8 @@
 
      CTimer::get("Context : close definition").resume() ;
-     
+          
      // create intercommunicator with servers. 
      // not sure it is the good place to be called here 
-     createServerInterComm() ;
+     //createServerInterComm() ;
 
 
@@ -916,5 +1005,5 @@
     // pour chacun des contextes.
     solveDescInheritance(true);
- 
+    setDefaultServices() ;
     // Check if some axis, domains or grids are eligible to for compressed indexed output.
     // Warning: This must be done after solving the inheritance and before the rest of post-processing
@@ -1023,10 +1112,25 @@
 
     // Distribute files between secondary servers according to the data size => assign a context to a file and then to fields
-    if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER ) distributeFiles(this->enabledWriteModeFiles);
-    //else if (serviceType_==CServicesManager::CLIENT) for(auto file : this->enabledWriteModeFiles) file->setContextClient(client) ;
+    
+    if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) distributeFiles(this->enabledWriteModeFiles) ;
+    /*
+    if (serviceType_==CServicesManager::CLIENT )
+    {   
+      if (CXios::usingServer2) distributeFiles(this->enabledWriteModeFiles, defaultPoolGathererId_, defaultGathererId_);
+      else distributeFiles(this->enabledWriteModeFiles, defaultPoolWriterId_, defaultWriterId_);
+    }
+    if (serviceType_==CServicesManager::GATHERER ) distributeFiles(this->enabledWriteModeFiles, defaultPoolWriterId_, defaultWriterId_);
+    */
 
     // client side, assign context for file reading
-    if (serviceType_==CServicesManager::CLIENT) for(auto file : this->enabledReadModeFiles) file->setContextClient(readerClientOut_[0]) ;
-    
+//    if (serviceType_==CServicesManager::CLIENT) for(auto file : this->enabledReadModeFiles) file->setContextClient(readerClientOut_[0]) ;
+    if (serviceType_==CServicesManager::CLIENT) for(auto file : this->enabledReadModeFiles) 
+    {
+      string poolReaderId ;
+      string readerId ;
+      file->getReaderServicesId(defaultPoolReaderId_, defaultReaderId_, poolReaderId, readerId) ;
+      file->setContextClient(poolReaderId, readerId, 0) ;
+    }
+
     // server side, assign context where to send file data read
     if (serviceType_==CServicesManager::READER) for(auto file : this->enabledReadModeFiles) file->setContextClient(readerClientIn_[0]) ;
@@ -1163,4 +1267,5 @@
     // fix size for each context client
     for(auto& it : fieldBufferEvaluation) it.first->setBufferSize(it.second) ;
+
 
      CTimer::get("Context : close definition").suspend() ;
@@ -1436,22 +1541,46 @@
    TRY
    {
+     map< pair<string,string>, vector<CFile*>> fileMaps ;
+     for(auto& file : files)
+     {
+       string poolWriterId ;
+       string poolGathererId ;
+       string writerId  ;
+       string gathererId  ;
+       bool usingServer2 ;
+
+       file->getWriterServicesId(defaultUsingServer2_, defaultPoolWriterId_, defaultWriterId_, defaultPoolGathererId_, defaultGathererId_,
+                                 usingServer2, poolWriterId, writerId, poolGathererId, gathererId) ;
+       if (serviceType_==CServicesManager::CLIENT && usingServer2) fileMaps[make_pair(poolGathererId,gathererId)].push_back(file) ;
+       else fileMaps[make_pair(poolWriterId,writerId)].push_back(file) ;
+     }
+     for(auto& it : fileMaps) distributeFilesOnSameService(it.second, it.first.first, it.first.second) ;
+   }
+   CATCH_DUMP_ATTR
+
+
+   void CContext::distributeFilesOnSameService(const vector<CFile*>& files, const string& poolId, const string& serviceId)
+   TRY
+   {
      bool distFileMemory=false ;
      distFileMemory=CXios::getin<bool>("server2_dist_file_memory", distFileMemory);
 
-     int nbPools = writerClientOut_.size();
-     if (nbPools==1) distributeFileOverOne(files) ;
-     else if (distFileMemory) distributeFileOverMemoryBandwith(files) ;
-     else distributeFileOverBandwith(files) ;
-   }
-   CATCH_DUMP_ATTR
-
-   void CContext::distributeFileOverOne(const vector<CFile*>& files)
-   TRY
-   {
-    for(auto& file : files) file->setContextClient(writerClientOut_[0]) ;
-   }
-   CATCH_DUMP_ATTR
-
-   void CContext::distributeFileOverBandwith(const vector<CFile*>& files)
+     auto writers = getContextClient(poolId, serviceId) ;
+     int  nbPools = writers.size() ;
+     
+     if (nbPools==1) distributeFileOverOne(files, poolId, serviceId) ;
+     else if (distFileMemory) distributeFileOverMemoryBandwith(files, poolId, serviceId) ;
+     else distributeFileOverBandwith(files, poolId, serviceId) ;
+   }
+   CATCH_DUMP_ATTR
+
+   void CContext::distributeFileOverOne(const vector<CFile*>& files, const string& poolId, const string& serviceId)
+   TRY
+   {
+     for(auto& file : files) file->setContextClient(poolId, serviceId,0) ;
+   }
+   CATCH_DUMP_ATTR
+
+   void CContext::distributeFileOverBandwith(const vector<CFile*>& files, const string& poolId, const string& serviceId)
    TRY
    {
@@ -1459,5 +1588,7 @@
      
      std::ofstream ofs(("distribute_file_"+getId()+".dat").c_str(), std::ofstream::out);
-     int nbPools = writerClientOut_.size();
+     auto writers = getContextClient(poolId, serviceId) ;
+     int nbPools = writers.size();
+     //int nbPools = writerClientOut_.size();
 
      // (1) Find all enabled files in write mode
@@ -1512,5 +1643,5 @@
        dataSize=(*poolDataSize.begin()).first ;
        j=(*poolDataSize.begin()).second ;
-       dataSizeMap[i].second->setContextClient(writerClientOut_[j]);
+       dataSizeMap[i].second->setContextClient(poolId, serviceId, j);
        dataSize+=dataSizeMap[i].first;
        poolDataSize.erase(poolDataSize.begin()) ;
@@ -1522,8 +1653,10 @@
    CATCH_DUMP_ATTR
 
-   void CContext::distributeFileOverMemoryBandwith(const vector<CFile*>& filesList)
-   TRY
-   {
-     int nbPools = writerClientOut_.size();
+   void CContext::distributeFileOverMemoryBandwith(const vector<CFile*>& filesList, const string& poolId, const string& serviceId)
+   TRY
+   {
+     auto writers = getContextClient(poolId, serviceId) ;
+     int nbPools = writers.size();
+    
      double ratio=0.5 ;
      ratio=CXios::getin<double>("server2_dist_file_memory_ratio", ratio);
@@ -1591,5 +1724,5 @@
          }
        }
-       filesList[i]->setContextClient(writerClientOut_[files[i].assignedServer_]) ;
+       filesList[i]->setContextClient(poolId, serviceId, files[i].assignedServer_) ;
        delete [] files[i].assignedGrid_ ;
      }
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/node/context.hpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/node/context.hpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/node/context.hpp	(revision 2453)
@@ -103,11 +103,5 @@
          
          void initServer(MPI_Comm intraComm, int serviceType );
-         void createClientInterComm(MPI_Comm interCommClient, MPI_Comm interCommServer)  ;
- 
-         void createServerInterComm(void)  ;
-         void createServerInterComm_old(void)  ;
-         void createServerInterComm(const string& poolId, const string& serverId, vector<pair<string, pair<CContextClient*,CContextServer*>>>& clientServers ) ;
- 
-
+         
          bool isInitialized(void);
 
@@ -123,5 +117,4 @@
 
          bool isFinalized(void);
-
          void closeDefinition(void);
 
@@ -159,8 +152,9 @@
 
          // Distribute files (in write mode) among secondary-server pools according to the estimated data flux
-         void distributeFiles(const std::vector<CFile*>& files);
-         void distributeFileOverOne(const vector<CFile*>& files) ; //!< Distribute files over one single server (no distribution)
-         void distributeFileOverBandwith(const std::vector<CFile*>& files) ; //!< Distribute files overs servers to balance the I/O bandwith
-         void distributeFileOverMemoryBandwith(const std::vector<CFile*>& files) ; //!< Distribute files overs servers to minimize the memory consumption
+         void distributeFiles(const vector<CFile*>& files) ;
+         void distributeFilesOnSameService(const vector<CFile*>& files, const string& poolId, const string& serviceId) ;
+         void distributeFileOverOne(const vector<CFile*>& files, const string& poolId, const string& serviceId) ; //!< Distribute files over one single server (no distribution)
+         void distributeFileOverBandwith(const std::vector<CFile*>& files, const string& poolId, const string& serviceId) ; //!< Distribute files overs servers to balance the I/O bandwith
+         void distributeFileOverMemoryBandwith(const std::vector<CFile*>& files, const string& poolId, const string& serviceId) ; //!< Distribute files overs servers to minimize the memory consumption
          
        public:
@@ -271,8 +265,5 @@
          bool setProcessingEvent(void) {isProcessingEvent_=true ;}
          bool unsetProcessingEvent(void) {isProcessingEvent_=false ;}
-         MPI_Comm getIntraComm(void) {return intraComm_ ;}
-         int getIntraCommRank(void) {return intraCommRank_;}
-         int getIntraCommSize(void) {return intraCommSize_;}
-
+         
          void addCouplingChanel(const std::string& contextId, bool out) ;
 
@@ -310,7 +301,15 @@
 
       private:
-        std::string defaultReaderId ;
-        std::string defaultWriterId ;
-        std::string defaultGathererId ;
+        std::string defaultPoolWriterId_ ;
+        std::string defaultPoolReaderId_ ;
+        std::string defaultPoolGathererId_ ;
+        std::string defaultWriterId_ ;
+        std::string defaultReaderId_ ;
+        std::string defaultGathererId_ ;
+        bool defaultUsingServer2_ ;
+        void setDefaultServices(void) ;
+
+
+        std::map<std::pair<string,string>,std::vector<pair<CContextClient*,CContextServer*>>> serversMap_ ;
 
         std::vector<CContextClient*> writerClientOut_ ;
@@ -342,11 +341,19 @@
         std::map<std::string, CContextServer*> couplerInServer_ ;
       public:
+         void createClientInterComm(MPI_Comm interCommClient, MPI_Comm interCommServer)  ;
+         void createServerInterComm(void)  ; // obsolete
+         void createServerInterComm_old(void)  ;
+         void createServerInterComm(const string& poolId, const string& serverId, vector<pair<string, pair<CContextClient*,CContextServer*>>>& clientServers ) ;
+         void getServerInterComm(const string& poolId, const string& serviceId,  vector<pair<CContextClient*,CContextServer*>>& clientServers) ;
+         vector<CContextClient*> getContextClient(const string& poolId, const string& serviceId) ;
          CContextClient* getCouplerInClient(const string& contextId) { return couplerInClient_[contextId] ;}
          CContextServer* getCouplerInServer(const string& contextId) { return couplerInServer_[contextId] ;}
          CContextClient* getCouplerOutClient(const string& contextId) { return couplerOutClient_[contextId] ;}
          CContextServer* getCouplerOutServer(const string& contextId) { return couplerOutServer_[contextId] ;}
-
-         CRegistry* registryIn=nullptr ;    //!< input registry which is read from file
-         CRegistry* registryOut=nullptr ;   //!< output registry which will be written into file at the finalize
+       
+       public: // must be privatize using accessors
+        
+        CRegistry* registryIn=nullptr ;    //!< input registry which is read from file
+        CRegistry* registryOut=nullptr ;   //!< output registry which will be written into file at the finalize
 
 
@@ -354,5 +361,8 @@
         int intraCommRank_ ; //! context intra communicator rank
         int intraCommSize_ ; //! context intra communicator size
-        
+       public: 
+        MPI_Comm getIntraComm(void) {return intraComm_ ;}
+        int getIntraCommRank(void) {return intraCommRank_;}
+        int getIntraCommSize(void) {return intraCommSize_;}
       private:
          shared_ptr<CEventScheduler> eventScheduler_ ; //! The local event scheduler for context
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/node/file.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/node/file.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/node/file.cpp	(revision 2453)
@@ -26,5 +26,5 @@
       : CObjectTemplate<CFile>(), CFileAttributes()
       , vFieldGroup(), data_out(), enabledFields(), fileComm(MPI_COMM_NULL)
-      , isOpen(false), read_client(0), checkRead(false), allZoneEmpty(false)
+      , isOpen(false),  checkRead(false), allZoneEmpty(false)
    {
      setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group"));
@@ -35,5 +35,5 @@
       : CObjectTemplate<CFile>(id), CFileAttributes()
       , vFieldGroup(), data_out(), enabledFields(), fileComm(MPI_COMM_NULL)
-      , isOpen(false), read_client(0), checkRead(false), allZoneEmpty(false)
+      , isOpen(false), checkRead(false), allZoneEmpty(false)
     {
       setVirtualFieldGroup(CFieldGroup::create(getId() + "_virtual_field_group"));
@@ -1117,4 +1117,39 @@
    CATCH_DUMP_ATTR
 
+   void CFile::getWriterServicesId(bool defaultUsingServer2_, const string& defaultPoolWriterId_, const string& defaultWriterId_, const string& defaultPoolGathererId_, const string& defaultGathererId_,
+                                   bool& usingServer2, string& poolWriterId, string& writerId, string& poolGathererId, string& gathererId)
+   {
+     usingServer2 = defaultUsingServer2_ ;
+     poolWriterId = defaultPoolWriterId_ ;
+     writerId = defaultWriterId_ ;
+     poolGathererId = defaultPoolGathererId_ ;
+     gathererId = defaultGathererId_ ;
+
+     if (!using_server2.isEmpty()) usingServer2 = using_server2;
+     if (!pool_writer.isEmpty()) poolWriterId = pool_writer ;
+     if (!writer.isEmpty()) writerId = writer;
+     if (!pool_gatherer.isEmpty()) poolGathererId = pool_gatherer;
+     if (!gatherer.isEmpty()) gathererId = gatherer;
+   }
+
+   void CFile::getReaderServicesId(const string& defaultPoolReaderId_, const string& defaultReaderId_, string& poolReaderId, string& readerId)
+   {
+     poolReaderId = defaultPoolReaderId_ ;
+     readerId = defaultReaderId_ ;
+    
+     if (!pool_reader.isEmpty()) poolReaderId = pool_reader ;
+     if (!reader.isEmpty()) readerId = reader;
+   }
+
+   void CFile::setContextClient(const string& defaultPoolId, const string& defaultServiceId, int partitionId)
+   TRY
+   {
+     CContext* context = CContext::getCurrent();
+     vector<CContextClient*> clients = context->getContextClient(defaultPoolId, defaultServiceId) ;
+     setContextClient(clients[partitionId]) ;
+   }
+   CATCH_DUMP_ATTR
+
+
    void CFile::setContextClient(CContextClient* newContextClient)
    TRY
@@ -1136,18 +1171,5 @@
    CATCH_DUMP_ATTR
 
-   void CFile::setReadContextClient(CContextClient* readContextclient)
-   TRY
-   {
-     read_client = readContextclient;
-   }
-   CATCH_DUMP_ATTR
-
-   CContextClient* CFile::getReadContextClient()
-   TRY
-   {
-     return read_client;
-   }
-   CATCH_DUMP_ATTR
-
+   
    /*!
    \brief Send a message to create a field on server side
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/node/file.hpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/node/file.hpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/node/file.hpp	(revision 2453)
@@ -128,9 +128,14 @@
          CVariable* addVariable(const string& id = "");
          CVariableGroup* addVariableGroup(const string& id = "");
+         
+         
+         void getWriterServicesId(bool defaultUsingServer2_, const string& defaultPoolWriterId_, const string& defaultWriterId_, const string& defaultPoolGathererId_, const string& defaultGathererId_,
+                                  bool& usingServer2, string& poolWriterId, string& writerId, string& poolGathererId, string& gathererId) ;
+         void getReaderServicesId(const string& defaultPoolReaderId_, const string& defaultReaderId_, string& poolReaderId, string& readerId) ;
+ 
+
+         void setContextClient(const string& defaultPoolId, const string& defaultServiceId, int partitionId) ;
          void setContextClient(CContextClient* newContextClient);
          CContextClient* getContextClient();
-
-         void setReadContextClient(CContextClient* newContextClient);
-         CContextClient* getReadContextClient();
 
          // Send info to server         
@@ -192,5 +197,4 @@
          /// PropriÃ©tÃ©s privÃ©es ///
          CContextClient* client;
-         CContextClient* read_client; // Context client for reading (channel between server 1 and client)
          CFieldGroup* vFieldGroup;
          CVariableGroup* vVariableGroup;
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/node/node_enum.hpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/node/node_enum.hpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/node/node_enum.hpp	(revision 2453)
@@ -44,4 +44,5 @@
          eExtractDomain,
          ePoolNode,gPoolNode,
+         eServiceNode,gServiceNode,
 //         eService, gService
        } ENodeType;
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/node/node_type.hpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/node/node_type.hpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/node/node_type.hpp	(revision 2453)
@@ -34,4 +34,5 @@
 #include "extract_domain.hpp"
 #include "pool_node.hpp"
+#include "service_node.hpp"
 
 
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/node/pool_node.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/node/pool_node.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/node/pool_node.cpp	(revision 2453)
@@ -1,3 +1,5 @@
 #include "pool_node.hpp"
+#include "cxios.hpp"
+#include<cmath>
 
 namespace xios
@@ -5,8 +7,12 @@
   
   CPoolNode::CPoolNode(void) : CObjectTemplate<CPoolNode>(), CPoolNodeAttributes()
-  { /* Ne rien faire de plus */ }
+  { 
+    setVirtualServiceNodeGroup(CServiceNodeGroup::create(getId() + "_virtual_service_node_group"));
+  }
 
   CPoolNode::CPoolNode(const StdString & id) : CObjectTemplate<CPoolNode>(id), CPoolNodeAttributes()
-  { /* Ne rien faire de plus */ }
+  { 
+    setVirtualServiceNodeGroup(CServiceNodeGroup::create(getId() + "_virtual_service_node_group"));
+  }
 
   CPoolNode::~CPoolNode(void)
@@ -17,7 +23,46 @@
   {
     SuperClass::parse(node);
+    if (node.goToChildElement())
+    {
+      do
+      {
+        if (node.getElementName()=="service" || node.getElementName()=="service_group") this->getVirtualServiceNodeGroup()->parseChild(node);
+      } while (node.goToNextElement());
+      node.goToParentElement();
+    }
   }
 
-
+  void CPoolNode::allocateRessources(void)
+  {
+    int nonEmpty=0 ;
+    if (!nprocs.isEmpty()) nonEmpty++ ;
+    if (!global_fraction.isEmpty()) nonEmpty++ ;
+    if (!remain_fraction.isEmpty()) nonEmpty++ ;
+    if (!remain.isEmpty()) nonEmpty++ ;
+    if (nonEmpty==0) ERROR("void CPoolNode::allocateRessources(void)",<<"A number a ressource for allocate pool must be specified." 
+                           <<"At least attributes, <nprocs> or <global_fraction> or <remain_fraction> or <remain> must be specified")
+    else if (nonEmpty>1) ERROR("void CPoolNode::allocateRessources(void)",<<"Only one of these attributes : <nprocs> or <global_fraction>"
+                               <<" or <remain_fraction> or <remain> must be specified to determine allocated ressouces."
+                               <<" More than one is currently specified")
+    auto ressourcesManager=CXios::getRessourcesManager() ;
+    int nbRessources ;
+    int globalRessources = ressourcesManager->getRessourcesSize() ;
+    int freeRessources =   ressourcesManager->getFreeRessourcesSize() ;
+    if (!nprocs.isEmpty()) nbRessources = nprocs ;
+    if (!global_fraction.isEmpty()) nbRessources = std::round(globalRessources * global_fraction) ;
+    if (!remain_fraction.isEmpty()) nbRessources = std::round(freeRessources * remain_fraction) ;
+    if (!remain.isEmpty()) nbRessources = freeRessources ;
+    if (nbRessources>freeRessources)
+      ERROR("void CPoolNode::allocateRessources(void)",<<"Cannot allocate required ressources for the pool."
+                                                       <<"  Required is : "<<nbRessources<<"  but free ressource is currently : "<<freeRessources)
+    string poolId ;
+    if (!name.isEmpty()) poolId=name ;
+    else if (!hasAutoGeneratedId() ) poolId=getId() ;
+    else ERROR("void CPoolNode::allocateRessources(void)",<<"Pool has no name or id, attributes <id> or <name> must be specified")
+    ressourcesManager->createPool(poolId, nbRessources) ;
+    ressourcesManager->waitPoolRegistration(poolId) ;
+    auto services=this->getAllServiceNodes() ;
+    for(auto& service : services) service->allocateRessources(poolId) ;
+  }
 }
 
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/node/pool_node.hpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/node/pool_node.hpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/node/pool_node.hpp	(revision 2453)
@@ -10,4 +10,5 @@
 #include "group_factory.hpp"
 #include "declare_group.hpp"
+#include "service_node.hpp"
 
 
@@ -58,4 +59,11 @@
     public:
       virtual void parse(xml::CXMLNode & node);
+      void allocateRessources(void) ;
+
+    private:
+      std::vector<CServiceNode*> getAllServiceNodes(void) const {return this->vServiceNodeGroup->getAllChildren();}
+      CServiceNodeGroup* getVirtualServiceNodeGroup(void) const {return this->vServiceNodeGroup; }
+      void setVirtualServiceNodeGroup(CServiceNodeGroup* newVServiceNodeGroup) { this->vServiceNodeGroup = newVServiceNodeGroup; }
+      CServiceNodeGroup* vServiceNodeGroup;
 
   }; // class CPoolNode
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/node/service_node.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/node/service_node.cpp	(revision 2453)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/node/service_node.cpp	(revision 2453)
@@ -0,0 +1,65 @@
+#include "service_node.hpp"
+
+namespace xios
+{
+ 
+  CServiceNode::CServiceNode(void) : CObjectTemplate<CServiceNode>(), CServiceNodeAttributes()
+  { /* Ne rien faire de plus */ }
+
+  CServiceNode::CServiceNode(const StdString & id) : CObjectTemplate<CServiceNode>(id), CServiceNodeAttributes()
+  { /* Ne rien faire de plus */ }
+
+  CServiceNode::~CServiceNode(void)
+  { /* Ne rien faire de plus */ }
+
+
+  void CServiceNode::parse(xml::CXMLNode & node)
+  {
+    SuperClass::parse(node);
+  }
+
+  void CServiceNode::allocateRessources(const string& poolId)
+  {
+    int nonEmpty=0 ;
+    if (!nprocs.isEmpty()) nonEmpty++ ;
+    if (!global_fraction.isEmpty()) nonEmpty++ ;
+    if (!remain_fraction.isEmpty()) nonEmpty++ ;
+    if (!remain.isEmpty()) nonEmpty++ ;
+    if (nonEmpty==0) ERROR("void CServiceNode::allocateRessources(const string& poolId)",<<"A number a ressource for allocate service must be specified." 
+                           <<"At least attributes, <nprocs> or <global_fraction> or <remain_fraction> or <remain> must be specified")
+    else if (nonEmpty>1) ERROR("void void CServiceNode::allocateRessources(const string& poolId)",<<"Only one of these attributes : <nprocs> or <global_fraction>"
+                               <<" or <remain_fraction> or <remain> must be specified to determine allocated ressources."
+                               <<" More than one is currently specified")
+    auto servicesManager=CXios::getServicesManager() ;
+    auto ressourcesManager=CXios::getRessourcesManager() ;
+    int nbRessources ;
+    int globalRessources ;
+    ressourcesManager->getPoolSize(poolId, globalRessources) ;
+    int freeRessources ;
+    ressourcesManager->getPoolFreeSize(poolId, freeRessources ) ;
+    if (!nprocs.isEmpty()) nbRessources = nprocs ;
+    if (!global_fraction.isEmpty()) nbRessources = std::round(globalRessources * global_fraction) ;
+    if (!remain_fraction.isEmpty()) nbRessources = std::round(freeRessources * remain_fraction) ;
+    if (!remain.isEmpty()) nbRessources = freeRessources ;
+    if (nbRessources>freeRessources)
+      ERROR("void CServiceNode::allocateRessources(const string& poolId)",<<"Cannot allocate required ressources for the service."
+                                                       <<"  Required is : "<<nbRessources<<"  but free ressource is currently : "<<freeRessources)
+    if (nb_partitions.isEmpty()) nb_partitions=1 ;
+    if (nb_partitions > nbRessources) ERROR("void CServiceNode::allocateRessources(const string& poolId)",<<"Cannot allocate required ressources for the service."
+                                                       <<"  The number of service partition : < nb_partitions = "<<nb_partitions<<" > "
+                                                       <<"is greater than the required ressources required < nbRessources = "<<nbRessources<<" >")
+    
+    int serviceType ;
+    if (type.isEmpty()) ERROR("void CServiceNode::allocateRessources(const string& poolId)",<<"Service type must be specified")
+    if (type.getValue() == type_attr::writer) serviceType=CServicesManager::WRITER ;
+    else if (type.getValue() == type_attr::reader) serviceType=CServicesManager::READER ;
+    else if (type.getValue() == type_attr::gatherer) serviceType=CServicesManager::GATHERER ;
+
+    string serviceId ;
+    if (!name.isEmpty()) serviceId=name ;
+    else if (!hasAutoGeneratedId() ) serviceId=getId() ;
+    else ERROR("void CServiceNode::allocateRessources(const string& poolId)",<<"Service has no name or id, attributes <id> or <name> must be specified")
+    servicesManager->createServices(poolId, serviceId, serviceType, nbRessources, nb_partitions, true) ;
+  }
+
+}
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/node/service_node.hpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/node/service_node.hpp	(revision 2453)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/node/service_node.hpp	(revision 2453)
@@ -0,0 +1,69 @@
+#ifndef __XIOS_CServiceNode__
+#define __XIOS_CServiceNode__
+
+#include "xios_spl.hpp"
+#include "attribute_enum.hpp"
+#include "attribute_enum_impl.hpp"
+#include "attribute_array.hpp"
+#include "declare_attribute.hpp"
+#include "object_template.hpp"
+#include "group_factory.hpp"
+#include "declare_group.hpp"
+
+
+namespace xios
+{
+  /// ////////////////////// DÃÂ©clarations ////////////////////// ///
+
+  class CServiceNodeGroup;
+  class CServiceNodeAttributes;
+  class CServiceNode;
+  ///--------------------------------------------------------------
+
+  // Declare/Define CVarAttribute
+  BEGIN_DECLARE_ATTRIBUTE_MAP(CServiceNode)
+#include "service_attribute.conf"
+  END_DECLARE_ATTRIBUTE_MAP(CServiceNode)
+
+  ///--------------------------------------------------------------
+
+  class CServiceNode: public CObjectTemplate<CServiceNode>
+               , public CServiceNodeAttributes
+  {
+      friend class CCServiceNodeGroup;
+
+      /// typedef ///
+      typedef CObjectTemplate<CServiceNode>   SuperClass;
+      typedef CServiceNodeAttributes SuperClassAttribute;
+
+    public :
+
+      typedef CServiceNodeAttributes RelAttributes;
+      typedef CServiceNodeGroup      RelGroup;
+
+      /// Constructeurs ///
+      CServiceNode(void) ;
+      explicit CServiceNode(const StdString & id);
+      CServiceNode(const CServiceNode & var);       // Not implemented yet.
+      CServiceNode(const CServiceNode * const var); // Not implemented yet.
+   
+      /// Destructeur ///
+      virtual ~CServiceNode(void);
+     
+    public :
+      /// Accesseurs statiques ///
+      static StdString GetName(void)     { return StdString("service"); }
+      static StdString GetDefName(void)  { return StdString("service"); }
+      static ENodeType GetType(void)     { return eServiceNode; }
+    public:
+      virtual void parse(xml::CXMLNode & node);
+      void allocateRessources(const string& poolId) ;
+
+  }; // class CServiceNode
+  ///--------------------------------------------------------------
+
+  // Declare/Define CServiceNodeGroup and CServiceNodeDefinition
+  DECLARE_GROUP(CServiceNode);
+} // namespace xios
+
+#endif // __XIOS_CServiceNode__
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/object_factory_decl2.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/object_factory_decl2.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/object_factory_decl2.cpp	(revision 2453)
@@ -22,4 +22,5 @@
   macro(CExtractDomain)
   macro(CPoolNode)
+  macro(CServiceNode)
 }
 
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/object_factory_decl3.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/object_factory_decl3.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/object_factory_decl3.cpp	(revision 2453)
@@ -19,4 +19,5 @@
   macro(CZoomDomainGroup)
   macro(CPoolNodeGroup)
+  macro(CServiceNodeGroup)
 }
 
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/object_template_decl.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/object_template_decl.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/object_template_decl.cpp	(revision 2453)
@@ -37,4 +37,5 @@
   template class CObjectTemplate<CExtractDomain>;
   template class CObjectTemplate<CPoolNode>;
+  template class CObjectTemplate<CServiceNode>;
   
   template class CObjectTemplate<CContextGroup>;
@@ -69,4 +70,5 @@
   template class CObjectTemplate<CExtractDomainGroup>;
   template class CObjectTemplate<CPoolNodeGroup>;
+  template class CObjectTemplate<CServiceNodeGroup>;
 
 }
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/server.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/server.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/server.cpp	(revision 2453)
@@ -21,4 +21,5 @@
 #include "servers_ressource.hpp"
 #include "services.hpp"
+#include "pool_node.hpp"
 #include <cstdio>
 #include "workflow_graph.hpp"
@@ -188,27 +189,46 @@
       if (serversRessource->isServerLeader())
       {
-        int nbRessources = ressourcesManager->getRessourcesSize() ;
-        if (!CXios::usingServer2)
+        // creating pool
+        CPoolNodeGroup::get("xios","pool_definition")->solveDescInheritance(true) ;
+        vector<CPoolNode*> pools = CPoolNodeGroup::get("xios","pool_definition")->getAllChildren();
+        for(auto& pool : pools) pool->allocateRessources() ;
+        
+        int nbRessources = ressourcesManager->getFreeRessourcesSize() ;
+        if (nbRessources>0)
         {
-          ressourcesManager->createPool(CXios::defaultPoolId, nbRessources) ;
-          servicesManager->createServices(CXios::defaultPoolId, CXios::defaultWriterId, CServicesManager::WRITER,nbRessources,1) ;
-          servicesManager->createServicesOnto(CXios::defaultPoolId, CXios::defaultReaderId, CServicesManager::READER, CXios::defaultWriterId) ;
-        }
-        else
-        {
-          int nprocsServer = nbRessources*CXios::ratioServer2/100.;
-          int nprocsGatherer = nbRessources - nprocsServer ;
+          if (!CXios::usingServer2)
+          {
+            ressourcesManager->createPool(CXios::defaultPoolId, nbRessources) ;
+            ressourcesManager->waitPoolRegistration(CXios::defaultPoolId) ;
+            servicesManager->createServices(CXios::defaultPoolId, CXios::defaultWriterId, CServicesManager::WRITER,nbRessources,1) ;
+            servicesManager->createServicesOnto(CXios::defaultPoolId, CXios::defaultReaderId, CServicesManager::READER, CXios::defaultWriterId) ;
+          }
+          else
+          {
+            int nprocsServer = nbRessources*CXios::ratioServer2/100.;
+            int nprocsGatherer = nbRessources - nprocsServer ;
           
-          int nbPoolsServer2 = CXios::nbPoolsServer2 ;
-          if (nbPoolsServer2 == 0) nbPoolsServer2 = nprocsServer;
-          ressourcesManager->createPool(CXios::defaultPoolId, nbRessources) ;
-          servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultGathererId, CServicesManager::GATHERER, nprocsGatherer, 1) ;
-          servicesManager->createServicesOnto(CXios::defaultPoolId, CXios::defaultReaderId, CServicesManager::READER, CXios::defaultGathererId) ;
-          servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultWriterId, CServicesManager::WRITER, nprocsServer, nbPoolsServer2) ;
-
-
+            int nbPoolsServer2 = CXios::nbPoolsServer2 ;
+            if (nbPoolsServer2 == 0) nbPoolsServer2 = nprocsServer;
+            ressourcesManager->createPool(CXios::defaultPoolId, nbRessources) ;
+            ressourcesManager->waitPoolRegistration(CXios::defaultPoolId) ;
+            servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultGathererId, CServicesManager::GATHERER, nprocsGatherer, 1) ;
+            servicesManager->createServicesOnto(CXios::defaultPoolId, CXios::defaultReaderId, CServicesManager::READER, CXios::defaultGathererId) ;
+            servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultWriterId, CServicesManager::WRITER, nprocsServer, nbPoolsServer2) ;
+          }
         }
 //        servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultServicesId, CServicesManager::ALL_SERVICES, nbRessources, 1) ;
       }
+/*
+      MPI_Request req ;
+      MPI_Status status ;
+      MPI_Ibarrier(xiosGlobalComm,&req) ; // be sure that all services are created now, could be remove later if more asynchronisity
+      int ok=false ;
+      while (!ok)
+      {
+        daemonsManager->eventLoop() ;
+        MPI_Test(&req,&ok,&status) ;
+      }
+*/
       CTimer::get("XIOS initialize").suspend() ;
 
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/type/type_util.hpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/type/type_util.hpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/type/type_util.hpp	(revision 2453)
@@ -68,5 +68,7 @@
     class CPoolNode ;
     class CPoolNodeGroup ;
-     
+    class CServiceNode ;
+    class CServiceNodeGroup ;
+      
   template <typename T> inline string getStrType(void);
 
@@ -154,4 +156,6 @@
   macro(CPoolNode)
   macro(CPoolNodeGroup)
+  macro(CServiceNode)
+  macro(CServiceNodeGroup)
   
 #undef macro
Index: /XIOS3/dev/XIOS_FILE_SERVICES/src/xml_parser_decl.cpp
===================================================================
--- /XIOS3/dev/XIOS_FILE_SERVICES/src/xml_parser_decl.cpp	(revision 2452)
+++ /XIOS3/dev/XIOS_FILE_SERVICES/src/xml_parser_decl.cpp	(revision 2453)
@@ -43,4 +43,5 @@
     macro( ExtractDomain )
     macro( PoolNode )
+    macro( ServiceNode )
   }
 }
