comparing kernel socket performance
Perry Harrington
pedward@sun4.apsoft.com
Fri, 4 Sep 1998 17:08:16 -0400
>
> > }Well, the fundamental problem there is that it's hard to expand the #
> > }of fd's available to a process. That alone disqualifies Linux for use
> > }by most big IRC servers.
>
> > You're saying that echo value > /proc/... or a recompile is "hard"?
>
> The # of fd's available to the entire system can be increased by
> echoing values to /proc. That's easy.
>
> On most Unixes, you can make one syscall and up your # of fd's per
> process to 1024 or 4096 or more. That's easy and standard.
>
> In Linux, upping the # of fd's available to invididual processes
> involves a kernel recompile, and a glibc recompile, and then all
> processes get larger. This is not what I would call "easy". Um, do you
> also have to recompile all RPMS? I'd have to think about that.
You are mistaken. Only a kernel and (application which uses > 1024 fds) recompile
is neccessary to take advantage of thousands of descriptors.
There is a patch available for 2.0.33 for Squid which allows you to have an
arbitrary number of descriptors. 4096 per process is typically the sane upper
limit, probably because of page size limits (FD_SET array occupies one page max).
On alpha this is probably 8192. The patch uses malloc to allocate the FD arrays,
rather than statically allocating them.
I have yet to see an application that could use > 4096 descriptors, and be properly
written.
Squid is unique in that it has cached fd's for files and it has sockets. IRC servers
are mainly socket bound. This can be gotten around by simply writing the code correctly;
meaning, use shared memory segments or unix domains sockets to share common data, then
run multiple processes in accept-on-common-fd and select loops. (or SIGIO/SIGPOLL driven
I/O).
If I was inclined to care, I'd write an IRC server the *right* way rather than
the pseudo-college-student-Eric-Allman-wannabe-hacker way.
>
> -- g
>
--Perry
--
Perry Harrington Linux rules all OSes. APSoft ()
email: perry@apsoft.com Think Blue. /\