I have a script that connects to a Postgres DB and writes data. Simple enough - however, this script will be run from multiple hosts and send loads of data.

I would like to toy with compressing the data to save on some network bandwidth and came across dbiproxy. I have dbiproxy running on the DB host and my script connecting to it successfully on the client hosts. However, when I attempt to add compression, I have failures.

I am running the dbiproxy thusly:

/usr/bin/dbiproxy --debug --configfile proxy_postgres.cfg --compression gzip

My script is connecting as such:

$dsn = 'DBI:Proxy:hostname=build;port=12400;compression=gzip;dsn=DBI:P +g:'; $db_user = 'foo'; $db_pass = 'bar'; $dbh = DBI->connect($dsn, $db_user,$db_pass, {RaiseError => 1});

From dbiproxy, I get:

err, Child died: Unexpected EOF from client at /usr/lib/perl5/vendor_perl/5.8.8/RPC/PlServer.pm line 146

I've stepped through the dbiproxy and it appears that when I have compression set, it attempts to uncompress every single message that comes through the socket, including the 'connect'. However, I can't find any mention of compressing in DBI, DBD::Pg, etc.

I've played around with a couple of versions of the components (perl 5.8.8/DBI 1.50 and perl 5.8.7/DBI 1.48).

The man page for dbiproxy and DBI::ProxyServer don't mention compression either, though dbiproxy's help option lists it.

Frankly, the only place I have seen this mentioned is in O'Reilly's Programming with DBI book and some sundry Google hits.

My question? Is this supposed to work? Is there an alternative?


In reply to dbiproxy and compression by bcrust

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.