Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 153289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:46:30+00:00 2026-05-11T09:46:30+00:00

I need to generate unique, incremental, numeric transaction id’s for each request I make

  • 0

I need to generate unique, incremental, numeric transaction id’s for each request I make to a certain XML RPC. These numbers only need to be unique across my domain, but will be generated on multiple machines.

I really don’t want to have to keep track of this number in a database and deal with row locking etc on every single transaction. I tried to hack this using a microsecond timestamp, but there were collisions with just a few threads – my application needs to support hundreds of threads.

Any ideas would be appreciated.

Edit: What if each transaction id just has to be larger than the previous request’s?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:46:30+00:00Added an answer on May 11, 2026 at 9:46 am

    If you’re going to be using this from hundreds of threads, working on multiple machines, and require an incremental ID, you’re going to need some centralized place to store and lock the last generated ID number. This doesn’t necessarily have to be in a database, but that would be the most common option. A central server that did nothing but serve IDs could provide the same functionality, but that probably defeats the purpose of distributing this.

    If they need to be incremental, any form of timestamp won’t be guaranteed unique.

    If you don’t need them to be incremental, a GUID would work. Potentially doing some type of merge of the timestamp + a hardware ID on each system could give unique identifiers, but the ID number portion would not necessarily be unique.

    Could you use a pair of Hardware IDs + incremental timestamps? This would make each specific machine’s IDs incremental, but not necessarily be unique across the entire domain.

    —- EDIT —–

    I don’t think using any form of timestamp is going to work for you, for 2 reasons.

    First, you’ll never be able to guarantee that 2 threads on different machines won’t try to schedule at exactly the same time, no matter what resolution of timer you use. At a high enough resolution, it would be unlikely, but not guaranteed.

    Second, to make this work, even if you could resolve the collision issue above, you’d have to get every system to have exactly the same clock with microsecond accuracy, which isn’t really practical.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 201k
  • Answers 201k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You want something like :mksession ~/mysession.vim Then later you can… May 12, 2026 at 8:05 pm
  • Editorial Team
    Editorial Team added an answer This appears to be fixed in swt cocoa 3.6 M2… May 12, 2026 at 8:05 pm
  • Editorial Team
    Editorial Team added an answer You might be interested by: http://wiki.php.net/rfc/taint May 12, 2026 at 8:05 pm

Related Questions

I need to generate unique, incremental, numeric transaction id's for each request I make
I have a database table with a unique string field and a couple of
In PHP/MySQL, what's the best way to generate a unique reference ID so that
In Oracle there is a mechanism to generate sequence numbers e.g.; CREATE SEQUENCE supplier_seq
Summary: I'm developing a persistent Java web application, and I need to make sure

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.