perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ludwig <>
Subject Re: Sinister variable caching problem with rand()
Date Sun, 16 May 2010 13:23:11 GMT
André Warnier schrieb am 16.05.2010 um 13:40:31 (+0200):

> One alternative is to use some strictly incremental
> counter, shared between multiple processes running on
> potentially multiple systems or CPUs.  This requires a
> common place to store the counter, which survives a system
> restart, and it requires some lock-read-increment-unlock
> mechanism.  I don't know any really fast and efficient way
> of doing this.  I am interested however if anyone knows
> one.

In an SQL server, you'd use a SEQUENCE:


Read about Redis recently, like Memcache, just "semi-persistent".
You can store and increment an integer there. Or in any other
key-value store.

I think the locking required for incrementing an integer, if
necessary at all, is negligible.

But I agree that in practice for most scenarios, your solution
will work just fine ;-)
Michael Ludwig

View raw message