TCP/IP TIME-WAITE state and 500 database connections per second

Take a look into TIME-WAIT (sometimes spelled like TIME_WAIT by netstat utility) TCP/IP state:

https://tools.ietf.org/html/rfc793

http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-and-scalable-servers.html

Net effect of how TCP/IP protocol works is that one client can generate about 500 database connections per second and then it [client] will hit OS limit. The number 500 comes from 30K ports available / 60 TIME-WAIT seconds.

Who would do that in the database world you may ask. Answer: if it can be done it will be done. I personally came across 3 applications in the last month doing exactly that, one finally hit the 30K connections limit in TIME-WAIT state.

Truth be told those were MySQL applications. MySQL is pretty forgiving when it comes to 500 connects/disconnects per second, but a) MySQL is Oracle now b) not a big deal to do the same on Oracle RDBMS either.

Btw, sometimes the situation can be both masked (and saved) by forcing local connections which bypass the TCP/IP stack. In that case all works fine till some part of application starts using TCP/IP.

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s