服务器运行了三十天,部分请求变慢了求解决
部署在阿里云上的服务器,双核,内存4G。centos6.4,apache,php5.3,mysql,Yii框架。PV一天三万多,负载并不高。
运行了三十天,这两天变得不太稳定,有时候出现请求时间长,大约1-10秒内。
通过MYSQL的profile记录了一下查询超过0.03秒的SQL语句,发现有时候update,closing tables,end,query end其中一两个耗时比较长,从0.几秒到几秒不等。而这些语句都是比较简单的update , insert , select语句。
还有一些请求是运行时间长,又没有SQL慢查询记录的。
同一样的请求,有时候就慢,有时候就快。。top命令监测下,CPU基本在10%多,内存30%,CPU wa一般都在30%以下,偶尔会到四十多。
求各位大神帮看看是什么原因。。
回复讨论(解决方案)
感觉是数据库设计问题,索引设计的问题。但是说mysql没有慢查询,就不清楚了。
查看一下各项日志,如:apache日志,mysql日志,看是否有异常现象。
阿里云的IO瓶颈问题不是一天两天了...
感觉是数据库设计问题,索引设计的问题。但是说mysql没有慢查询,就不清楚了。
如果是数据库设计问题的话,一些简单的语句应该不会有问题吧。。像Insert , update主键,select主键这些语句有时候都可以用1秒多
阿里云的IO瓶颈问题不是一天两天了...
感受到了~
查看一下各项日志,如:apache日志,mysql日志,看是否有异常现象。
看过了 日志并无异常。。
怎么说呢,觉得,国内的云服务器目前不是很靠谱,之前有用几台云服务器,时不时就不稳定,但是没遇过IO问题,主要是连不上,或者机器卡死。
数据量大了,自然查询速度就慢了。。。
你说的有时慢有时快,这跟并发量有关,也跟网络当前状况有关,还跟db当前的负载有关。
数据库的锁有时也会影响写的速度。尤其是你在运用了大量MYISAM表时,表级锁对于同时有读写操作的表来说是致命的。所以尽量都用innodb,除非你100%确定某个表对于用户来说永远没有写操作。
结果是阿里云的IO问题,导致的不稳定。。。坑爹的阿里云~ 暂无解决办法,只好等阿里云升级

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.
