People in the group today asked for a scenario where high CPU usage was used for testing. It's easy to do "bad" things because it's so hard to do things. There are many ways to implement this requirement, such as using some stress testing tools. The first thing I think about is a hash JOIN. This connection consumes CPU resources, take two big table hash join, preferably contains large number of paragraphs, open more than a few processes, CPU usage immediately soared to 80-90%!
The following is a system view using a hash join to achieve, simple and fast.
DECLARE @i bigintwhile (1=1) Beginselect @i = COUNT (*) from sys.all_objects as Aleft HASH JOIN sys.all_objects as B on b.na me = A.nameend; GO
Code-1: HASH JOIN
I only opened four sessions in SSMs and ran the script above. After the test, manually abort the run script.
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/7F/4C/wKiom1cY5y2zcCfYAALiXrsz4_E408.jpg "style=" float: none; "Title=" Unnamed QQ screenshot20160421224134.jpg "alt=" wkiom1cy5y2zccfyaalixrsz4_e408.jpg "/>"
Figure-1: Performance counters Display CPU usage
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/7F/4C/wKiom1cY5y_g6xE_AALVmuA33lg024.jpg "style=" float: none; "Title=" Unnamed QQ screenshot20160421224217.jpg "alt=" wkiom1cy5y_g6xe_aalvmua33lg024.jpg "/>"
Figure-2: CPU Resource Usage shown by Task Manager
This article is from the "fishparadise" blog, make sure to keep this source http://fishparadise.blog.51cto.com/11284420/1766446
A simple way to make a high CPU