I attended one interview today,Interviewer asked me one question regarding the creation of unique identifier.

Question :

Consider same webapplication is deployed in 3 webserver.if any user registered in any of my application,a unique identifer is given to the user.It cannot be stored in a database.3 webserver should not produce the same uid again.How t implement this ?

Since there is no database is available, you could always check with the other web servers before using a UID. There could be two ways of implementing this:
- either each server keeps track of every UID used (synchronization errors could occur), or
- each server keeps a list of its own UID's (would longer to generate a UID, and if one server goes offline there could be problems)

Thank you for your reply.How will they communicate with each other ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.