I'm a full stack developer: Frontend, Backend, Server, Devops. I mostly program in Ruby, Java, JavaScript.
I would give my advice for free. Link me on Twitter: @rmetzler
How I would build this feature "take a number and go to the queue":
1. get a fast datastore central to you servers. All webservers have to look on the same central datastore, because this number has to be unique for each visitor. Redis would be perfect for this task.
2. you have to have a middleware layer in your Rails, Django or PHP setup. All HTTP-Requests have to go through this middleware layer. This middleware layer is reponsible for getting the ticket from Redis and set it as a cookie. If the browser has no cookie, it gets one. If you want to ensure that visitors can't fake the cookie, just add a secret to each cookie/ticket.
Doing this in another layer than middleware will result in bugs because you have to add the code at many different places.
3. Profit (as long as your caching etc. works and you don't get slash dotted)
JavaScript Ruby Web Applications Java Redis Mobile Technology CoffeeScript Git Software Design