search
HomeDatabaseMysql Tutorial监测和管理Xcache状态

监测和管理Xcache状态

Jun 07, 2016 pm 03:59 PM
xcacheuseComparestatemonitormanage

Xcache是一个使用比较多的Opcode缓存器,很多时候,我们为了让脚本的执行效率更加高,可以采取这种缓存器,它可以让脚本引擎不用每次都去编译执行,可以在一次编译后,把Opcode缓存起来,直接去执行,效率会提升30%-40%左右,当PHP文件被更改过以后,Xcache

Xcache是一个使用比较多的Opcode缓存器,很多时候,我们为了让脚本的执行效率更加高,可以采取这种缓存器,它可以让脚本引擎不用每次都去编译执行,可以在一次编译后,把Opcode缓存起来,直接去执行,效率会提升30%-40%左右,当PHP文件被更改过以后,Xcache会自动讲该文件的缓存,从Opcode管理器中踢出,执行到该文件时,重新进行缓存,之前写过如何在Centos上部署安装Xcache。

在部署好以后,我们如何进一步去查看它的工作状态,是否为我们提升了效率呢,缓存命中率是多少呢,为它分配的内存占比达到了多少呢,需要清除某一个文件的缓存,该如何操作?

找到xcache的安装目录,把xcache下的htdocs目录,拷贝到网站根目录,重新命名,使用网址去访问,即可。

cp -a ./xcache-3.1.0/htdocs/ /usr/local/nginx/html/opcache

打开php.ini文件,配置好用户名和密码。

[xcache.admin]
xcache.admin.auth = On
xcache.admin.user = "mingkrcom"
; xcache.admin.pass = md5($your_password) 密码配置必须是MD5加密后的字符串
xcache.admin.pass = "ce9fc7cbd0f755edg293eh7ga0781f1"

如果在安装时,配置过了,不用重复添加。

可以看到分配的内存是128M,缓存占比剩下52.63M,以及命中率等参数。

\

以及诊断结果页面,看到了xcache针对你的服务器给出的建议。

\

PHP文件的缓存,显示了文件路径地址,可以看到文件的命中率,以及缓存大小。

\

也可以看到使用Xcache进行的变量缓存数据,建议不要使用xcache来缓存变量,如果要缓存变量,建议使用Memcache或者redis。

n块r殕窡PHP脚本,建议安装一下该平台,可以实时查看缓存数据。

相关链接

Statement
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
What are the differences in syntax between MySQL and other SQL dialects?What are the differences in syntax between MySQL and other SQL dialects?Apr 27, 2025 am 12:26 AM

MySQLdiffersfromotherSQLdialectsinsyntaxforLIMIT,auto-increment,stringcomparison,subqueries,andperformanceanalysis.1)MySQLusesLIMIT,whileSQLServerusesTOPandOracleusesROWNUM.2)MySQL'sAUTO_INCREMENTcontrastswithPostgreSQL'sSERIALandOracle'ssequenceandt

What is MySQL partitioning?What is MySQL partitioning?Apr 27, 2025 am 12:23 AM

MySQL partitioning improves performance and simplifies maintenance. 1) Divide large tables into small pieces by specific criteria (such as date ranges), 2) physically divide data into independent files, 3) MySQL can focus on related partitions when querying, 4) Query optimizer can skip unrelated partitions, 5) Choosing the right partition strategy and maintaining it regularly is key.

How do you grant and revoke privileges in MySQL?How do you grant and revoke privileges in MySQL?Apr 27, 2025 am 12:21 AM

How to grant and revoke permissions in MySQL? 1. Use the GRANT statement to grant permissions, such as GRANTALLPRIVILEGESONdatabase_name.TO'username'@'host'; 2. Use the REVOKE statement to revoke permissions, such as REVOKEALLPRIVILEGESONdatabase_name.FROM'username'@'host' to ensure timely communication of permission changes.

Explain the differences between InnoDB and MyISAM storage engines.Explain the differences between InnoDB and MyISAM storage engines.Apr 27, 2025 am 12:20 AM

InnoDB is suitable for applications that require transaction support and high concurrency, while MyISAM is suitable for applications that require more reads and less writes. 1.InnoDB supports transaction and bank-level locks, suitable for e-commerce and banking systems. 2.MyISAM provides fast read and indexing, suitable for blogging and content management systems.

What are the different types of JOINs in MySQL?What are the different types of JOINs in MySQL?Apr 27, 2025 am 12:13 AM

There are four main JOIN types in MySQL: INNERJOIN, LEFTJOIN, RIGHTJOIN and FULLOUTERJOIN. 1.INNERJOIN returns all rows in the two tables that meet the JOIN conditions. 2.LEFTJOIN returns all rows in the left table, even if there are no matching rows in the right table. 3. RIGHTJOIN is contrary to LEFTJOIN and returns all rows in the right table. 4.FULLOUTERJOIN returns all rows in the two tables that meet or do not meet JOIN conditions.

What are the different storage engines available in MySQL?What are the different storage engines available in MySQL?Apr 26, 2025 am 12:27 AM

MySQLoffersvariousstorageengines,eachsuitedfordifferentusecases:1)InnoDBisidealforapplicationsneedingACIDcomplianceandhighconcurrency,supportingtransactionsandforeignkeys.2)MyISAMisbestforread-heavyworkloads,lackingtransactionsupport.3)Memoryengineis

What are some common security vulnerabilities in MySQL?What are some common security vulnerabilities in MySQL?Apr 26, 2025 am 12:27 AM

Common security vulnerabilities in MySQL include SQL injection, weak passwords, improper permission configuration, and unupdated software. 1. SQL injection can be prevented by using preprocessing statements. 2. Weak passwords can be avoided by forcibly using strong password strategies. 3. Improper permission configuration can be resolved through regular review and adjustment of user permissions. 4. Unupdated software can be patched by regularly checking and updating the MySQL version.

How can you identify slow queries in MySQL?How can you identify slow queries in MySQL?Apr 26, 2025 am 12:15 AM

Identifying slow queries in MySQL can be achieved by enabling slow query logs and setting thresholds. 1. Enable slow query logs and set thresholds. 2. View and analyze slow query log files, and use tools such as mysqldumpslow or pt-query-digest for in-depth analysis. 3. Optimizing slow queries can be achieved through index optimization, query rewriting and avoiding the use of SELECT*.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool