iis - 如何彻底优化php程序降低CPU占用?
运行环境
- IIS7.0 ISAPI
- PHP5.2.17
- Mysql
- ZendOptimizer
程序情况描述
同一服务器环境下运行多套程序,程序是一套使用很长时间的老程序,现在在针对出现的问题优化,但是现在有一个严重的问题就是CPU占用高的情况亟待解决。程序是快速建站解决方案,首页是拖动布局,在这期间编辑添加资料的时候反馈网站卡,查看服务器环境,CPU占用很高,接着就卡死了,只能重启服务器解决。
猜测
- 远程下载模板程序时导致
- 后台资料操作
- 首页新增模块拖动布局
求解
如何定位哪些程序段会引起CPU占用高?
回复内容:
运行环境
- IIS7.0 ISAPI
- PHP5.2.17
- Mysql
- ZendOptimizer
程序情况描述
同一服务器环境下运行多套程序,程序是一套使用很长时间的老程序,现在在针对出现的问题优化,但是现在有一个严重的问题就是CPU占用高的情况亟待解决。程序是快速建站解决方案,首页是拖动布局,在这期间编辑添加资料的时候反馈网站卡,查看服务器环境,CPU占用很高,接着就卡死了,只能重启服务器解决。
猜测
- 远程下载模板程序时导致
- 后台资料操作
- 首页新增模块拖动布局
求解
如何定位哪些程序段会引起CPU占用高?
IIS有问题。一看到IIS我就醉了。而且PHP5.2的版本。西部数码的服务器?而且是一次安装包配置的?不是手动配置的环境!和我上个月碰到d情况一模一样。他妈的一个客户IIS的。运行10分钟服务器崩溃一次。老子10分钟重启一次。老是PHP has encountered a access violation at XXXXXXX.这傻逼错误气死人。后来搬到liunx在也没有问题。PHP你还是早点脱坑吧入Liunx吧。不然到时候有你受的。实在不行。你就慢慢拍问题吧。网上说法众多。
第一种说是PHP的BUG!这种说法来源于国外。认为只会在win上的PHP出现这种问题。解决办法就是升级PHP版本。或者gai服务器系统。
第二种说法是mysql的配置问题。需要更改环境变量的顺序?
第三说法就是PHP的mysql扩展不对。要放到system 32
第4个是程序问题。但我想你的程序是老代码。应该运行时间已经很长了。并且已经做过测试。这种情况代码查处问题的可能性比较低。
骚年。慢慢排除问题吧。
占用CPU高,一般意味着有大量的计算或死循环,可以试着用xhprof分析一下。
CPU占用高可用从这几个层面分析。
1.有大量运算,无限运算。
2.脚本执行本身就耗时,比如处理图像。
3.环境问题,请使用LAMP经典组合。环境配置请参见http://lnmp.org/install.html
请放弃windows用LAMP或者LNMP。
另外,想彻底,用底层语言自己写php模块
使用ISAPI方式,那确实就是自寻烦恼。PHP在IIS的配置,微软官方唯一支持的方式就是FastCGI,
https://secure.php.net/manual/en/install.windows.iis7.php
而PHP 5.2的生命周期早已结束,继续使用它则是另一个自寻烦恼的地方了
https://en.wikipedia.org/wiki/PHP

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



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.
