Permalink
Switch branches/tags
Nothing to show
Commits on Jun 14, 2008
Commits on Mar 24, 2008
Commits on Mar 22, 2008
  1. Fix compile error on OSX

    gnosek committed Jan 17, 2008
    OSX defines a macro MIN which conflicts with our private one.
    
    Reported by Erkki Eilonen
  2. Choose the globally lowest sched_score instead of a local minimum

    gnosek committed Dec 29, 2007
    If there are no idle backends, an exhaustive search over all backends
    is performed. This should improve scheduling quality noticeably.
    
    Also, remove some cruft from the main scheduler logic function
    and place almost everything in the main loop.
  3. Modify upstream_fair scheduling algorithm

    gnosek committed Dec 29, 2007
    This commit removes the FS_TIME_SCALE_OFFSET constant, replacing it by
    a shift counter (SCHED_TIME_BITS). The score is now calculated simply as:
    
    nreq << STB | ~(delta)
    
    which reverses the comparison (lower score is more suitable now).
    
    The components are now saturated instead of wrapping around. This has two
    consequences:
    1. The scheduler now always chooses the backend with the smallest number
    of pending requests (FS_TIME_SCALE_OFFSET is effectively infinite)
    2. The value of SCHED_TIME_BITS is not critical as it affects scheduling
    quality only when the components exceed their maximum values
  4. Post-order shm tree traversal

    gnosek committed Dec 2, 2007
    Traverse the tree of shm segments post-order (instead of in-order).
    This ensures that every visited node is a valid part of the tree,
    reachable from the root and no null pointers appear in ->left and
    ->right members.
  5. Fix division by zero while calculating scheduler score

    gnosek committed Nov 29, 2007
    Reported by Eric Wong
  6. Further reduce dependencies on round robin module

    gnosek committed Nov 18, 2007
    The bit vector functions and generic rbtree insertion really want
    to be placed in the nginx core
  7. Support for configurable shm segment size

    gnosek committed Nov 18, 2007
    If you are using lots and lots of backend servers, you may need to
    increase this value. Raw data size is two native words (8 bytes
    on 32 bit arches, 16 bytes on 64 bits) but the overhead may be
    pretty big, so you just have to experiment.
    
    Example usage:
    
    http {
        # ...
    
        upstream_fair_shm_size 32K; # this is the minimum
    
        # ...
    }
  8. Trim data stored in shared memory

    gnosek committed Nov 16, 2007
    Replace the array of timestamps with a single value of an atomic
    type and remove padding. On i386, the struct will most likely be
    8 bytes long (16 bytes on 64-bit arches), which gives a not so bad
    chance of fitting a whole upstream block in a single cacheline
    (depending on CPU and number of backends).
    
    Putting every ngx_http_upstream_fair_shared_t is pretty pointless
    since a few commits, because we touch all of them at the same time,
    when looking for an idle backend.
  9. Overhaul memory management

    gnosek committed Nov 14, 2007
    The shared memory segments are now tracked via an rbtree with proper
    lifetime management (via refcounting). Starting with this commit,
    nginx survives a continuous reload-every-1s cycle while serving
    requests all the time.
  10. Tweak scheduler score

    gnosek committed Nov 11, 2007
    Now the time since last activity is "positive", i.e. the bigger the time,
    the greater chance of selecting this backend.
    
    The point of this change is to keep scheduler scores roughly decreasing in
    round-robin order, and to keep the iteration count of the main loop of
    ngx_http_upstream_choose_fair_peer as short as possible.
  11. Almost complete rewrite of load balancing logic

    gnosek committed Nov 11, 2007
    There are now almost no dependencies on the round_robin module,
    mostly during setup stage.
    
    Conflicts:
    
    	src/http/modules/ngx_http_upstream_fair_module.c
  12. Properly account backend weights

    gnosek committed Nov 11, 2007
    Conflicts:
    
    	src/http/modules/ngx_http_upstream_fair_module.c
  13. Fair upstream load balancing algorithm, alpha release

    gnosek committed Nov 1, 2007
    The algorithm is very simple but deserves a bit more explanation
    than a commit message, so please wait patiently for more
    thorough documentation.
    
    Note: the lockless access will probably be insufficient,
    expect spinlocks soon.
  14. Make ngx_http_upstream_fair_shared_t able to grow above a single cach…

    gnosek committed Nov 1, 2007
    …eline
    
    This allows us to increase the number of time slots, should it prove
    neccessary
  15. Collect statistics for upstream_fair module

    gnosek committed Nov 1, 2007
    The shared memory is accessed without any locks. The number of
    requests is updated atomically and the last activity time uses
    a rotating set of slots a'la ngx_times.c
    
    Note: the numer of time slots may need to be increased under heavy
    load, but on the other hand, corrupted reads should lead in the
    worst case to non-optimal load balancing. This needs further testing.
  16. Convert code to use nginx's shared memory implementation after all

    gnosek committed Nov 1, 2007
    The ordering between various phases of module setup makes it just
    about the only sensible way to go.
  17. Track upstream_fair's allocated SHM segments in a private list

    gnosek committed Oct 30, 2007
    Unfortunately, nginx's shared memory management seems pretty convoluted
    an inflexible. Before I start digging into its internals, track
    shared memory allocations with a simple linked list.
    
    Also, change sponsorship information (per sponsor's request)
  18. First stab at fair upstream load balancing

    gnosek committed Mar 22, 2008
    Current status: it compiles.
    Not tested *at all*, probably crashes, leaks memory almost certainly.
    DO NOT USE.
    
    A design philosophy document will probably come after the dust settles.