I have 2 perl applications running on different hosts which need to send information (perl hashes) from one to another. What is the best way to do this?
Here's what I have implemented as a prototype:
Application A takes a constant stream of log data, cooks it (into perl hashes) and writes them to an ascii file in JSON format. This is done in one POE session. Another POE session that is also running is POE::Component::Server::TCP, which listens for Application B to connect and when it does, will send the JSON data out in an ASCII TCP payload in addition to writing it to the file.
Application B is using POE::Component::Client::TCP to connect to application A and start the data coming in. It also is running a Perl-Tk GUI as a second POE Session to display and help the user analyze the data.
I'm not completely happy with this solution, and would like to explore other options. What would some good choices be?
One obvious problem with this solution is transmitting the data in ASCII. This was convenient because it was how I was saving the data to the output file (so I could look at it with an editor, or feed the file to application B, for debugging purposes). Now I'd like to be a bit smarter by saving/transmitting the data in a more compact form (saving disk space and communications bandwidth). What would be best here (I've used FreezeThaw.pm before - is there something better/different)? The only requirement is that I have to be able to easily reconstitute the original hash containing the data.
Another problem with this solution seems to be that application B runs somewhat slowly. I'm guessing that having the TCP client and Perl-Tk sessions running in the same process is what slows things down. I wonder if things would run faster if the TCP client was in its own process (writing output to a local file), and application B simply used something like POE::Wheel::FollowTail to import the data for the GUI?
Following this train of thought a bit more, I could eliminate all the TCP communication altogether if application A simply wrote the output file, and application B simply tailed the file remotely via ssh or NFS mounted the filesystem and tailed it locally.
Then I started thinking that sending data structures between perl scripts running on different machines might be something so commonly done that there already is a module that will do all this for you. Using all my searching expertise on CPAN, I failed to find anything like this. Am I missing something?
Any help is much appreciated!
-Craig
In reply to Cross-Host Data Transmission by cmv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |