One Hundred Percent CPU

Humor
15 Comments

Raise Your Hand If

You’ve ever wanted to play a prank on your co-workers, but just didn’t have a any ideas that didn’t involve exploding Hot Pockets.

Now you have something even less safe than molten cheese squirts!

A stored procedure that pushes CPUs to 100%.

All of’em.

 

Probably Don’t Do This In Production

We got this tested on 48 cores, and it was pretty sweet.

RUN, FORREST, RUN

Special thanks to Forrest for testing this out on his dev server for me.

At least I hope it was.

Thanks for reading!

Brent says: wanna test your monitoring or alerting processes and see how quickly folks get alerted, start troubleshooting, and get to a root cause? Run this in your QA environment and see how fast folks react.

Previous Post
Free Training Classes for Those Who Give Back: Announcing our 2019 Scholarships
Next Post
A Simple Stored Procedure Pattern To Avoid

15 Comments. Leave new

  • Why do I get the feeling that y’all come up with these things to be devious/nefarious and then look for a logical application after-the-fact to explain why you did it in the first place?

    Reply
  • Thank you for making me laugh today (really)! I don’t know if it’s funny because I know what its doing, or because of what it does. Probably both.

    Reply
  • Get thee behind me, Satan! And push!

    Reply
  • There’s a “Bad Idea Jeans” category on this blog for a reason, Erik.

    Reply
  • Was this that sample code they ran at PASS Summit a couple years back? 😉

    Reply
  • Can’t get the average CPU much above 50% while running this.

    Reply
    • Oh, interesting. This has been run on a lot of different servers now. How are you measuring that?

      Reply
      • I used Resource Monitor. First try was on SQL Server 2012 and it barely pushed 45% CPU. I just installed SQL Server 2017 on the same server and ran it there and it immediately hit 100% CPU.

        Reply
        • Ok the plans are very different between 2012 and 2017. On SQL Server 2017 it immediately hits 100% cpu but if I switch the compatibility level to 110 and run it then SQL Server 2017 behaves like the SQL Server 2012 with only medium cpu use.

          Fun experiment.

          Reply
          • Howard — interesting! If you can alter it to hit 100% CPU in the lower compat level, I’ll make Brent give you something!

            Thanks!

          • Heh… bloody “improved” Cardinality Estimator strikes again.

            Heh… most people don’t need such code, though. They’ve got users and processes that just come by such levels all by themselves.

  • Excellent… muahahahahahahaaaaa

    Reply
  • Carlos Garcia
    July 23, 2020 4:05 pm

    Interesting,

    * 2008 compatibility level I get a litle bit more than 80 % CPU usage on a quad core server

    * 2014 compatibility mode, it gets to 100 % immediatly

    * 2017 compatibility mode, it gets to 100 % immediatly

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.