???????????????????????
?????????????
????????????????????110ms
????100??????????????????????????????
???????????:
????????????????
????Cpu?4??? 2400mhz
?????????cpu: 4??? 3000Mhz
????????????
?????????10?????????????????μ?tps
????Tps:554????
?????????Cpu:30%
?????????cpu??230%
?????÷????????
?????????????????
?????÷????????
????1. Socket????????????????????socket?????????????????socket???仺????
?????????岻??????????????????????
????2. ???????????ζ??????????????socket??accept??close????
????3.???????????????μ?tcp?????????Э??????tcp??????????
????4.tcp?????????TCP ?????????????????? TCP ???????????age????TCP ???????????????????“??г”????????????????????????????????????????????????????????????????г????? TCP ???????slow start???????????????????
????????????? ??
????tcp????????????
???????????????????

???????socket????????????????????????????
??????е??response??????????????????????????
????????????????????????????????????????????????????????????????????
????????????????????????У????jdbc?????????????
?????????????????tps??1000????????????????1000
????????????????????5?????????????????????150????
??????????????????????????????????????????????150????+5????*2
????=160????????????????????????1??????????2??????????tps?2
?????????tps??1000??????????????500?????????????????????????????????????????
???????÷??????????????????????
????????????
????mina??session.write()??receive???????????????????????????????????????????
????????????
/**
* ?????????
*/
private static BlockingQueue<Connection> idlePool = new LinkedBlockingQueue<Connection>();
/**
* ????е??????
*/
public static BlockingQueue<Connection> activePool = new LinkedBlockingQueue<Connection>();
public static Connection getConn() throws InterruptedException{
long time1 = System.currentTimeMillis();
Connection connection = null;
connection = idlePool.take();
activePool.add(connection);
long time2 = System.currentTimeMillis();
//log.info("?????????:"+(time2-time1));
return connection;
}
????????????
public TransInfo send(TransInfo info) throws InterruptedException {
Result result = new Result();
//???tcp????
Connection connection = ConnectFutureFactory.getConnection(result);
ConnectFuture connectFuture = connection.getConnection();
IoSession session = connectFuture.getSession();
session.setAttribute("result"?? result);
//???????
session.write(info);
//?????????????
TransInfo synGetInfo = result.synGetInfo();
//?????????????????????????????????????
ConnectFutureFactory.close(connection??result);
return synGetInfo;
}
???????????????????????
public synchronized TransInfo synGetInfo() {
//??????????
//????????????????????
if (!done) {
try {
wait();
} catch (InterruptedException e) {
log.error(e.getMessage()?? e);
}
}
return info;
}
public synchronized void synSetInfo(TransInfo info) {
this.info = info;
this.done = true;
notify();
}