Re: Chunked mempools, a first verdict

From: Andres Kroonmaa <andre@dont-contact.us>
Date: Thu, 3 May 2001 16:48:21 +0200

On 2 May 2001, at 22:05, Henrik Nordstrom <hno@hem.passagen.se> wrote:

> The way too specific stuff should move into lib, with a suitable API that
> is not soo specific.

 OK, taking into account all suggestions I've reached this API:

/* Public user API */
extern MemPool *memPoolCreate(const char *label, size_t obj_size);
extern void memPoolTune(MemPool * pool, size_t chunksize, int unused);
extern void *memPoolAlloc(MemPool * pool);
extern void memPoolFree(MemPool * pool, void *obj);
extern void memPoolDestroy(MemPool * pool);
extern int memPoolGetStats(MemPoolStats * stats, MemPool * pool, int index);

/* Module housekeeping API */
extern void memPoolInit(void);
extern void memPoolClean(MemPool * pool, time_t maxage, int new_idle_limit);

/* Wrappers under src/mem.c */
extern void memConfigure(void);
extern void memPoolCleanIdlePools(void *unused);
extern int memPoolInUseCount(MemPool * pool);
extern int memPoolsTotalAllocated(void);

/* MemMeter */

extern void memMeterSyncHWater(MemMeter * m);

/* MemPoolStats.c */
extern void memReport(StoreEntry *);

 exported data - 0

 Cachemgr Reporter works through GetStats API, is now straightforward.
 memPoolCleanModule is removed from lib. library actually can't care
 less about dirty pools, its job of a caller to release and destroy
 pools. Implemented to some extent in mem.c memClean().

 memPoolClean() is a function that needs to be run periodically to
 release idle memory. Wrapped in mem.c memPoolCleanIdlePools() to be
 called from event.c
 memPoolInUseCount() and memPoolsTotalAllocated() are wrappers to
 memPoolGetStats() that gets actual data for them.

 Please take another look at it, and test.

------------------------------------
 Andres Kroonmaa <andre@online.ee>
 CTO, Delfi Online
 Tel: 6501 731, Fax: 6501 708
 Pärnu mnt. 158, Tallinn,
 11317 Estonia
Received on Thu May 03 2001 - 08:52:59 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:58 MST