httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Lowe <ha...@thebackrow.net>
Subject UNIQUE_ID as an integer
Date Thu, 06 Jan 2005 01:15:32 GMT
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

Mime
View raw message