On Mon, 23 Jun 2008 09:53:40 +1000 [EMAIL PROTECTED] wrote: > Hi List, > > I'm have modified mod_vhost_alias.c to perform an md5 lookup in > mva_translate. > > This process takes some over head and I would like to use the > apr_hash_t structure to hash already calculated MD5's and lookup the > MD5 from the hash when mva_translate is called at a future time.
How much overhead here? Are you computing MD5s on something big? For a small overhead, this would look like overkill. > I'm new to the code so I'm not sure how the pool memory scopes work. > Here are a few questions to try and clarify how to implement the > proposed solution: > > 1. Is the apr_hash thread safe and does it have to be thread safe > when used in mva_translate? You'd want to lock operations that update the hash, if it's shared across threads. > 2. If using the hash is fesiable, how do I initalise it to be used > in the module so it can be useful and destruct the object? Initialise everything - including your pool - in a child_init hook. Register cleanups as you create each resource. How big is your hash going to grow? Are you putting yourself at risk of it consuming all your memory over time? > 3. Is there a better way? Chapter 4. Or memcache, if your overhead is so big as to merit it. -- Nick Kew Application Development with Apache - the Apache Modules Book http://www.apachetutor.org/
