Investments in commodities are expanding at the quickest pace in six years on signs of rising economic growth, even as JPMorgan Chase & Co. and Goldman Sachs Group Inc. warn that some prices have rallied too fast.

The number of futures contracts on 24