내 플레이! 2.1 Rest API App New Relic을 설치했습니다.비동기 무시 재생 대기! 새 유물의 스칼라 앱
내 컨트롤러의 모든 동작은 응답의 미래에 시간 초과를 추가하는 메서드에서 상속됩니다. 그러한 메소드가 20 초보다 오래 걸리면 요청이 종료되고 결과는 5XX 오류입니다.
코드는 기본적으로 이것이다 :
는val timeout = 20
action(request).orTimeout(
name + " backend timed-out after "+timeout+" seconds", timeout * 1000).map {
resultOrTimeout => { //... process response or timeout with fold
제가하는 데 문제는 새로운 유물의 데이터를 분석 할 때, 임지고 있다는 것을 항상 20 초 평균 응답 시간.
추적을 보면 새로운 유물이 시간 초과 함수를 응답 컨테이너로 해석한다는 것을 알 수 있습니다.
Slowest components Count Duration %
Async Wait 7 20,000 ms 100%
Action$$anonfun$apply$1.apply() 2 2 ms 0%
PlayDefaultUpstreamHandler$$an....apply() 1 1 ms 0%
PlayDefaultUpstream....$$anonfun$24.apply() 1 1 ms 0%
SmaugController$class.akkify() 1 0 ms 0%
PlayDefaultUpstreamHandler.handleAction$1() 1 0 ms 0%
Total 20,000 ms 100%
내가 그 시간 제한을 고려에서 새로운 유물을 방지 할 수있는 방법이 있나요 ?
감사합니다.
편집 : 당신이 볼 수 있듯이, 실제 작업은 107 밀리 초 걸리는 akkify 방법에서 수행되고
Duration (ms) Duration (%) Segment Drilldown Timestamp
20,000 100.00% HttpRequestDecoder.unfoldAndFireMessageReceived()
20,000 100.00% Async Wait
Stack trace
scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:23)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1146)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615)
java.lang.Thread.run (Thread.java:679)
107 0.53% SmaugController$class.akkify()
가, 나머지는 모두에 의해 소비되고있다 : 나는 더 많은 정보를 얻을 수있는 거래를 확대 비동기 대기 호출
에서 Play 2.1.1과 함께 끝났습니다. 중요한 것은 Promise.timeout 및 Future.firstCompletedOf 메서드입니다. Action.async 메서드는 새 유물이 시간을 올바르게보고하는 데 필요하지 않았습니다. – dgrandes