The rule engine is an important part of the industry-education integrated Internet of Things teaching platform, and it is the basis for realizing the dynamic configuration of business rules in the practical teaching function. Combined with the data characteristics of the Internet of Things application scenario, this paper proposes a rule engine optimization algorithm based on Rete, and designs a pre-sorting algorithm based on rule frequency, which pre-sorts the order of nodes according to the frequency of use of rule patterns, with priority Match frequently used patterns, increases the sharing rate of nodes, and reduce the memory usage of the inference network. Through experimental simulation, the improved algorithm is verified, and the experimental results prove the effectiveness of the algorithm.