Principle analysis: Generate a set of random IDs, and then retrieve the records corresponding to this set of IDs. After such optimization, the page opening speed is significantly faster, and the CPU usage is reduced to almost 0. By the way, this idea is used to optimize the site in the sql server database application. Speed comparison: Using rand() to retrieve 10 random records takes more than 400 milliseconds, while using the above method only takes about 0.6 milliseconds. The efficiency is not improved a little. Articles you may be interested in: php code to get CPU usage Use proc/loadavg in php to monitor the average load of the CPU php code to record server load, memory, cpu status Example of php page caching (reducing the burden on cpu and mysql) An example of php code to obtain cpu and memory usage php implementation code to obtain Linux server CPU, memory, hard disk usage php code to obtain the computer’s unique identification information (cpu, network card, MAC address) The relationship between PHP-CGI process CPU 100% and file_get_contents function php gets CPU usage information |