instances=unlimited -- oops

Forum for getting help with Project Gamera, Spamassassin, Clamav, qmail-scanner and other anti-spam tools.
faris
Long Time Forum Regular
Long Time Forum Regular
Posts: 2321
Joined: Thu Dec 09, 2004 11:19 am

instances=unlimited -- oops

Unread post by faris »

Just a reminder/tip in case it helps someone:

One of the first things I usually do when setting up a Plesk server that uses qmail is to change instances=unlimited to something sensible in /etc/xinetd.d/smtp_psa

On our current batch of installations, I negelcted to do that even though it is in the checklist.

Anyway, for about an hour a day, a botnet has been using a domain we host as a fake from address on their crap, so a lot of bounces have been hitting our systems.

It didn't cause any significant issues until just now, when the load on two of them passed 100 and things started to fall over from the sheer number of spamassassin and clamav processes that were tryin to run at the same time.

Setting instances=2 (until things settle) and restarting xinetd fixed the probem immediately.

I'm surprised this hasn't happened in the past, to be honest. But I rather suspect this particular botnet has just gone into overdrive or is using this domain more.

I'll also have to check their SPF records -- not sure if they have created any - this domain belongs to a very nice, tech-savvy customer who has set most thing up themselves. I'm not sure if the SPF records will do much good in this instance but we'll see.
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>
biggles
Forum Regular
Forum Regular
Posts: 806
Joined: Tue Jul 15, 2008 2:38 pm
Location: Sweden
Contact:

Re: instances=unlimited -- oops

Unread post by biggles »

How many instances do you normally run?


edit:
I also fount the setting
per_source = 1
in another thread: https://www.atomicorp.com/forum/viewtop ... 90fa307f81
prupert
Forum Regular
Forum Regular
Posts: 573
Joined: Tue Aug 01, 2006 2:45 pm
Location: Netherlands

Re: instances=unlimited -- oops

Unread post by prupert »

You can also limit based on the load average. However, please do note that these changes are overwritten by Plesk during upgrades. It would be ideal if Plesk added a feature to control these settings (as well as IMAP/POP limits) via the admin panel.

Code: Select all

	max_load        = 6
	per_source      = 2
	instances       = 50
Lemonbit Internet Dedicated Server Management
faris
Long Time Forum Regular
Long Time Forum Regular
Posts: 2321
Joined: Thu Dec 09, 2004 11:19 am

Re: instances=unlimited -- oops

Unread post by faris »

We usually use 10. But it depends on how busy your system is.
I suspect you could set it much lower.

Personally I'd set it to as low as you can go at a peak time of day without seeing a warning about limits beinf reached in /var/log/messages, then maybe add 2 to that figure. Keep an eye on things and as long as you don't see any limit reached messages too often, then that's probably as high as you want to go.

If you end up adding lots of new users on that system and the rate of incoming email increases, you may need to increase by 1 or 2.

Restart xinetd for these changes to come into effect.

The setting for load is very useful but I suspect it may not prevent an out of memory (or low memory) condition.

The instances value is, in a way, akin to the maxclients setting in Apache. You can set it surprisingly low since there tends not to be as many connections in one instant as you might imagine. Of course with qmail, unlike Apache, the process can sometimes be tied up for 5 to 10 seconds while spamassassin/clamav and various dnsbl checks do their thing, so in this case you may need a higher figure than you might think at first.
Last edited by faris on Fri Mar 08, 2013 8:06 am, edited 1 time in total.
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>
biggles
Forum Regular
Forum Regular
Posts: 806
Joined: Tue Jul 15, 2008 2:38 pm
Location: Sweden
Contact:

Re: instances=unlimited -- oops

Unread post by biggles »

Thanks! Will give it a try!
Post Reply