Re: perl multithreading performance
- From: Ted Zlatanov <tzz@xxxxxxxxxxxx>
- Date: Wed, 27 Aug 2008 16:06:37 -0500
On Wed, 27 Aug 2008 12:59:36 -0700 (PDT) dniq00@xxxxxxxxx wrote:
d> What the script does is for each line it checks if the line contains
d> GET request, and if it does - goes through a list of pre-compiled
d> regular expressions, trying to find a matching one. Once the match is
d> found - it uses another regexp, associated with the found match, which
d> is a bit more complex, to extract data from the line. I have split it
d> in two separate matches, because about 30% of all lines will match,
d> and I don't want to run that complex regexp to extract data for all
d> the lines I know won't match. The goal is to count how many lines
d> matched for every specific regexp, and the end result is built as a
d> hash, having data, extracted from the line with second regexp, used as
d> hash keys, and the value is the number of matches.
d> Anyway, currently all this is done in a single process, which parses
d> approx. 30000 lines per second. The CPU usage for this process is
d> 100%, so the bottleneck is in the parsing part.
....
d> Everything works fine, HOWEVER! It's all so damn slow! It's only 10%
d> faster than single-process script, consumes about 2-3 times more
d> memory and about as much times more CPU.
....
d> Any ideas why in the world it's so slow? I did some research and
d> couldn't find a lot of info, other than the way I do it pretty much
d> the way it should be done, unless I'm missing something...
You may be hitting the limits of I/O. Try feeding your script
pre-canned data from memory in a loop and see if that improves
performance. It also depends on what kind of processing you are doing
on input lines.
Also, check out the swatch log file monitor, it may do what you need
already.
Ted
.
- Follow-Ups:
- Re: perl multithreading performance
- From: dniq00
- Re: perl multithreading performance
- References:
- perl multithreading performance
- From: dniq00
- perl multithreading performance
- Prev by Date: Re: subprocesses lifecycle
- Next by Date: Re: perl multithreading performance
- Previous by thread: Re: perl multithreading performance
- Next by thread: Re: perl multithreading performance
- Index(es):
Relevant Pages
|