<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[iRedMail — Too many connections]]></title>
	<link rel="self" href="http://www.iredmail.org/forum/feed-atom-topic329.xml" />
	<updated>2009-10-14T09:57:52Z</updated>
	<generator>PunBB</generator>
	<id>http://www.iredmail.org/forum/topic329-too-many-connections.html</id>
		<entry>
			<title type="html"><![CDATA[Re: Too many connections]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1518.html#p1518" />
			<content type="html"><![CDATA[<p>Hi, me again.</p><p>I saw this in postmaster&#039;s logwatch:<br /></p><div class="codebox"><pre><code>mysql query failed: MySQL server has gone away : 71 Time(s) 
problem talking to service rewrite: Connection reset by peer : 72 Time(s)
problem talking to service rewrite: Success : 5034 Time(s)
see http://www.postfix.org/STRESS_README.html for examples of stress-adapting configuration settings : 1 Time(s)
service &quot;smtp&quot; (25) has reached its process limit &quot;100&quot;: new clients may experience noticeable delays : 1 Time(s)
to avoid this condition, increase the process count in master.cf or reduce the service time per client : 1 Time(s)</code></pre></div><p>The link above (<a href="http://www.postfix.org/STRESS_README.html">http://www.postfix.org/STRESS_README.html</a>) is very interesting and is appliable to postfix 2.5.9. I&#039;m talking especially about automatic stress-adaptive behavior. Quote:<br /></p><div class="codebox"><pre><code>smtpd_timeout = ${stress?10}${stress:300}s
smtpd_hard_error_limit = ${stress?1}${stress:20}
smtpd_junk_command_limit = ${stress?1}${stress:100}</code></pre></div><p>Are these safe for current iRedOS? Did you test them to see if they work ok? And if they do, where should I put them, master.cf or main.cf? I&#039;m asking that because the page above says they should be in main.cf, but I see some of them in master.cf in iRedOS.</p><p>Thanks!</p>]]></content>
			<author>
				<name><![CDATA[maxie_ro]]></name>
				<uri>http://www.iredmail.org/forum/user381.html</uri>
			</author>
			<updated>2009-10-14T09:57:52Z</updated>
			<id>http://www.iredmail.org/forum/post1518.html#p1518</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Too many connections]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1500.html#p1500" />
			<content type="html"><![CDATA[<p>Many high-load sites runs MySQL, and it works fine. So i think that&#039;s not the point.</p><p>I will make iRedMail use proxymap in 0.5.1 by default, so that we can reduce server load average in high-load server.</p><p>Thanks for your feedback. <img src="http://www.iredmail.org/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2009-10-13T13:54:18Z</updated>
			<id>http://www.iredmail.org/forum/post1500.html#p1500</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Too many connections]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1498.html#p1498" />
			<content type="html"><![CDATA[<p>I also think it would be a better idea to use PostgreSQL instead of MySQL. It&#039;s a lot more stable and resilient. I saw web servers with mysql locking with low load, while postgresql can withstand 1000 times more...</p>]]></content>
			<author>
				<name><![CDATA[maxie_ro]]></name>
				<uri>http://www.iredmail.org/forum/user381.html</uri>
			</author>
			<updated>2009-10-13T13:50:22Z</updated>
			<id>http://www.iredmail.org/forum/post1498.html#p1498</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Too many connections]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1496.html#p1496" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>maxie_ro wrote:</cite><blockquote><p>Do you think proxymap could be a future solution if this happens again?</p></blockquote></div><p>I think it can solve similar issue, refer to postfix maunal page: proxymap(8) (<a href="http://www.postfix.org/proxymap.8.html">http://www.postfix.org/proxymap.8.html</a>).<br /></p><div class="quotebox"><blockquote><p>o&nbsp; &nbsp; &nbsp; To consolidate the number of open lookup tables&nbsp; by<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sharing&nbsp; one&nbsp; open&nbsp; table among multiple processes.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For example, making mysql&nbsp; connections&nbsp; from&nbsp; every<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Postfix daemon process results in &quot;too many connec-<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tions&quot; errors. The solution:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; virtual_alias_maps =<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy:mysql:/etc/postfix/virtual_alias.cf</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The total number of connections is limited&nbsp; by&nbsp; the<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; number of proxymap server processes.</p></blockquote></div><p>Maybe we should change all LDAP/MYSQL lookup into proxymap to avoid similar issues.</p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2009-10-13T13:43:38Z</updated>
			<id>http://www.iredmail.org/forum/post1496.html#p1496</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Too many connections]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1495.html#p1495" />
			<content type="html"><![CDATA[<p>There is nothing in mysqld.log, besides the usual things. Mysqld was running at below 5% CPU usage, memory usage below 10%. But the maillog filled with 4 MB of log data in only 15 minutes, all with the same errors. All tables in vmail are ok (I checked integrity).</p><p>After setting the parameters like above, everything was fine again in 1-2 minutes, no more errors. But that &quot;rush-hour thing&quot; was realy strange.</p><p>Do you think proxymap could be a future solution if this happens again?<br />My.cnf is right now like this, do you think it&#039;s ok?:<br /></p><div class="codebox"><pre><code>mysqld]
bind-address            = 127.0.0.1
port                    = 3306
default-character-set   = utf8
datadir                 = /var/lib/mysql
socket                  = /var/lib/mysql/mysql.sock
user                    = mysql

# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

skip-locking
skip-bdb
#skip-networking

query-cache-type    = 1
query-cache-size    = 64M
query_cache_limit   = 10M

thread_cache_size   = 8

max_connections=1000
wait_timeout = 60
connect_timeout = 60
#set-variable = max_connect_errors=150

#ssl-ca =
ssl-cert = /etc/pki/tls/certs/iRedMail_CA.pem
ssl-key = /etc/pki/tls/private/iRedMail.key
ssl-cipher = ALL

key_buffer = 64M
max_allowed_packet = 4M
table_cache = 265
read_buffer_size = 8M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 32M
thread_concurrency = 8

[client]
default-character-set=utf8

[mysql.server]
user        = mysql
basedir     = /var/lib

[mysqld_safe]
log-error   = /var/log/mysqld.log
pid-file    = /var/run/mysqld/mysqld.pid</code></pre></div>]]></content>
			<author>
				<name><![CDATA[maxie_ro]]></name>
				<uri>http://www.iredmail.org/forum/user381.html</uri>
			</author>
			<updated>2009-10-13T13:30:08Z</updated>
			<id>http://www.iredmail.org/forum/post1495.html#p1495</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Too many connections]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1493.html#p1493" />
			<content type="html"><![CDATA[<p>Could you please check MySQL server status and try to find out why it was gone way?</p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2009-10-13T13:17:51Z</updated>
			<id>http://www.iredmail.org/forum/post1493.html#p1493</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Too many connections]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1491.html#p1491" />
			<content type="html"><![CDATA[<p>Still getting<br /></p><div class="codebox"><pre><code>Oct 13 15:29:32 mx2 postfix/cleanup[22911]: warning: 5AE142C1010C: virtual_alias_maps map lookup problem for postmaster@mx2.mydsl.ro
Oct 13 15:30:07 mx2 postfix/cleanup[22911]: warning: mysql query failed: MySQL server has gone away</code></pre></div><p>ETC.</p><p>max_connections set at 1000, timeouts at 60 sec...</p>]]></content>
			<author>
				<name><![CDATA[maxie_ro]]></name>
				<uri>http://www.iredmail.org/forum/user381.html</uri>
			</author>
			<updated>2009-10-13T12:34:05Z</updated>
			<id>http://www.iredmail.org/forum/post1491.html#p1491</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Too many connections]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1490.html#p1490" />
			<content type="html"><![CDATA[<p>Hello.</p><p>I found the mail service down today with errors in maillog:<br /></p><div class="codebox"><pre><code>Oct 13 13:51:35 mx2 postfix/master[2975]: warning: process /usr/libexec/postfix/trivial-rewrite pid 16373 exit status 1
Oct 13 13:51:35 mx2 postfix/smtpd[14931]: warning: problem talking to service rewrite: Success
Oct 13 13:51:35 mx2 postfix/master[2975]: warning: process /usr/libexec/postfix/trivial-rewrite pid 16374 exit status 1
Oct 13 13:51:35 mx2 postfix/smtpd[14932]: warning: problem talking to service rewrite: Success
[........]
Oct 13 13:52:36 mx2 postfix/trivial-rewrite[16477]: warning: connect to mysql server 127.0.0.1: Too many connections
Oct 13 13:52:36 mx2 postfix/trivial-rewrite[16477]: warning: connect to mysql server 127.0.0.1: Too many connections
Oct 13 13:52:36 mx2 postfix/trivial-rewrite[16477]: fatal: mysql:/etc/postfix/mysql_virtual_alias_maps.cf(0,lock|fold_fix): table lookup problem
Oct 13 13:52:36 mx2 postfix/trivial-rewrite[16478]: warning: connect to mysql server 127.0.0.1: Too many connections
Oct 13 13:52:36 mx2 postfix/trivial-rewrite[16478]: warning: connect to mysql server 127.0.0.1: Too many connections
Oct 13 13:52:36 mx2 postfix/trivial-rewrite[16478]: fatal: mysql:/etc/postfix/mysql_virtual_alias_maps.cf(0,lock|fold_fix): table lookup problem
[..............]</code></pre></div><p>I guess these are from max_connections in my.cnf right? I set the limit to 1000, but I&#039;m wondering why it crashed so soon already. There are not many mailboxes right now, just about 200 (and around 1000 more to import from the old server...). Should I check something?</p><p>Also, googling around, I saw &quot;proxymap&quot; might be a solution to this. Would it work with iRedOS?</p><p>Thanks.</p>]]></content>
			<author>
				<name><![CDATA[maxie_ro]]></name>
				<uri>http://www.iredmail.org/forum/user381.html</uri>
			</author>
			<updated>2009-10-13T12:12:22Z</updated>
			<id>http://www.iredmail.org/forum/post1490.html#p1490</id>
		</entry>
</feed>
