Home > Backend Development > PHP Tutorial > A brief analysis of PHP's apc extension (1)

A brief analysis of PHP's apc extension (1)

WBOY
Release: 2016-07-29 09:15:06
Original
1809 people have browsed it

I finally generated the apc.so extension file under php5.5, and I can’t wait to test apc. With the apc.so file, it is easy to make php support apc. Open the configuration file php in use. .ini, just add extension=apc.so, restart the web server (if using nginx, restart php-fpm) to make it take effect, and then use phpinfo() to check whether it has taken effect.

Before official use, we need to copy a file named apc.php in the source code folder of apc to the root directory of the website being used. This file displays various indicators of the current apc in the form of a web page. This allows us to observe the running process of apc more intuitively. There are only two places in this file that we need to change, one is the login account and the other is the login password. The purpose of the account and password will be explained in detail when used.

defaults('ADMIN_USERNAME','username');         // Admin Username
defaults('ADMIN_PASSWORD','password');         // Admin Password - CHANGE THIS TO ENABLE!!!
Copy after login
When we visit apc.php, the following interface (partial) will appear. "Refresh Data" is the refresh data, and "Version Check" is the version check. It is not the focus of our concern. What we need to care about is "View Host Stats", "System Cache Entries" and "User Cache Entries".

A brief analysis of PHPs apc extension (1)

First let's take a look at "View Host Stats". This option is used to display the host's statistical information, which is divided into "General Cache Information", Let's look at the "File Cache Information", "User Cache Information", "Runtime Settings", "Host Status Diagrams", and "Detailed Memory Usage and Fragmentation" one by one

"General Cache Information": About. An overall introduction to apc cache, including a series of information such as apc version, php version, apc host information, etc.

"File Cache Information": Describes system cache-related information. If conditions permit, apc will automatically cache all files. When the user visits the visited PHP page again, the cache file will be read first, and the detailed information of the cache file is recorded in "System Cache Entries". Here is a statistics on the system cache, Cached Files. (Number and size of cached files), Hits (number of cache hits), Misses (number of cache misses), Request Rate (hits, misses) (request rate, including hits and misses), Hit Rate (request hit rate), Miss Rate (request miss rate), Insert Rate (unknown), Cache full count (number of times the cache exceeds the upper limit). Through this information, we can understand the hit status of the system cache, whether the cache content exceeds the upper limit, and then make corresponding adjustments according to the situation.

A brief analysis of PHPs apc extension (1)

“User Cache Information”: Describes user cache related information. Different from system cache, user cache requires users to manually store and call with the help of apc_add, apc_store, app_fetch and other functions. Cached Variables (number and size of cached variables), other information descriptions have the same meaning as the descriptions in the system cache.

A brief analysis of PHPs apc extension (1)

Summary:

1 The apc.php file needs to change the user name and password

2 APC has two major functions: system cache - automatically cache php files, user cache - manual cache php variables

3 Cached Files( Variables) can let us know the number and size of cached variables. Rate related parameters let us know the request hit rate. Cache full count lets us know that the memory allocated for apc is not enough and needs to be adjusted.

The above has introduced a brief analysis of PHP's apc extension (1), including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template