Re: GLIB for a webserver



On Thu, 2011-12-08 at 11:13 -0200, Marcelo Elias Del Valle - SYSMAP
SOLUTIONS - Claro MA-SP - wrote:

- On Apache ARP project, they said they created it instead of using
glib because the lack of IPC functions like memory mapping.

This makes no sense since they could use glib and also write mmap
functions...

- In some forums, people were complaining about the fact glib aborts
when memory allocation fails, which is bad for a 24/7 running web
server.

A robust Web server would probably have a framework that restarted
components as needed; Apache already does some of this with "workers".

The main problem with memory allocation comes when someone else's
process is using all the memory.

If you are writing a new Web server (why?) glib is probably fine.

Don't fight it, though. There's no portable way to find the system's
free memory, and even if there were, it wouldn't help -

    if (amount_of_memory < amount_available) {
         // imagine that after that test succeeds,
         // your program happens to get swapped out,
         // and another program allocates all of memory

         allocate_memory(); // fails
    }

So it's better to assume that things will fail. Robustness does not come
from avoiding failure - it comes from recovering from failure.

For a Web server that may just mean restarting. Sure, some users will
have to reload Web pages; if that's actually a problem, use persistent
storage to record state.

Apache and IIS are fairly large codebases for a reason, though -- a
secure reliable production Web server would have a lot of catching up to
do.

But, it's fun writing Web servers :-)

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]