[OPEN-ILS-DEV] PATCH: osrf_json_object.c (miscellaneous)

Mike Rylander mrylander at gmail.com
Mon Dec 3 21:53:23 EST 2007


On Dec 2, 2007 11:55 PM, Scott McKellar <mck9 at swbell.net> wrote:
[snip]
> 4. I introduced a linked list of jsonObjects that have been allocated
> from the heap but are not currently in use.

I like this idea a lot, but I'd like to have a mitigation strategy in
mind if it turns out there is an issue with bloat.  There are some
patterns in cstore that I could imagine causing a problem, but I
haven't had time to test that.

How does this strike you:  we use a module static int to track the
number of items added to freeObjList and the number of uses from the
list, and assuming both are above some reasonable threshold to allow
for priming of the list.  We watch the ratio of newly available to
used inside jsonObjectFree and if that ratio shows that we're using
nearly as many as we're adding (say a ratio of 6:5 freed to used),
then we continue adding to freeObjList.  This keeps us from growing
the unused pool without need, but will allow a large-ish pool while
under load.  If we get beyond a certain greater threshold (say, more
than 3:2 freed to used) then we destroy the list of unused objects and
reset the global counters.  This resets the playing field if we've
just gone crazy for some reason.

My gut tells me that we'll end up seeing a ratio very close to 1:1 in
normal operation, so I don't think we need to do this now, but I want
to have some ideas handy if we do encounter a code path or usage
pattern that we're not thinking of now.

Comments anyone?

-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


More information about the Open-ils-dev mailing list