Current time: 04-24-2024, 09:36 PM Hello There, Guest! (LoginRegister)


Post Reply 
ispcp-vrl-traff improvement
Author Message
Nathariel Offline
Junior Member
*

Posts: 11
Joined: Jan 2009
Reputation: 0
Post: #1
ispcp-vrl-traff improvement
Hey all.

I would like to propose an enhancement for ispcp-vrl-traff script, because it is unable to handle large files and could easily crash heavy loaded servers.

The problem is in the gen_log_file function and the way that it creates the temp .diff files when comparing new and .prev logs. Currently, this is done by the following line:

Code:
diff_command("$main::cfg{'CMD_DIFF'} -a $dest_file $dest_file_prev | $main::cfg{'CMD_EGREP'} '^<' | $main::cfg{'CMD_SED'} 's/^< //' 1> $log_file");

Behind the diff stands the problem with the LCS and no matter how optimized the algorithm is, it needs a big amount of memory. I am not going into details what needs diff to do in order to compare two large files but the memory usage is enormous.

Thus, when we have heavily loaded web servers and log processing, this could crash the log processing server, eating all its memory in a second. (Upon such cases,and if the system is still alive, the kernel starts killing processes with higher memory usage - mysql, apache...are the first to be brought down...)

When we speak about high loaded web and mail servers, the fast log rotation is not enough and such a resource waste should be addressed.

I have written a small enhancement which creates a local file db with the last read positions of all logs. Upon invoking, it checks this position and seeks to it in the new log file. After that it reads to the end and writes the output in the temp .diff file.

The operation is more CPU intensive and has almost no memory overhead.

I am attaching a patch with the differences between the original and modified ispcp-vrl-traff,the look of the new gen_log_function and the FSM logic.
I have also submitted a ticket about this issue: http://www.isp-control.net/ispcp/ticket/1623

The algorithm could be improved a little more, but I have tried to save the old function as much as I can.

Please feel free to test / improve this workaround.


Attached File(s) Thumbnail(s)
   

.txt  ispcp-vrl-traff.diff.txt (Size: 5.4 KB / Downloads: 9)
(This post was last modified: 02-10-2009 03:26 AM by Nathariel.)
01-23-2009 09:07 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
ispcp-vrl-traff improvement - Nathariel - 01-23-2009 09:07 PM
RE: ispcp-vrl-traff improvement - rkhalil - 02-07-2009, 11:47 PM
RE: ispcp-vrl-traff improvement - rkhalil - 02-11-2009, 06:55 AM
RE: ispcp-vrl-traff improvement - vetch101 - 03-10-2009, 06:15 PM
RE: ispcp-vrl-traff improvement - vetch101 - 03-10-2009, 07:59 PM
RE: ispcp-vrl-traff improvement - vetch101 - 03-24-2009, 12:12 AM
RE: ispcp-vrl-traff improvement - RatS - 02-10-2009, 06:43 PM
RE: ispcp-vrl-traff improvement - Zothos - 03-10-2009, 06:36 PM
RE: ispcp-vrl-traff improvement - Zothos - 03-24-2009, 04:00 AM
RE: ispcp-vrl-traff improvement - BeNe - 03-24-2009, 04:50 PM
RE: ispcp-vrl-traff improvement - javierxd - 12-02-2011, 03:57 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)