in reply to Re: POE Question
in thread POE Question

Thanks, Maybe I just hack at poe to change it to a bigger buffer read size. I have to assume then that POE's write is to the length(buffer). Thanks for the info

Replies are listed 'Best First'.
Re^3: POE Question
by BrowserUk (Patriarch) on Jul 09, 2004 at 00:00 UTC

    I'm assuming that this enquiry is related to this one?

    If so, I'm far from convinced that making the buffer bigger will help any with that problem. Maybe you should simply accumulate the reads untill you have as much as you need before sending it on?

    With respect to writing, the SysRW pod says this:

    =head1 DESIGN NOTES Driver::SysRW uses a queue of output messages. This means that BLOCK_SIZE is not used for writing. Rather, each message put() through the driver is written in its entirety (or not, if it fails). This often means more syswrite() calls than necessary, however it makes memory management much easier.

    It might be worth your time reading the POD of some of the inner classes. It might suggest better ways of achieving your goal.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon
      No, I have nothing to do with that node. I am new to Perl everything.

      But I do see what that peron is getting at, if POE reads in only 64k at a time and someone is send a 200k packet. Then POE is needlessly reading ~3 times to do a one time write. Not really efficient.

      But then again I know nothing of Perl and really don't understand why the company wants to go this route instead of our traditional Delphi solutions.

        POE::Driver::SysRW's constructor lets you set the read block size. You can make it as large as sysread() supports. Do realize that reading 200KB at a time means that your program will consume some multiple of that while the data is moving around in memory. Remember to multiply that by the number of concurrent connections you expect.

        POE::Component::Server::TCP does not expose POE::Driver::SysRW's constructor parameters. It is designed for the 80-90% of applications that don't need special tuning. People writing special-case software are encouraged to use the lower-level modules that offer a lot more tuning: POE::Wheel::SocketFactory (for the TCP server); POE::Wheel::ReadWrite (for the client/server interaction); POE::Filter::Line (which supports many different line separators, or some other filter); and POE::Driver::SysRW (to tune block sizes).

        You might also want to look at POE::Wheel::ReadWrite's flow control facilities. They'll help tune the memory/buffer size tradeoff on the write side of things.

        Finally, it's important to remember that these classes are written in Perl. If one doesn't do what you want, subclass it. Or send the author a patch. Or write your own replacements. If they share the core POE::Kernel library, your own classes will work happily beside the ones already written.

        -- Rocco Caputo - http://poe.perl.org/