My company uses FastCGI, which has been annoying me, so I have written my own version of FastCGI entirely in perl. A daemon is created, children are spawned, calls come in with the proper environment and output is stuffed back through a socket, relatively simple stuff.

Now, what I am wondering; Is there a better way to do it?

Obviously, for separate servers, sockets are still the way to go. But we have fcgis that we call for data, which are usually on the same system. Is there a better way than a socket to make calls of unknown size on a local system? I have tried UNIX domain sockets, which seem to improve the connection some, but nothing remarkable.

Also, just using sockets I have been playing around. One way to connect is through a C program that you call through the shell, another is a perl module that does a pure perl connect, and the third is to wrap the C code from the program in a SWIG module. I have done all three, and they seem to have improved speed respectively, however... the perl wrapped C module takes the same time in real seconds as the pure perl module, but less system time (according to Benchmark). Am I missing something? Unless there is a noticable difference I am more inclined to travel the pure perl route.

Does anyone have any suggestions as to other approaches I might investigate? I'm running low on ideas...

                - Ant
                - Some of my best work - (1 2 3)


In reply to Fastest way to talk to a perl daemon by suaveant

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.