China's factories contracted in August the most in nine months according to a survey showing falling export orders and rising inventories.