A simple way to make a high CPU

Source: Internet
Author: User
Tags high cpu usage

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

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.