안녕하세요.
SCN 1.8.4 로 서비스체인을 구성하였습니다.
그리고 nodejs + express + caver-js 로 SCN RPC node 와 통신하는 API 서버를 개발하였습니다.
저희 API 서버와 SCN RPC node 간의 트래픽이 증가 하면 어느 순간부터,
tcp connection(http) 이 계속 증가합니다. 이는 keepAlive 옵션이 기본으로 true 로 되기 때문인듯 합니다.
그런데 문제는 timeout 옵션을 주어도 변화가 없습니다.
const httpProv = new Caver.providers.HttpProvider(nodeURL,{timeout: 2000});
super(httpProv, httpOption)
여기 까지는 괜찮은데 문제는,
TCP connection 이 증가 하면서 동시에 API 서버, SCN Node 모두 부하가 증가 합니다.
SCN 쪽에 log 옵션을 5로 주고 로그를 확인해보았더니,
아래와 같이 엄청나게 많은 klay_GetTransactionReceipt 요청이
끊임없이 계속 이루어지고 있었습니다. (never ending…)
이미 저희 API 에서는 이미 모든 작업이 끝났는데도(?) 말이죠…
테스트로 저희 API 서버쪽에서 SCN RPC node 로 1000 개의 tx를 초당 10개씩 보내보았습니다.
그랬더니 transction receipt 를 못 받는게 몇개씩 생기더라구요…
이런게 누적이 되어서 몇일 지나면 서비스 중지 사태까지 발생합니다.
이 문제를 해결할 수 있는 방법이 있을까요?
참고로 caver-js 1.9.0, SCN 1.9 에서도 동일한 증상이 발생합니다.
그래서 지금 1주일 마다 API 서버를 재시작 하고 있습니다.ㅠ ㅠ
꼭 답변 부탁 드립니다.
RACE[09/20,02:03:05 Z] [39] Request info reqId=&14162549 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&14162557 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&14162560 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&14162558 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&14162564 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493005 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493006 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493012 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493015 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493019 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493024 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493031 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493029 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493036 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493039 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493045 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493049 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493054 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&10493056 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
INFO[09/20,02:03:05 Z] [50] Commit new mining work number=2910002 hash=5c5ca6…92d62c txs=0 elapsed=304.36µs commitTime=189.443µs finalizeTime=91.037µs
INFO[09/20,02:03:05 Z] [25] received more than 2f agreements and change state to prepared msgType=1 prepareMsgNum=3 commitMsgNum=0
INFO[09/20,02:03:05 Z] [24] Committed number=2910002 hash=22433a…76b348 address=0xb9B95b00EC5DCbD74cAEF7ECbF513e278f62f2E9
INFO[09/20,02:03:05 Z] [50] Successfully sealed new block number=2910002 hash=22433a…76b348
INFO[09/20,02:03:05 Z] [50] Successfully wrote mined block num=2910002 hash=22433a…76b348 txs=0 elapsed=444.876µs
INFO[09/20,02:03:05 Z] [50] Mining too far in the future wait=1s
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&13692544 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&13692549 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&12077297 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&13692556 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&12077298 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt
TRACE[09/20,02:03:05 Z] [39] Request info reqId=&12077300 reqErr=nil isUnsubscribe=false reqMethod=klay_GetTransactionReceipt