You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ivan Barrera A." <Br...@Ivn.cl> on 2005/07/22 16:31:07 UTC

bw_mod : How to do some stuff.

Hi,

  I've been working on this mod since a time now. I've done most of the
work before, but i'm working on improve and fix some bugs.

  This started as an ugly hack to bandwidth_mod for apache 1.x (really
ugly). Then looking at some other code, i learn how to do it the right
way (using buckets, and splitting them). As simple as it may sound,
there is a complication. Using non-threaded MPM, i must use some sort of
shared memory resource to share the stats of the bandwidth used by each
client within the vhost context. This is exactly the way i implemented
it, but i have some issues :(
  I cant do bw configuration on .htaccess files, as i need to allocate a
different space of memory to hold that configuracion and stats. (or
maybe i can, but i dont know how).
  There is another catch. I'm not able to know the exact speed a client
is downloading something, as i just split the buckets, and send each
with certain delay. I think i may need to write another output filter
(final in the chain) which will write to the client, and get the real
speed he is using, so the can give a more accurate speed to each one.
(currently it just splits the total speed with the number of clients).

  Some pointers, recommendations, and even better, if someone knows some
code that does something similar, would be useful. My idea is to have a
complete bandwidth control mod for use. (bw throttle, bw limiting, bw
per period, bw accounting). My main trouble, is the shm part (as i need
to reallocate pools of memory)

  The code to bw_mod is on http://ivn.cl/apache , version 0.6. It works
pretty stable, some minor glitches, on lots of platforms (linux, BSD,
Win, Solaris, MacOSX, etc) on many archs (x86,ppc,mips,sparc).

Feedback greatly appreciated.


Bruce.-