Apparently Edo (now Tokyo) had a population of one million in the 18th century.
Always amazed me how they could pull that off. Japan was a very regulated society which must have helped with the chaos but Japanese people go to the toilet just like everyone else...