@Override public void run() { try { this.isAlive = true; LOG.info("rdma storage server started, address " + serverAddr + ", persistent " + RdmaConstants.STORAGE_RDMA_PERSISTENT + ", maxWR " + datanodeGroup.getMaxWR() + ", maxSge " + datanodeGroup.getMaxSge() + ", cqSize " + datanodeGroup.getCqSize()); while(true){ RdmaEndpoint clientEndpoint = datanodeServerEndpoint.accept(); allEndpoints.put(clientEndpoint.getEndpointId(), clientEndpoint); LOG.info("accepting client connection, conncount " + allEndpoints.size()); } } catch(Exception e){ e.printStackTrace(); } this.isAlive = false; }
@Override public void run() { try { InetSocketAddress addr = CrailUtils.getNameNodeAddress(); namenodeServerEp.bind(addr, DaRPCConstants.NAMENODE_DARPC_BACKLOG); LOG.info("opened server at " + addr); while (true) { DaRPCServerEndpoint<DaRPCNameNodeRequest, DaRPCNameNodeResponse> clientEndpoint = namenodeServerEp.accept(); LOG.info("accepting RPC connection, qpnum " + clientEndpoint.getQp().getQp_num()); } } catch(Exception e){ e.printStackTrace(); LOG.error(e.getMessage()); } }
private void run() throws Exception { System.out.println("ReadServer, size " + size + ", loop " + loop); RdmaServerEndpoint<ReadServerEndpoint> serverEndpoint = group.createServerEndpoint(); InetAddress ipAddress = InetAddress.getByName(host); InetSocketAddress address = new InetSocketAddress(ipAddress, port); serverEndpoint.bind(address, 10); ReadServer.ReadServerEndpoint endpoint = serverEndpoint.accept(); System.out.println("ReadServer, client connected, address " + address.toString()); //let's send a message to the client //in the message we include the RDMA information of a local buffer which we allow the client to read using a one-sided RDMA operation System.out.println("ReadServer, sending message"); endpoint.sendMessage(); //we have to wait for the CQ event, only then we know the message has been sent out endpoint.takeEvent(); //let's wait for the final message to be received. We don't need to check the message itself, just the CQ event is enough. endpoint.takeEvent(); System.out.println("ReadServer, final message"); //close everything endpoint.close(); serverEndpoint.close(); group.close(); }
InetSocketAddress address = new InetSocketAddress(ipAddress, port); serverEndpoint.bind(address, 10); SendRecvServer.SendRecvEndpoint endpoint = serverEndpoint.accept(); System.out.println("SendRecvServer, client connected, address " + address.toString());
SendRecvServer.CustomServerEndpoint clientEndpoint = serverEndpoint.accept();
ReadServer.CustomServerEndpoint endpoint = serverEndpoint.accept(); System.out.println("ReadServer::connection accepted ");
public void runRDMA() throws Exception { //we can accept new connections SendRecvServer.CustomServerEndpoint clientEndpoint = serverEndpoint.accept(); //we have previously passed our own endpoint factory to the group, therefore new endpoints will be of type CustomServerEndpoint System.out.println("RDMAvsTcpBenchmarkServer::client connection accepted"); //in our custom endpoints we have prepared (memory registration and work request creation) some memory buffers beforehand. ByteBuffer sendBuf = clientEndpoint.getSendBuf(); sendBuf.asCharBuffer().put("PONG"); ByteBuffer recvBuf = clientEndpoint.getRecvBuf(); SVCPostSend postSend = clientEndpoint.postSend(clientEndpoint.getWrList_send()); SVCPostRecv postRecv = clientEndpoint.postRecv(clientEndpoint.getWrList_recv()); for (int i = 0; i < loopCount + 1; i++){ // Recv PING postRecv.execute(); clientEndpoint.getWcEvents().take(); recvBuf.clear(); //Send PONG postSend.execute(); clientEndpoint.getWcEvents().take(); sendBuf.clear(); } clientEndpoint.close(); serverEndpoint.close(); endpointGroup.close(); }