Too many closed ports on production

I just migrated my production code to play 2.5.18 from play 2.2.3.

We are maintaining two prod server for now. One for the older version, one for the newer.
While things seems normal on the older server, I am able to see too many closed ports on the newer server.
First we thought, it might be due to Sql connections not getting closed Didn’t help.
I guess, it is due to netty not closing the sockets.
Can someone help?

Total: 94834 (kernel 0)
TCP: 94738 (estab 338, closed 94145, orphaned 0, synrecv 0, timewait 12/0), ports 0

94738 connections in less than 12 hours of deployment. It is a big worry.

Hi @asinha07, in the absence of any configuration settings on your play server, it could be difficult to know, but prima facie appears it may have something to do with the default keep alive settings on the netty server.

Check the keep alive config here.
https://www.playframework.com/documentation/2.5.x/ProductionConfiguration#Server-configuration-options

Cheers
Aditya

I am using the default settings. We haven’t overriden any of the netty’s default configuration.

The default keep alive setting seems to be off as per the default configuration. You could try and turn keep alive true on one of the play hosts in your system so as to allow keep sockets open. You can then keep a tab on that host, and see if you still see the issue.

Cheers

@asinha07, are you able to reproduce this problem on a non-production server? Hopefully you can, and since Play 2.5 has AkkaHttp as an alternative to Netty (experimental as I recall), you can try to switch to use that and see if you observe the same problem. This way, you can at least either confirm or eliminate Netty as the cause of the issue.

1 Like