[ZODB-Dev] Scalable Container for Log-Entries

Casey Duncan casey at zope.com
Wed Jan 28 12:42:05 EST 2004


On Wed, 28 Jan 2004 12:05:24 -0500
"Tim Peters" <tim at zope.com> wrote:

> [Thomas Guettler]
> > It seems to be OK. I am running this script since
> > several minutes:
> >
> > frac=1000000
> > while 1:
> >     now=time.time()
> >     now2=time.time()
> >     now=long(now*frac)
> >     now2=long(now2*frac)
> >     if now==now2:
> >         raise("Equal: %s" % now)
> 
> While there are no guarantees, Python's time.time() typically updates
> a million times per second on Linux, 18.2 times per second on Windows,
> and 1 time per second on Mac Classic.  Especially on Linux, you may
> also need to be prepared for "time running backwards"; e.g., if the
> box is hooked up to a net time service and corrects for drift now and
> again.  time.time() *can* be completely baffling on multiprocessor
> boxes too, depending on all sorts of obscure OS and C library details
> (the problem is that, depending on how the platform C implements its
> notion of time, each processor may end up with its view of current
> time, they can get out of synch, and then the time.time() result
> depends on which processor happened to execute it).

There was talk on this list and code floating around some time ago about
implementing ascending counters on the storage side. I'm not sure what
the status of that is, but it could help guarantee that the values are
unique and always ascend even across threads/processes.

-Casey



More information about the ZODB-Dev mailing list