Home > Article > Backend Development > A brief analysis of php's apc extension (3)
"Host Status Diagrams" and "Detailed Memory Usage and Fragmentation": Located on the right side of the page, there are some charts related to apc. Through the charts, we can see the usage of apc more intuitively.
Memory Usage: apc memory usage chart. The chart lists the specific usage value and percentage of memory used. The green part represents unused and the red part represents used.
Hits & Misses: APC cache hit rate chart, the chart lists the hit rate percentage, where green represents hits and red represents misses.
Detailed Memory Usage and Fragmentation: Detailed memory usage and fragmentation. When a piece of data in the cache is cleared, the space occupied by the data is released, and the space becomes unused space, but there is still data on both sides of it, and the occupied space is still used space, so this piece of unused space The space is isolated and cannot be connected with other unused spaces, which results in fragmentation. As shown in the figure below, the 35MB unused space is divided into 4 parts. If the size of the newly requested file is smaller than the space occupied by the fragment, the fragment can still be utilized, but if the requested file is larger than the space occupied by the fragment, then the fragment space cannot be utilized. For example, there are now two separated 608.0 Bytes of unused space, now a new file request of 1 KBytes, although the two fragments add up to more than 1 KBytes, but because the two are not connected together, and each fragment is not enough to accommodate the new request request, so these two fragments will be skipped, and the request will continue to request the unused space that can accommodate it. It can be seen that if there are too many, too small, and fragmented fragments, it will be very detrimental to the full utilization of the memory block. As for how to solve the fragmentation problem and rationally utilize the memory block, there is currently no good method.
So far, the content displayed on the "View Hosts Stats" page has been introduced. This page contains the basic information of apc, operating configuration items, operating conditions, etc. We can get a lot of what we need from this page Information, such as the number of caches, cache size, cache hit rate, etc. This page displays the overall information. If you want to view the information of each page or variable, you need to go to the "System Cache Entries" and "User Cache Entries" pages. Go get it. The next article will introduce these two pages in detail.
The above has introduced a brief analysis of PHP's apc extension (3), including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.