fork, select & socket performance ?

Ned Konz ned at bike-nomad.com
Tue Feb 18 17:25:54 UTC 2003


On Tuesday 18 February 2003 07:32 am, Ragnar Hojland Espinosa wrote:
> Another basic question I'd love some orientation with:
>
> I have a little question on fork permormance.  In my little TCP/IP
> program I plan to have, roughly:
>
>      - listener process
>        put new client socket in a shared queue
>
>      - other process
>        read-block on listener shared queue
>        fork a reader and a writer for each client
>
> Given I can have over 500 clients at a time, with bursts of about
> 60 new clients / second , will all this forking be ok?  Or should I
> build a, say, 100 process pool and reuse them?  Or is there a
> better way to do it?

Creating them on the fly should be fine. Processes are very 
lightweight.

> Another thing, what class should I look at if I want to do
> something like select, either C or even perlish?
>
> 	$read_fds = IO::Select->new();
> 	$read_fds->add ($socket);
>
> 	my @read_set = $read_fds->can_read;
> 	foreach my $read_socket (@read_set) {
> 		# ...
> 	}

It's a better match for the architecture and Squeak socket API to have 
a single Process per socket.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE



More information about the Squeak-dev mailing list