Forgot your password?
typodupeerror
The Internet

benad's Journal: jabberd2: Well D'uh

Journal by benad
Now that my G4 is back to a sane operating volume, I was able to relax a bit, noticing how much I missed loading web pages in less than a second.

Also, I came over jabberd2, as I had some trouble setting up the multi-user conference module.

While setting up the "muc", I realized that I just added a module without havng to do anything special, and that module is running a separate process. It's as if you could add an apache2 module without having to restart httpd or anything.

So I looked at the source code. And guess what, it seems I'm not alone thinking this way.

The trick is simple: if your process is more I/O bound than CPU bound, use non-blocking I/O and block when you want with select(). That works particularly well if processing the "packets" is done in constant time and that "slower packets" are processed in parallel processes. Like in jabberd2.

I'm fed up of seing every single TCP server using either forking processes or threads on every new connection. You don't have to do neither! jabberd2 has 5 processes, one thread per process, TOTAL.

Anyways, it's nice to see that some of the ideas I had for ANet were not that crazy...

- Benad

This discussion has been archived. No new comments can be posted.

jabberd2: Well D'uh

Comments Filter:

"Call immediately. Time is running out. We both need to do something monstrous before we die." -- Message from Ralph Steadman to Hunter Thompson

Working...