Home Backend Development PHP Tutorial 服务器运作了三十天,部分请求变慢了求解决

服务器运作了三十天,部分请求变慢了求解决

Jun 13, 2016 pm 12:48 PM
apache centos mysql nbsp update

服务器运行了三十天,部分请求变慢了求解决
部署在阿里云上的服务器,双核,内存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%以下,偶尔会到四十多。

求各位大神帮看看是什么原因。。

服务器 centos mysql php
------解决方案--------------------
感觉是数据库设计问题,索引设计的问题。但是说mysql没有慢查询,就不清楚了。
------解决方案--------------------
查看一下各项日志,如:apache日志,mysql日志,看是否有异常现象。
------解决方案--------------------
阿里云的IO瓶颈问题不是一天两天了...
------解决方案--------------------
怎么说呢,觉得,国内的云服务器目前不是很靠谱,之前有用几台云服务器,时不时就不稳定,但是没遇过IO问题,主要是连不上,或者机器卡死。
------解决方案--------------------
数据量大了,自然查询速度就慢了。。。

你说的有时慢有时快,这跟并发量有关,也跟网络当前状况有关,还跟db当前的负载有关。


数据库的锁有时也会影响写的速度。尤其是你在运用了大量MYISAM表时,表级锁对于同时有读写操作的表来说是致命的。所以尽量都用innodb,除非你100%确定某个表对于用户来说永远没有写操作。
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

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Laravel Introduction Example Laravel Introduction Example Apr 18, 2025 pm 12:45 PM

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

Laravel framework installation method Laravel framework installation method Apr 18, 2025 pm 12:54 PM

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

How to safely store JavaScript objects containing functions and regular expressions to a database and restore? How to safely store JavaScript objects containing functions and regular expressions to a database and restore? Apr 19, 2025 pm 11:09 PM

Safely handle functions and regular expressions in JSON In front-end development, JavaScript is often required...

Why does the Python script not be found when submitting a PyFlink job on YARN? Why does the Python script not be found when submitting a PyFlink job on YARN? Apr 19, 2025 pm 02:06 PM

Analysis of the reason why Python script cannot be found when submitting a PyFlink job on YARN When you try to submit a PyFlink job through YARN, you may encounter...

How to process and display percentage numbers in Java? How to process and display percentage numbers in Java? Apr 19, 2025 pm 10:48 PM

Display and processing of percentage numbers in Java In Java programming, the need to process and display percentage numbers is very common, for example, when processing Excel tables...

CentOS: What Led to the Decision to End Support CentOS: What Led to the Decision to End Support Apr 23, 2025 am 12:10 AM

RedHatendedsupportforCentOStoshifttowardsacommerciallyfocusedmodelwithCentOSStream.1)CentOStransitionedtoCentOSStreamforRHELdevelopment.2)ThisencourageduserstomovetoRHEL.3)AlternativeslikeAlmaLinux,RockyLinux,andOracleLinuxemergedasreplacements.

See all articles