I have a Play! application running for a while and it seems to work fine. But every now and then, some calls to the server get delayed for no apparent reason. I have a simple "ping" endpoint that returns a "text/plain" response: "pong".
def ping = Action {
Ok("pong")
}
Most of the times this responds quickly. But sometimes the page hangs in white and after a minute and a half, the response is shown in the page. After several attempts to reproduce I managed to record the network calls in Firefox's developer tools and I see that the call is fast as usual but the "DOMContentLoaded" event happens later:
It happens randomly, but I managed to reproduce more often when I just started the PC or when using the Private Browsing. I could reproduce both in the production environment and running locally.
Edit: I found that the time that the server is waiting to respond is the idle timeout
. So, I could reduce the pain with this configuration:
play {
server {
http {
idleTimeout = 10 seconds
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.