Difference between revisions of "Imap connections"
(3 intermediate revisions by the same user not shown) | |||
Line 19: | Line 19: | ||
Feb 6 11:18:28 weasel imapd: Maximum connection limit reached for ::ffff:10.0.0.66 | Feb 6 11:18:28 weasel imapd: Maximum connection limit reached for ::ffff:10.0.0.66 | ||
Feb 6 11:18:28 weasel imapd: Maximum connection limit reached for ::ffff:10.0.0.66 | Feb 6 11:18:28 weasel imapd: Maximum connection limit reached for ::ffff:10.0.0.66 | ||
+ | </pre> | ||
+ | |||
+ | This shows which clients are holding onto connections: | ||
+ | <pre> | ||
+ | root@weasel:/etc/init.d# netstat -n |grep :143 | sort -k +4 | ||
+ | </pre> | ||
+ | Count which ones are in the ESTABLISHED state: | ||
+ | <pre> | ||
+ | netstat -n |grep :143 | grep ESTAB | sort -k +4 | wc | ||
+ | </pre> | ||
+ | or | ||
+ | <pre> | ||
+ | lsof -i :143 | wc | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | When my phone is connecting through the telco network instead of wifi, the connection looks like this: | ||
+ | Verizon (myvzw.com) | ||
+ | tcp6 0 242 216.99.216.99:143 70.199.228.147:11752 ESTABLISHED | ||
+ | T-Mobile (tmodns.net) | ||
+ | tcp6 0 0 216.99.216.99:143 208.54.32.249:64691 ESTABLISHED | ||
+ | |||
+ | This shows the processes: | ||
+ | <pre> | ||
+ | root@weasel:/etc/init.d# ps -eaf | grep imapd | wc | ||
+ | 39 397 3487 | ||
+ | </pre> | ||
+ | |||
+ | <h3>Why?</h3> | ||
+ | I know we have a lot of devices laying around. But what changed? Did the clients change or did the server change? | ||
+ | |||
+ | <h3>Raise the limits</h3> | ||
+ | http://kb.mediatemple.net/questions/259/How+can+I+raise+Courier-IMAP+connections+for+my+server%3F | ||
+ | |||
+ | Immediately after raising the limit and restarting imap, I had 13 active connections, all in the established state. | ||
+ | A nexus tablet had the most connections open, 4. The other clients had one or two. | ||
+ | |||
+ | <pre> | ||
+ | root@weasel:/etc/courier# grep MAX imapd | ||
+ | ##NAME: MAXDAEMONS:0 | ||
+ | MAXDAEMONS=80 | ||
+ | ##NAME: MAXPERIP:0 | ||
+ | MAXPERIP=40 | ||
</pre> | </pre> |
Latest revision as of 20:55, 1 June 2013
Running out of imapd connections
The problem looks like this from xymon:
yellow Wed Feb 6 11:02:18 2013 imap NOT ok Service imap on localhost is not OK : Unexpected service response Seconds: 0.000132
And clients see intermittent errors trying to connect.
And syslog shows this:
Feb 6 11:18:20 weasel imapd: 40 maximum active connections. Feb 6 11:18:20 weasel imapd: Maximum connection limit reached for ::ffff:10.0.0.66 Feb 6 11:18:23 weasel imapd: last message repeated 3 times Feb 6 11:18:28 weasel imapd: Maximum connection limit reached for ::ffff:10.0.0.66 Feb 6 11:18:28 weasel imapd: Maximum connection limit reached for ::ffff:10.0.0.66
This shows which clients are holding onto connections:
root@weasel:/etc/init.d# netstat -n |grep :143 | sort -k +4
Count which ones are in the ESTABLISHED state:
netstat -n |grep :143 | grep ESTAB | sort -k +4 | wc
or
lsof -i :143 | wc
When my phone is connecting through the telco network instead of wifi, the connection looks like this:
Verizon (myvzw.com)
tcp6 0 242 216.99.216.99:143 70.199.228.147:11752 ESTABLISHED
T-Mobile (tmodns.net)
tcp6 0 0 216.99.216.99:143 208.54.32.249:64691 ESTABLISHED
This shows the processes:
root@weasel:/etc/init.d# ps -eaf | grep imapd | wc 39 397 3487
Why?
I know we have a lot of devices laying around. But what changed? Did the clients change or did the server change?
Raise the limits
http://kb.mediatemple.net/questions/259/How+can+I+raise+Courier-IMAP+connections+for+my+server%3F
Immediately after raising the limit and restarting imap, I had 13 active connections, all in the established state. A nexus tablet had the most connections open, 4. The other clients had one or two.
root@weasel:/etc/courier# grep MAX imapd ##NAME: MAXDAEMONS:0 MAXDAEMONS=80 ##NAME: MAXPERIP:0 MAXPERIP=40