Resolving w3wp.exe mysqld.exe process cpu100 % method

Source: Internet
Author: User
Tags iis memory usage php and mysql regular expression cpu usage

Let's talk about W3WP. EXE.

Q: Relationship between W3WP. EXE, applications, and application pools
A: An application pool can contain multiple applications. One application pool creates A W3WP. EXE process. therefore, we cannot simply say that a process pool corresponds to a W3WP. EXE process now! In fact, multiple application process pools correspond to a W3WP. EXE process.

Applicable version

All DiscuzX products (1.0/1.5/2.0/2.5/3.0/3.1)

Program check

1. Check whether some plug-ins have been installed or programs recently, and check whether the code has unreasonable syntax or endless loops. For example, disable unnecessary plug-ins. We recommend that you use diy or templates for similar features on homepage N. We do not recommend using plug-ins.
2. Disable unnecessary projects on the cloud platform, such as vertical and horizontal search.
3. Manually set the interface ip address on the cloud platform to optimize the selection speed
4. Enable related optimization and caching in the background configuration. If possible, we recommend that you enable memcache memory optimization.
5. Disable informal alliance advertisements
6. Enable CC attacks if necessary:

Reference
$ _ Config ['security'] ['attackevasive '] = 0; (0 indicates disabling this function)
0 indicates disabling this function
1 indicates cookie refresh restriction
2: restrict proxy access
4 indicates a second request
8. Answer the question (you need to answer the question during the first visit)
You can also set it to a combination. For example, 1 | 2 indicates enabling cookie refreshing to restrict and restrict proxy access at the same time.

Solve the seo/seo.html "target =" _ blank "> search engine index problem. Open/sourcehttp: // www.111cn.net/include/misc/misc_security.php in the main directory.

File found

The code is as follows: Copy code
If ($ attackevasive & 4 ){
If (empty ($ lastrequest) | TIMESTAMP-$ lastreetquest> 300 ){
Securitymessage ('attackevasive _ 4_subject ', 'attackevasive _ 4_message ');
      }
  }
