2 Replies Latest reply on Jul 11, 2012 3:57 AM by Guillermo GARCIA OCHOA

    Global/Normalized timestamp generator

    Guillermo GARCIA OCHOA Newbie

      There is a mechanism that allows any cluster member to get a normalized timestamp? IMHO this is very interesting to:

      • Normalized log trace
      • Date object creation for business logic
      • Etc.


      If there is not ... how do you think is the best way to implement this on a cluster?


      I was think in using a master server who generates the timestamps. This is a very known pattern for distributed message queue systems, but it have a theorical single point of failure (it can be solve picking a new master). But how can I implement this using an embedded infinispan cache? There is a way to pick/promote a cluster member as a master?


      I know that the embedded cache implementation have a master (and I suppose that if it dies some other member will be promoted), but can I rehuse this mechanism for my pourpuse?


      After all this, I think that I will have another issue: how can I be sure that my timestamp is actually generated by the master? I know that I can use distributable jobs, but how can I pick the master server for that specific execution?


      I think that Quartz Scheduler can help me on this but I do not want add more complexity to my application ...


      Thanks in advance,


      PS: I know that if the cluster hardware have different dates/times it will be a problem when I have to change the master, but it will be better to be wrong sometimes than always right?

        • 1. Re: Global/Normalized timestamp generator
          Galder Zamarreño Master

          What about synching your machine clocks with NTP?


          I don't see the need to add extra logic to keep log files synchronized. Synch the clocks instead and problem solved. No code required.


          For object creation date, if the clocks are synched, you'll get a pretty good approximation with currentTimeMillis call.

          • 2. Re: Global/Normalized timestamp generator
            Guillermo GARCIA OCHOA Newbie

            I strongly disagree with you ...


            A cluster should have a normalized timestamps generator for many use cases.


            One example

            Message producer/consumer: Almost all the implementations of this kind of patterns needs a normalized timestamps to know the order of processing of the distributed queue (this means several share-nothing queues).


            One real case scenario:

            Transaction processor: you have several servers handling business transactions, but to be faster do you not centralize all these transaction in the same queue, but in several ones. Then you can consume those queues to really process this sorted by 'creation timestamps'.


            I know there is a lot of way to do this, but timestamps are widely used in distributed environments. Please check this:



            Dont you think that this is important enough to be added to the roadmap? Is not blocker, but I think that this is a 'must have' feature.