httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Андрей Чернов <>
Subject Re: "locale" project
Date Fri, 19 Dec 1997 19:06:51 GMT
On Fri, 19 Dec 1997, Dean Gaudet wrote:

> > > A big worry here is that setlocale() is an expensive function.  On
> > > Solaris, for example, it involves reading a file off disk.  So we can't
> > > just switch locales at will.  It's unfortunate, but it's not possible for
> > > a POSIX program to exist in two locales at once.
> > 
> > One of the ways can be fork as many times as locales used and do all
> > locale-specific work in subprocesses.
> This is apache we're talking about, performance is a huge issue.  I don't
> think we wan't to be forking more processes just to be doing things like
> strftime().

In first place I don't understand why Apache itself (not modules) need to
be under locale != "C", do you have some examples? I.e. if you need just
localized strftime() output just fork once with specific locale at the
Apache startup and pass all locale-specific requests to forked process. 
Shared memory or mmap gives almost no overhead in this situation.  In this
model we have just one process per locale used. I am against runtime
locales switching inside Apache core because it cause too much overhead. 

> The C library is poorly designed, POSIX isn't helping it at all.  We
> pretty much have to replace all the string and allocation functions
> because we need better resource management and more functionality.  It's a
> similar step to start replacing the locale functions because we need
> better locale management. 

It is almost impossible to replace locale functions, although locale calls
are mostly standartized per POSIX, even call arguments (locale names) are
not standartized and locale data itself is _very_ different from system to

I understand your portability intention but it leades to Apache Operating
System(TM) as result running on dedicated machine with nothing else. It
seems there is no good solution of this problem.  I hope it not happens in
nearest future....

> One more thing to add:  locale is a global setting, in a threaded port we
> can't switch locales at all. 

Maybe will be good to ask someone from POSIX committie about their
locale-related plans.

Andrey A. Chernov

View raw message