You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Will Lowe <ha...@thebackrow.net> on 2005/01/06 02:15:32 UTC

UNIQUE_ID as an integer

I'm running a site that uses mod_unique_id to generate session IDs
under Apache 1.3.  We'd like to later be able to use the session IDs
as database keys, but at our volume (a hundred million sessions per
day) using non-numerics as keys makes databases painfully slow.  We
tried a scheme where we mapped each UNIQUE_ID to a sequental numeric
key, but then key generation and lookup became the bottleneck.

I put together a patch that modifies mod_unique_id to encode the ID as
a hex string and stick it in a UNIQUE_HEX_ID environment variable.
This has the benefit of being directly importable into a numeric field
(128bit if you don't HAVE_MULTITHREAD) in most databases.

In case there's some interest in this in the community, the patch is
here:

http://thebackrow.net/~harpo/apache/hex_unique_id.patch

ap_snprintf() doesn't understand the "%hhx" format.  Linux's
snprintf() does, but it looks like Solaris 5.8 doesn't.  Is there a
more portable way to do this?

-- 
					thanks,
		
					Will

Re: UNIQUE_ID as an integer

Posted by Jason Rigby <si...@gmail.com>.
Hey Will,
I do indeed think that this patch is useful and I would like to apply
it to my configuration! Alas I am not all that good with the
modification/patching of programs using the source code (I only know
how to program in Visual Basic... which I am hoping to ditch and learn
C++) or the use of linux in general for that matter. Therefore I ask
could you, or anyone else please provide information or a reference to
information regarding how to implement such a patch on linux for
apache. I'm sorry if I'm asking a stupid question but if someone could
push me in the right direction it would be greatly appreciated.
thanks,
Jason.



On Wed, 5 Jan 2005 17:15:32 -0800, Will Lowe <ha...@thebackrow.net> wrote:
> I'm running a site that uses mod_unique_id to generate session IDs
> under Apache 1.3.  We'd like to later be able to use the session IDs
> as database keys, but at our volume (a hundred million sessions per
> day) using non-numerics as keys makes databases painfully slow.  We
> tried a scheme where we mapped each UNIQUE_ID to a sequental numeric
> key, but then key generation and lookup became the bottleneck.
> 
> I put together a patch that modifies mod_unique_id to encode the ID as
> a hex string and stick it in a UNIQUE_HEX_ID environment variable.
> This has the benefit of being directly importable into a numeric field
> (128bit if you don't HAVE_MULTITHREAD) in most databases.
> 
> In case there's some interest in this in the community, the patch is
> here:
> 
> http://thebackrow.net/~harpo/apache/hex_unique_id.patch
> 
> ap_snprintf() doesn't understand the "%hhx" format.  Linux's
> snprintf() does, but it looks like Solaris 5.8 doesn't.  Is there a
> more portable way to do this?
> 
> --
>                                         thanks,
> 
>                                         Will
> 


-- 
     ("`-''-/").___..--''"`-._
     `6_ 6  )   `-.  (     ).`-.__.`)
     (_Y_.)'  ._   )  `._ `. ``-..-'
   _..`--'_..-_/  /--'_.' ,'
  (il),-''  (li),'  ((!.-' 
Jason!

Go to this site and make moneys for nothing:
http://www.emailcash.com.au/join.asp?refer=F72476