Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 23rd August 2006, 12:42
locosoft locosoft is offline
Junior Member
 
Join Date: Jun 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using Nice in cronjob mail_logs.php

Hello,

Hope this is the right place to post this (can't post in Developer forum).

We have a small server running ISPconfig (192Mb ram, PII 350Mhz cpu).
The system is almost always on 100% cpu-usage.
It is only used as a mailserver and DNS-server.

It seems that most of the processortime (78%) is needed by a grep process.
I traced it back to a grep command inside ~/ispconfig/scripts/shell/mail_logs.php.

I edited this file and added "nice 10" before every grep command I could find. (lines 89 and 94).

I hope this will be a bit nicer on our server tomorrow :-)

Pieter van der Eems
Reply With Quote
  #2  
Old 24th August 2006, 18:20
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,853
Thanks: 781
Thanked 1,558 Times in 1,477 Posts
Default

Can you post your changed file here (as a reference for other people)?
__________________
Falko
--
Follow me on:
Reply With Quote
  #3  
Old 29th September 2006, 13:57
lorello lorello is offline
Junior Member
 
Join Date: Mar 2006
Location: Vicopisano, Pisa, Italy
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I have a similar problem with a Dell Poweredge 2850 (2 Xeon 3GHz, 2Mb cache, 2Gb ram, 2 Mirrored SCSI disks).

We have a big mail traffic, and our mail log file is 3/4Gb each day.
In these conditions mail_logs.php script is active 24/24h, taking 99.9% of each CPU.

I've modified crontab:

Code:
# ISPConfig
30 00 * * * /usr/bin/nice -n 17 /root/ispconfig/php/php /root/ispconfig/scripts/shell/logs.php &> /dev/null
59 23 * * * /usr/bin/nice -n 17 /root/ispconfig/php/php /root/ispconfig/scripts/shell/ftp_logs.php &> /dev/null
59 23 * * * /usr/bin/nice -n 16 /root/ispconfig/php/php /root/ispconfig/scripts/shell/mail_logs.php &> /dev/null
59 23 * * * /usr/bin/nice -n 17 /root/ispconfig/php/php /root/ispconfig/scripts/shell/cleanup.php &> /dev/null
0 4 * * * /usr/bin/nice -n 17 /root/ispconfig/php/php /root/ispconfig/scripts/shell/webalizer.php &> /dev/null
0,30 * * * * /usr/bin/nice -n 17 /root/ispconfig/php/php /root/ispconfig/scripts/shell/check_services.php &> /dev/null
15 3,15 * * * /usr/bin/nice -n 17 /root/ispconfig/php/php /root/ispconfig/scripts/shell/quota_msg.php &> /dev/null
40 00 * * * /usr/bin/nice -n 17 /root/ispconfig/php/php /root/ispconfig/scripts/shell/traffic.php &> /dev/null
05 02 * * * /usr/bin/nice -n 17 /root/ispconfig/php/php /root/ispconfig/scripts/shell/backup.php &> /dev/null
*/5 * * * * /usr/bin/nice -n 17 /root/ispconfig/php/php /root/ispconfig/scripts/shell/mysql_quota.php &> /dev/null
0 10 * * * /usr/bin/nice -n 17 /root/ispconfig/php/php /root/ispconfig/scripts/shell/check_mx.php
but this is not a solution.
Reading the code of mail_logs i thought that I could modify it to analyze a domain each time, without running multiple processess.
Is there some other optimization that I can try to implement?

What about rewriteing the code in pure PHP, using some regexp, instead of external programs?
I suppose the script should make statistics about:
- traffic made from each domain and codomain
- add to it traffic of each user (?), stored in /home/admispconfig/mailstats/USERNAME
- store this value in some mysql table

Thanks for any info,
l.
Reply With Quote
  #4  
Old 1st October 2006, 01:10
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,853
Thanks: 781
Thanked 1,558 Times in 1,477 Posts
Default

The easiest solution would be to disable mail_logs.php (if you don't need email traffic statistics).
__________________
Falko
--
Follow me on:
Reply With Quote
  #5  
Old 22nd February 2007, 17:19
lorello lorello is offline
Junior Member
 
Join Date: Mar 2006
Location: Vicopisano, Pisa, Italy
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default mail_logs.php optimization

I've optimized last year the script /root/ispconfig/scripts/shell/mail_logs.php, but I've never posted to the forum. I do it now, some other mailserver with high traffic (and so, big log files) could need it.

The optimization I've done is very simple: I've moved some grep outside the loop that cycle over all sites of ISPConfig, reducing the size of the file analyzed in the loop from 4Gb to less than 1Gb. This simple change reduce the exectution time on my server from more than 24h to less than one hour
Attached Files
File Type: txt mail_logs_optimized.txt (7.2 KB, 151 views)
Reply With Quote
  #6  
Old 25th February 2007, 08:55
djtremors djtremors is offline
Senior Member
 
Join Date: Apr 2006
Location: Sydney
Posts: 236
Thanks: 0
Thanked 6 Times in 6 Posts
Default

I have a script which processes lines like a "tail -f" command and splits up the line details as required for processing.
Originally this was going to be for webstats traffic graphs like MRTG but traffic per website, but after thinking about it I thought AWstats is doing this pretty much anyway even though this script would be 5 minute graphs and aborted the idea for now.

This script could also do the mail logs actively during the day saving the huge processing at night to do it during the day instead and process as it comes in and store in memory for XX given lines/minutes before logging it per site.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
nice thing XGL .. rayit Suggest HOWTO 6 4th February 2007 14:03
Ver nice work, but ftp didnt work deb1an Installation/Configuration 3 24th July 2006 12:05
Nice Resource phoenixshard Forum Suggestions 0 22nd February 2006 18:57
Nice site! mike Smalltalk 2 23rd January 2006 17:46
nice article about security (paranoia ? ) Tenaka Smalltalk 1 23rd October 2005 14:24


All times are GMT +2. The time now is 06:32.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Sponsored Links: Unified Communications: Thoughts, Strategies and Predictions
Join the discussion.
www.seamlessenterprise.com

IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com

Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com

Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com

Red Hat Virtual Experience - a free virtual event. Dec. 9th