in reply to A simple web server with HTTP::Daemon and threads

Hi there,

I'm trying to implement a very simple HTTP server for my own client. I tried the example provided. Unfortunately, it is still leaking as bad as 100 megabytes for 100-200 requests. It's also very slow processing requests even when it returns the very same file every time. I'm stuck. Please help! Any ideas what to change?

I'm trying to run it on Windows and FreeBSD. On Windows platform it has a bug described here HTTP::Daemon not working in threads? regarding stuck threads.

I'm using apache2(worker-mpm)/mod_perl2/perl(threads) right now to run my server-side script. Its performance is not what I expect even after numerous optimizations. That's why I was trying to implement a simple server to process these requests. But right now it's 10(ten) times slower than the current system.

Thank you!
  • Comment on Re: A simple web server with HTTP::Daemon and threads

Replies are listed 'Best First'.
Re^2: A simple web server with HTTP::Daemon and threads
by zwon (Abbot) on Feb 07, 2010 at 18:37 UTC

    It's hard to expect that HTTP server rewritten in Perl will have better performance than apache. Are you sure that the problem is in apache and not in your scripts? If your script often returns the same data, you can improve performance by placing reverse proxy in front of apache, nginx is widely used for this purpose.

      I was experimenting with threads in Perl. And Apache/mod_perl seemed to be an overkill for such a simple request/response script - that's why I tried to implement it purely in Perl. Of course, the main problem is DB requests. Though, apache/mod_perl takes a tremendous amount of memory. Anyway, I kept on using apache/mod_perl and got rid of DB requests at all. I stopped using mysql to keep my data and switched to memcachedb (not memcache but memcachedb). Still have this problem with memory leaks when using threads in perl. Lucky me, I don't experiment with it anymore. Thank you!