To:
If ($ attackevasive & 4 ){
If (empty ($ lastrequest) | TIMESTAMP-$ lastreetquest> 300 ){
$ Kw_spiders = 'bot | Crawl | Spider ';
// Keywords regular expression of search engine spiders
If (preg_match ("/($ kw_spiders)/I", $ _ SERVER ['http _ USER_AGENT ']) {
// Match search engine spiders
} Else {
Securitymessage ('attackevasive _ 4_subject ', 'attackevasive _ 4_message ');
      }
  }

7. Create an index for the corresponding field for the SQL query of a table with a large data volume (effective defense against the 100% or unstable mysqld.exe process)
For example, alter table 'pre _ threads' add index ('Dateline ');

 

Solve the problem of excessive CPU usage:

1. Configure a separate application pool for each website in IIS. That is, they do not affect each other.
2. Set the CPU monitoring of the application pool to no more than 25% (4 CPU for the server), refresh every minute, and close when the limit is exceeded.
The app pool is obtained based on w3wp:
1. Add the pid field to the task manager. You can see the process pid with the highest memory usage or cpu usage.
2. Run iisapp-a at the command prompt. Note: the first running will prompt that no js support is available. Click OK. Then run it again. In this way, you can see the application pool corresponding to the pid. (Iisapp is actually a VBS script stored in the C: \ windows \ system32 directory. Its full name is iisapp. vbs: if the default Vbs associated program is disabled, you need to manually enter the Directory, select the open mode, and then select "Microsoft (r) Windows Based Script Host" for execution, the relationship between the PID and the application pool can be obtained .)
3. Check the website corresponding to the application pool in iis, and then make the above memory or CPU restrictions, or check whether the program has problems such as endless loops.
A2: by mini dance
Check that the cpu-consuming w3wp process contains the user call token.

Q: The w3wp.exe problem occurs after a program is installed.
A: modify C: \ WINDOWS \ Microsoft. NET \ Framework \ v1.1.4322 \ CONFIG \ machine. config, configure the node <processModel> with a property "memoryLimit". The value of this property is a percentage. The default value is "60" (note that 60% is not 60 M ), ASP. NET process can use 60% of all the physical memory, when ASP. NET, IIS starts to automatically recycle the process, that is, create a new process to handle HTTP requests, and reclaim the memory occupied by the old process.

Server check

1. Whether to install some plug-ins or software on the server Recently. We recommend that you uninstall the software and plug-ins that are not commonly used on the server.
2. Download all installed plug-ins from its official website.
3. Optimize configuration and install components such as php and mysql
4. Analyze slow programs and slow SQL statements based on server-related log data, and run the mysql show processlist command to check which threads are currently running.
5. If possible, we recommend that you configure memcache optimization.
6. Analyze the server's attack, anti-leeching, and collection based on server-related log data
7. Configure restrictions on the application pool corresponding to w3wp (of course, the premise is that each website on your server needs to be configured with a separate application pool ), you can use iisapp-a to view the application pool corresponding to the w3wp process pid.
8. Scan the entire server file for Trojan viruses
9. Delete the IIS log on the current day and restart the IIS service (when IIS is interrupted due to exceptions, IIS will write exception logs, but garbled characters are written at this time, causing an endless loop of IIS log writing, system resources are exhausted .)
10. We recommend that you replace it with a linux system.

SQL syntax analysis of mysql

I. Syntax

Explain <table_name>

Example: explain select * from t3 where id = 3952602;

You can add the explain statement before the select statement:

The code is as follows: Copy code
Mysql> explain select count (id) from t_prehandle_zhigao_05 as zhigao where start_time> '2017-05-30 ';
+ ---- + ------------- + -------- + ------- + --------------- + ------------ + --------- + ------ + --------- + ---------------------------- +
| Id | select_type | table | type | possible_keys | key www.111cn.net | key_len | ref | rows | Extra |
+ ---- + ------------- + -------- + ------- + --------------- + ------------ + --------- + ------ + --------- + ---------------------------- +
| 1 | SIMPLE | zhigao | range | start_time | 8 | NULL | 1061762 | Using where; Using index |
+ ---- + ------------- + -------- + ------- + --------------- + ------------ + --------- + ------ + --------- + ---------------------------- +

Explanation of the XPLAIN column: www.111cn.net
The table displays the data of this row about which table
Type is an important column that shows the type used by the connection. The best to worst connection type is system> const> eq_ref> ref> fulltext> ref_or_null> index_merge> unique_subquery> index_subquery> range> index> ALL.
Type: indicates the table connection type. The type of performance from good to bad is
(System (the table has only one row, that is, the constant table ),
Const (a single table can have at most one matching row ),
Eq_ref (for each row above, only one record is queried in this table ),
Ref (using common indexes ),
Ref_or_null (similar to ref, but the condition contains NULL queries ),
Index_merge (index merge optimization ),
Unique_subquery (in is followed by a subquery that queries the primary key field ),
Index_subquery (similar to unique_subquery, which is followed by subqueries for non-unique index fields ),
Range (range query in a single table ),
Index (for each current row, data is obtained by querying the index ),
All (for each current row, data is obtained through full table scan ))

Possible_keys: displays the indexes that may be applied to this table. If it is null, there is no possible index. You can select an appropriate statement from the WHERE statement for the relevant domain.
The index actually used by the key. If it is NULL, no index is used. In rare cases, MYSQL selects an optimized index. In this case, you can use index (indexname) in the SELECT statement to force an INDEX or use ignore index (indexname) to force MYSQL to IGNORE the INDEX.
The length of the index used by key_len. The shorter the length, the better.
Ref indicates which column of the index is used. If possible, it is a constant.
Rows MYSQL considers the number of rows that must be checked to return the requested data
Extra additional information about how MYSQL parses the query. We will discuss it in Table 4.3, but here we can see that the bad examples are Using temporary and Using filesort, which means MYSQL cannot use indexes at all, and the result is that the retrieval will be slow.

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.