Analysis of apc extension in php (1)

Source: Internet
Author: User
: This article mainly introduces the apc extension analysis of php (1). If you are interested in the PHP Tutorial, please refer to it. It is difficult to generate apc in the case of php5.5. so extension file, can't wait to test apc, with apc. after the so file, it is easy for php to support apc. open the configuration file php in use. ini, you only need to add extension = apc. so, restart the web server (if nginx is used, 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 an apc file in the apc source code folder. php files go to the root directory of the website in use. this file displays the metrics of the current apc in the form of a webpage, so that we can observe the running process of apc more intuitively. There are only two changes in this file: one is the login account and the other is the login password. the usage of the account and password will be described in detail.

defaults('ADMIN_USERNAME','username');         // Admin Usernamedefaults('ADMIN_PASSWORD','password');         // Admin Password - CHANGE THIS TO ENABLE!!!
We will access apc. in php, the following interface (partial) appears. "refresh Data" is used to refresh the Data, and "Version Check" is used to Check the Version, which is not the focus of our attention, we need to care about "View Host Stats", "System Cache Entries", and "User Cache Entries ".

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

"General Cache Information": an overview of apc Cache, including a series of Information such as apc version, php version, and apc host Information.

"File Cache Information": describes Information related to the system Cache. if conditions permit, apc automatically caches all accessed php pages. when a user accesses this page again, first, the cached file is read. the detailed information of the cached file is recorded in "System Cache Entries. Here is a statistics on the system cache, including Cached Files (number and size of Cached Files), Hits (number of cache Hits), and Misses (number of cache Hits ), request Rate (hits, misses) (Request Rate, including Hit and missed), Hit Rate (Request Hit Rate), Miss Rate (Request Miss Rate), Insert Rate (unknown ), cache full count (the maximum number of times the Cache has been exceeded ). Through this information, we can know the hit rate of the system cache, whether the cache content exceeds the upper limit, and then make corresponding adjustments according to the situation.


"User Cache Information": describes the User's Cache-related Information. Unlike the system Cache, the User Cache needs to be manually stored and called using functions such as apc_add, apc_store, and app_fetch. Cached Variables (number and size of cache Variables). Other information descriptions indicate the same meaning as those in the system cache.

Summary:

1. change the user name and password in the apc. php file

2 apc two functions: System cache-automatically cache php files, user cache-manually cache php variables

3 Cached Files (Variables) allows us to understand the number and size of Cached Variables. the Rate parameter allows us to understand the request hit Rate, the Cache full count shows that the memory allocated to apc is insufficient and needs to be adjusted.

The above introduces the apc extension analysis of php (I), including some content, and hope to be helpful to friends who are interested in PHP tutorials.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.