Scala Akka/Spray CPU使用率为100%
我在Spary中创建了一个非常基本的Restful服务。在当地,一切正常 但是当我将它部署到服务器(2核)上时,我看到CPU使用率达到了100% 当我尝试启动应用程序时,使用率在几秒钟内达到100%。当我向服务端点发送任何请求时,CPU使用率在几分钟内达到100%的峰值 请参阅下面的代码Scala Akka/Spray CPU使用率为100%,scala,akka,spray,Scala,Akka,Spray,我在Spary中创建了一个非常基本的Restful服务。在当地,一切正常 但是当我将它部署到服务器(2核)上时,我看到CPU使用率达到了100% 当我尝试启动应用程序时,使用率在几秒钟内达到100%。当我向服务端点发送任何请求时,CPU使用率在几分钟内达到100%的峰值 请参阅下面的代码 object Boot { def main(args: Array[String]): Unit = { implicit val system = ActorSystem("on-spray-can")
object Boot {
def main(args: Array[String]): Unit = {
implicit val system = ActorSystem("on-spray-can")
val service = system.actorOf(Props[AuditorServiceActor], "AuditorActor")
val config = ConfigFactory.load()
implicit val timeout = Timeout(120.seconds)
IO(Http) ? Http.Bind(service, config.getString("http.interface"), config.getInt("http.port"))
}
}
class AuditorServiceActor extends Actor with AuditorService {
def actorRefFactory = context
def receive = runRoute(myRoute)
}
您应该发布
myRoute
的内容,因为它可能包含很多逻辑,问题可能就在这里。您应该发布myRoute
的内容,因为它可能包含很多逻辑,问题可能就在这里。