We cannot serialize registrations as there are millions of users registering at the same time. Parallel registrations need to happen.
Let's say the database doesn't contain username 'user1'. When two users try to register at the same moment with 'user1' it'll accept it. But it will later cause problems. This shouldn't happen.
I'm looking for a logical solution. Not anything specific. Just an idea to solve this.