The invention provides a quick flow grouping method based on two-level cache, which comprises the following steps: in the measuring period, a measurer maintains a flow table respectively in a low-capacity high-speed cache and a high-capacity low-speed cache; for each incoming message, firstly checking whether the high-speed cache has a flow record thereof or not; if the high-speed cache has the flow record, accumulating the message information in the flow record; if the high-speed cache does not have the flow record, randomly sampling the message; and if the message is sampled, establishing the flow record in the high-speed cache, otherwise recording the message in the low-speed cache. In the invention, the characteristic of heavy-tailed distribution of flow length in network flow is utilized, the long-flow information comprising a large quantity of messages in the high-speed cache is recorded, the low-speed flow in the low-speed cache is recorded, flow is grouped by adopting the two-level cache, the flow grouping efficiency of the network flow is greatly improved, and simultaneously each message in equal probability is sampled, so that the long flow is recorded in the high-speed cache in a very high probability, and the probability that the short-flow with a small quantity of messages is recorded in the high-speed cache is very low.