in reply to TCP Socket, Forking, Memory exhaustion

You could use threads instead of forked processes, that should decrease memory usage.

If you don't want to rebuild a complete server infrastructure and you have high demand, maybe you could reuse Apache 2. Apache 2 is a server framework with a http server plugged in (roughly spoken). You could insert your own server plugin there.

Or maybe you could tell us what you need that server for, maybe there is an easier way that reuses another server application.

  • Comment on Re: TCP Socket, Forking, Memory exhaustion

Replies are listed 'Best First'.
Re^2: TCP Socket, Forking, Memory exhaustion (threads)
by tye (Sage) on Nov 07, 2007 at 15:39 UTC
    You could use threads instead of forked processes, that should decrease memory usage.

    To follow that advice also requires not using Perl. Because Perl's idea of "threads" actually uses more memory than forking (on systems that support real forking not fork emulated using Perl threads, obviously). Perl threads also use the extra memory less efficiently, greatly increasing the cost of thread creation (and destruction).

    For this situation, switching to Perl threads would have significant disadvantages and no advantages.

    Yes, I realize that you are suggesting using something other than a Perl script as the heart of the server infrastructure. But I felt that your opening sentence required some clarification since it is the completely wrong approach when dealing with a server written in Perl, and that wasn't made clear.

    - tye