Synchronized clocks

34 views
Skip to first unread message

Diwaker Gupta

unread,
Jul 28, 2008, 3:13:06 AM7/28/08
to google-a...@googlegroups.com
I need to store the time of day in memcache (or even the data store).
Since requests might be served on different machines and the time is
significant for my application, it would be perfect if the clocks on
all appengine servers are guaranteed to be consisntent/synchronized
(within some small margin of course). Is this a reasonable assumption?

Thanks,
Diwaker
--
http://floatingsun.net/

Brian Smith

unread,
Jul 28, 2008, 1:28:51 PM7/28/08
to google-a...@googlegroups.com
Diwaker Gupta wrote:
> Sent: Monday, July 28, 2008 2:13 AM
> To: google-a...@googlegroups.com
> Subject: [google-appengine] Synchronized clocks

>
>
> I need to store the time of day in memcache (or even the data store).
> Since requests might be served on different machines and the
> time is significant for my application, it would be perfect
> if the clocks on all appengine servers are guaranteed to be
> consisntent/synchronized (within some small margin of
> course). Is this a reasonable assumption?

No. When I spoke to the AppEngine developers about this they were quite
adament that there is no reliable clock synchronization.

- Brian

alphalouis

unread,
Jul 29, 2008, 1:20:41 AM7/29/08
to Google App Engine
I was wondering about the same problem. How do developers host apps
that require time then? use javascript? What if the user's time is
wrong then?

Any work around?

José Oliver Segura

unread,
Jul 29, 2008, 1:42:34 AM7/29/08
to google-a...@googlegroups.com
On Tue, Jul 29, 2008 at 7:20 AM, alphalouis <akashm...@gmail.com> wrote:
>
> I was wondering about the same problem. How do developers host apps
> that require time then? use javascript? What if the user's time is
> wrong then?
>
> Any work around?

what is your reasonable margin for time differences? The only workaround
I see is using an external source to get time from (first time, and
every X requests
or X seconds, maybe), and generate a timedelta in each host (app
instance) serving
your app, in order to adjust host-provided time information with that
timedelta any time
you need to obtain current time. Will this work for you? Of course,
you still having some
time issues, since synchronizing from an external source has some drawbacks, but
it depends on your exact needs...

Jose

Jorge Vargas

unread,
Jul 29, 2008, 2:55:26 AM7/29/08
to google-a...@googlegroups.com
On Mon, Jul 28, 2008 at 11:28 AM, Brian Smith <br...@briansmith.org> wrote:
>
> Diwaker Gupta wrote:
>> Sent: Monday, July 28, 2008 2:13 AM
>> To: google-a...@googlegroups.com
>> Subject: [google-appengine] Synchronized clocks
>>
>>
>> I need to store the time of day in memcache (or even the data store).

why will you store in a cache something that is changing all the time?
this is an oxymoron.

>> Since requests might be served on different machines and the
>> time is significant for my application, it would be perfect
>> if the clocks on all appengine servers are guaranteed to be
>> consisntent/synchronized (within some small margin of
>> course). Is this a reasonable assumption?
>
> No. When I spoke to the AppEngine developers about this they were quite
> adament that there is no reliable clock synchronization.
>

but why will you need this? isn't all time-related data stored as UTC
times? making things created by date findable, I'm sure they where
talking about to-the-second sync, but I'm certain they should be
within the same minute, since the best way to keep clocks running vs
UTC is some kind of sync with an UTC server.


> - Brian
>
>
> >
>

Blixt

unread,
Jul 29, 2008, 3:06:58 AM7/29/08
to Google App Engine
I've been working on something that requires very accurate time
syncing and my quick and dirty solution was to query a separate server
for a timestamp and generate a time difference which would be stored
in a global variable (which is stored on the server instance.) Right
now though, it's running without this synchronization and from what
I've seen it seems to work just as well, so one might assume that the
clocks are pretty closely synchronized.

Here's the thing I was working on (with source): http://tack.appspot.com/
Note that it does not currently handle multiple clients well, since
writes to memcache can overwrite a received command, preventing you
from turning etc. If that happens try to send the command again
(release and re-press key.)

Regards,
Andreas

Brian Smith

unread,
Jul 29, 2008, 3:58:37 PM7/29/08
to google-a...@googlegroups.com

No. I spoke in person directly with the developers (at one of the
hack-a-thons) and they would not provide *any* reassurances about how close
the clocks are together. The developer I talked to (sorry, can't remember
his name right now) said it wouldn't be a good idea to rely on them being
synced close enough together to do anything useful. In fact, he made it seem
like he didn't think it was a big deal for the clock to be totally wrong
sometimes (e.g. wrong day).

I don't have any inside info here--attend one of the AppEngine events and
ask them for yourselves, or submit a ticket.

Regards,
Brian

Calvin Spealman

unread,
Jul 29, 2008, 5:34:58 PM7/29/08
to google-a...@googlegroups.com
I can't imagine how they can get away without some basic clock sync.
They distribute work across these clusters and how can you reliably
compose results, errors, and load logs without knowing when things
happened? For that matter, how could they reliably track your quota
usage over the timeline?

--
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://ironfroggy-code.blogspot.com/

Reply all
Reply to author
Forward
0 new messages