You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Steve Piner <st...@marketview.co.nz> on 2002/05/01 00:07:26 UTC

Re: [Fwd: Re: Cheap and unique]


David Jacobs wrote:
> 
> >
> >I'm just curious - what's wrong with the function you're already using?
> >
> >Steve
> >
> 
> Mod_Perl hangs on to it's PID, so it's no longer unique. (I _believe_)

But the timestamp will make it unique - as long as you're not serving
several requests per second.

If you are, you could use a counter as well as, or in place of, the
timestamp.

All I'm saying is that CGI by itself doesn't guarantee a unique PID -
your CGI's original author probably knew that, and incorporated the
timestamp to guarantee uniqueness.


> mod_unique_id looks like a good solution, pending performance.

Yeah, agreed.

> Thanks for your help so far, everyone!
> 
> David

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz

Re: [Fwd: Re: Cheap and unique]

Posted by darren chamberlain <dl...@users.sourceforge.net>.
* David Jacobs <dj...@cheetahmail.com> [2002-04-30 18:31]:
> A global counter hanging around is a good solution, but not perfect if
> we deploy on multiple servers. 

That depends on what you initialize the global to; if you do something
like the last octet of the ip of the vhost and increment it by the PID
of the child each time you access it (rather than incrementing by 1),
you'll get a pretty useful way of getting a useful global value.

(darren)

-- 
Your freedom to swing your fist ends at the tip of my nose.
    -- Larry Niven

Re: [Fwd: Re: Cheap and unique]

Posted by David Jacobs <dj...@cheetahmail.com>.
>
>
>>Mod_Perl hangs on to it's PID, so it's no longer unique. (I _believe_
>>
>
>But the timestamp will make it unique - as long as you're not serving
>several requests per second.
>  
>
I'm building the system so I can be confident up to thousands of 
requests/second. Looks like unique_id_module is good for around 65K 
requests, which is fine ;)

A global counter hanging around is a good solution, but not perfect if 
we deploy on multiple servers. It appears the mod_unique module uses 
timestamp, a PID, a counter and the IP address, which is fine.

David