Best way to generate sequential ids

If the OP cannot tolerate occasional gaps then it is a hard problem indeed.