China's first batch of 24-hour restaurants were opened by McDonald's in September 2006 and soon began to draw hordes of vagrants, dubbed McRefugees - a term first used in Japan in 2007.
But of the McDonald's and KFC restaurants in Xujiahui, the most popular is the KFC on 123, Tianyao Road.
Late at night, it resembles a small inn. Barring a few lovers and young men stopping by from a nearby karaoke venue, the rest are all the so-called McRefugees.
They usually make an appearance after 10 pm; some bring along a bag, most come empty-handed. They sit on the chairs farthest from the counter and never order anything. Around midnight, they stretch out on the sofa or a row of seats, or put their heads on the table, using their arms as pillows.
By day, most work as cleaners, part-time waiters, film extras and security guards. At night, they gather in the restaurants and talk about the sky-high housing prices - more than 20,000 yuan per square meter in the city - or striking it rich in a lottery. Sometimes, they exchange leads on where to find work when day breaks.
There is usually little interaction between the restaurant's waiters and these people.
But Sun is often woken up by Shi Jigao, a 25-year-old employee of KFC. Himself a migrant worker from Northwest China's Gansu province, he makes about 1,500 yuan a month. Part of his job is to evict the refugees. He gets most busy at 2 or 3 am, when there are easily around 40 people sleeping in the restaurant.
One of them is Zhang Dongjie, 23, who does bit parts in films and small modeling assignments. Although he makes about 4,000 yuan a month and can afford to rent a room, he prefers a KFC night and even carries his toiletries and clothes to prepare for the next day.
There is also the martial-arts school graduate Du Longlong, who came to Shanghai with dreams of becoming a kungfu star. But after six years, he is unable to even find work as a waiter, as he has no health certificate.
Unlike Shi, who hopes to make enough money to return home and marry in five years, Zhang and Sun want to continue in Shanghai.
They often check out the bookstores in Metro City. While Zhang likes poems and essays, Sun has difficulties understanding most books.
"Boys of my age are still in school," he says, nostalgic for the grasslands and friends of his hometown.
Liu Xiaolin, a PR manager at McDonald's, says many 24-hour venues have people resting there for the night. The Tianyao Road stabbing was a rare occurrence, he adds.
However, police have stepped up night checks at the fast-food restaurants in Xujiahui and look at all identity cards closely.
As dawn breaks, Zhang and Du line up to wash their faces. Zhang wants to take a bath and buy some new clothes while Du hopes he will finally get that health certificate so he can join the crew at McDonald's.
Liu Wei contributed to this story. The story was first published in Southern Metropolis Weekly