danielbenny has asked for the wisdom of the Perl Monks concerning the following question:
With the following call I'm able to write one million messages to my logging infrastructure --> ./benchmark.pl 127.0.0.1 514 1000000 This takes about 50 seconds (depending on the logging software) which results in a throughput of 20000 messages per second. Other benchmark tools have a higher throughput and a lower CPU consumption. How can I optimize my script?#! /usr/bin/perl use strict; use warnings; use Sys::Syslog qw(:standard :macros setlogsock); die "Usage: $0 <host> <port> <count>\n" unless @ARGV == 3; my ($host, $port, $count) = @ARGV; my ($sender, $program) = ("localhost","loggenerator"); setlogsock({ type => "tcp", host => "$host", port => "$port" }); openlog("$sender $program", 'pid,noeol,ndelay'); syslog('info', "This is my $_ test message!" ) for (1 .. $count); closelog();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How can I optimize my script?
by kennethk (Abbot) on May 04, 2017 at 00:03 UTC | |
|
Re: How can I optimize my script?
by Discipulus (Canon) on May 03, 2017 at 20:07 UTC | |
by Anonymous Monk on May 03, 2017 at 20:09 UTC | |
|
Re: How can I optimize my script?
by Anonymous Monk on May 03, 2017 at 19:50 UTC | |
by danielbenny (Initiate) on May 03, 2017 at 20:02 UTC | |
|
Re: How can I optimize my script?
by marioroy (Prior) on Jul 10, 2017 at 05:58 UTC |