Regarding the PHP optimization speed, will the file cache be significantly affected? Cache-optimized php Data
Due to limited conditions, there is no MemCache, but in many places such as "Region Information, various tree types, global menu links" and so on, it is really too slow to retrieve information directly from the database, in addition, there are too many statements on a page, so a method is adopted to store such data directly to the hard disk and read the data directly from the hard disk when necessary.
The project is almost done, and it seems that there are quite a lot of places to use this type of method. now I am so worried that when it is officially launched, will too many reads go down directly?
If you have any experience in this area, please reply to me. At present, my testing speed is quite fast, but it is not under pressure.
Reply to discussion (solution)
I have a tool to perform stress testing. I can't see if I/O is supported. It's easy to get a cache.
You can use mysql to create a memory table without MemCache. Or increase the mysql cache.
The best thing is that the read memory is that the cache is stored in the memory. Specifically, the ls is used to deploy files on the hard disk.-I feel that the difference between the hard disk and the read database in step 5 is a bottleneck.
Due to limited conditions, there is no MemCache, but in many places such as "Region Information, various tree types, global menu links" and so on, it is really too slow to retrieve information directly from the database.
It is best to optimize your queries and programs.
Me ?? Describe my practices:
My website has a huge classification table, which is divided into multiple layers, each of which stores the number of news under this category.
To prevent reading the category table again every time, I created a function that is called only when news is added. Its role is to read each category, and calculate the number of news under each category. after calculation, the classification is re-combined into an array. then, this function is used to store my array into a php file, in this way, the front-end only needs to request the php file and traverse the array output, so you do not need to read the database again.
That is to say, the classification of the database is read in advance and integrated into an array into a php file. when it is displayed, the PHP file is require. you do not need to read the database every time.
The project is almost done. in this case, if you don't want to make a big fuss about the code, it is best to add an intermediate cache layer. if the server cluster is not involved, you can enable the eAccelerator, apc, and xcache cache opcode on the server. if it is a server cluster, you need to post on the reverse proxy.
Due to limited conditions, there is no MemCache.
This statement is not very clear, and memcache does not require high server configurations.
In addition, you can use jmeter to test the stress according to your current file reading practices. There are many stress testing tools.
I/O is no problem now. as access grows, the bottleneck is still it...
We recommend that you do not change the current function.
It can be written as a file storage when it is retrieved for the first time, and then directly read the file when it is read again. if the data is modified, it will be written again. this is what many frameworks do.
Enough memory tables...
I usually use file storage and memcache to view data.
You can use js for local cache
Mysql Query cache is recommended. This method has the highest availability, flexibility, and transparency. This requirement does not require demanding performance.
In my opinion, memcache is suitable for exchanging data between two sessions (pages) and not for caching.