ultrachrome has asked for the wisdom of the Perl Monks concerning the following question:
I have a script that reads Wireshark decoded output via a pipe, parses, and loads it into a MySQL table.
My current method involves writing the parsed delimited records to a file and then doing a "load data infile" to load MySQL.
This method is 50% faster than directly inserting each parsed record via DBI.
To make this even faster, I thought I'd like to try writing/loading data through a FIFO as shown on MySQL's LOAD DATA INFILE Syntax page but I can't seem to open the FIFO.
From the command line or within perl, I can create the FIFO with no problem. What I can't do is open it using either open or sysopen, the latter method taken directly from the named pipes example in Programming Perl.
The script just hangs at that point with no error.
I made the following example that simply opens then closes the fifo and it also hangs. It prints the warning but never returns a prompt
my $fifo = "fifo"; require POSIX; POSIX::mkfifo($fifo, 0666) or die "can't mknod $fifo: $!"; warn "$0: created $fifo as named pipe\n"; sysopen(FIFO, $fifo, O_WRONLY) or die "can't write $fifo: $!"; close FIFO;
I'm running this on Ubuntu 8.04 but I've also tried the code on Solaris 10 x86 with the same result.
Any guidance greatly appreciated. thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trouble opening FIFO for speedy MySQL loading
by Illuminatus (Curate) on Nov 04, 2008 at 03:12 UTC | |
by ultrachrome (Initiate) on Nov 04, 2008 at 17:51 UTC | |
by Illuminatus (Curate) on Nov 04, 2008 at 18:03 UTC |