Written an interface, the calculation amount is slightly larger, the data is cached data stored using Thinkphp's f method, there is no access to the database, why is the running speed only about 30ms during local testing, and it is the least when put on the server It takes about 5 seconds. Why is this? If you want to change where to start? My current local testing is very fast and I don’t know how to optimize it.
There is a problem when using file cache. There may be too much content in the file, causing problems when reading it. It is recommended to pull the cache file locally for testing and analysis. You can also clear the file cache regularly to reduce the increasing content of cached files
xdebug or xhprof can analyze the bottlenecks of your code. . . The simplest way is to put time tags on key locations to see which code segment takes too long to execute
The online server should be very local and have different aspects: 1. The online server needs to go through the network and you can test a network, 2. The hardware resources of the online server
3. The online server may be running multiple applications, consuming server resources. 4. Application problems, consider whether the application accumulates a large amount of data in online services, resulting in increased data processing time
Solved, it won’t work after changing the server. I don’t know why this happens...