[Israel.pm] Building a threaded server using Perl?
yuval at windax.com
Sun May 30 02:47:40 PDT 2004
I wrote a few servers that currently handle a few hundreds of users
without a problem.
I use IO::Select which, as far as I understand, will make everything
really slow once the server hits bigger loads.
My company wants me to make sure everything is "future-proof", so once
we have more clients per server - things will stay smooth.
I can't stress test my server like I wish I could, because we're talking
about imitating large amounts of data - which should always vary
(otherwise I ignore it :) also hashes won't grow, etc).
Basically I have a main hash (usually 2 or 3, actually) where I keep all
the data from all the connections I have.
There's some sort of CLI (accessable via telnet) which shows all
info/stats from all current connections (read: I sum up the info from
I open 3 separate ports (1 for clients, 1 for some admin program that
some guy wrote a long time ago, before I even joined this company [over
2 years now :)], 1 for CLI).
My main questions:
1) Are threads in Perl reliable enough (under Linux, if it matters)?
2) Why should/shouldn't I rewrite my servers?
3) In what way should I write a threaded server (thread per client?
thread for read and thread for write per client?)?
4) Any problems letting all threads access a main (shared...) hash? I
must show summary and it's very easy with Perl's data-structures.
5) Your experiences & examples are more than welcome :)
More information about the Perl