The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Nice Exim

Discussion in 'Workarounds and Optimization' started by mikelegg, Nov 12, 2010.

  1. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    Is it possible/advisable to run Exim (or to be more precise, the user "mailnull") with a low priority using Nice or would this interfere with normal mail delivery?
     
    #1 mikelegg, Nov 12, 2010
    Last edited: Nov 12, 2010
  2. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    I spoken to my server admins and they've pointed out that when mail is sent there's a separate exim process for each email. There's no way to set the nice value to all the exim processes that will run.

    But what we're going to try is setting up a cron job that will run each minute and re-nice all the currently running processes.

    The reason I'm looking in to this is try to lessen the impact on CPU resources when customers send out mail to their subscriber lists.
     
  3. syslint

    syslint Well-Known Member

    Joined:
    Oct 9, 2006
    Messages:
    249
    Likes Received:
    6
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Do you have any type spaming issue in your sever ? May be you need to consider setting sending limit for emails per hour
     
  4. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    We have a 500 email per hour limit in case a users webmail form is exploited, but even with that limit in place, one of our customers with a legitimate mailing list really hammers the server when he does his mailouts (even though they're queued in batches to get under the 500/hour limit).

    I really noticed it yesterday because they included a pdf attachment with their mailout.

    I'll ask their web developer to have a look at the code - perhaps the mailouts can be done in smaller batches.

    I wrote a mailout script for a customer who has thousands of subscribers on his list and it sends them out in batches of 40 every 5 minutes and it hardly has any effect on cpu load.

    I just wanted to explore some options of controlling this on the server itself, rather than relying on the customer to do things right.
     
  5. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    This is one reason why it would be good if cPanel could integrate with a separate mail server (like it does with MySQL).

    Then load spikes on the mail server wouldn't interfere with httpd and other services.
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    There are actually options you can add for exim configuration in the WHM > Exim Configuration > Advanced Editor area in the topmost box that would either reduce, suspend or control connections when the machine has a high load. I'm going to mention them for informational purposes in case you want to consider using the settings. The issue I see with a cron job to renice the processes is that they are short-term processes and the cron has it's own activity to renice, so you are actually trading exim process activity for a cron that might well cause load itself.

    queue_only_load = #

    This value will only queue mails when the load is at or below the value placed. Let's say you put 10 into the queue_only_load option, then when load is over 10, messages in the queue will wait for delivery until the load is at or below 10.

    Another delivery load option is the following:

    deliver_queue_load_max = #

    Here, no deliveries are performed for queue runs when the load is above the number specified. The queue runner will check the load periodically and abandon delivery if the load is above that number.

    Another configuration option you might consider is this one:

    smtp_accept_queue = #

    This is the number of simultaneous incoming SMTP connections that are accepted for the queue run delivery. The default is unlimited to allow immediate delivery for all messages, so you could limit the number allowed, then those connections exceeding the limit will be placed in the queue and left for the next queue runner.
     
  7. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    Thanks Tristan

    That's very helpful information.

    I've already abandoned the cron job idea because it only renices the processes that are active at the exact moment that it runs. All the processes that are created in the other 59 seconds of the minutes are unaffected.
     
Loading...

Share This Page