Shanghai attracted more than 9.5 million new people last year, making it the most attractive city for migrants. Beijing followed with a net inflow of 7.7 million.