{"id":77822,"date":"2020-09-29T12:00:10","date_gmt":"2020-09-29T09:00:10","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/automate-code-performance-reviews-with-aws-codeguru-cloudsavvy-it\/"},"modified":"2020-09-29T12:00:10","modified_gmt":"2020-09-29T09:00:10","slug":"automate-code-performance-reviews-with-aws-codeguru-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/automate-code-performance-reviews-with-aws-codeguru-cloudsavvy-it\/","title":{"rendered":"#Automate Code Performance Reviews with AWS CodeGuru \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2884e13d342\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2884e13d342\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/automate-code-performance-reviews-with-aws-codeguru-cloudsavvy-it\/#What_Does_CodeGuru_Do\" >What Does CodeGuru Do?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/automate-code-performance-reviews-with-aws-codeguru-cloudsavvy-it\/#Using_the_Profiler\" >Using the Profiler<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#Automate Code Performance Reviews with AWS CodeGuru \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5269\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/0eb3564906a864c93706b30eaca199af\/p\/uploads\/2020\/06\/e601b806.png\" alt=\"AWS Logo\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>CodeGuru is a service from AWS that can automatically analyze your code for common performance issues and other bugs like race conditions and memory leaks. If you\u2019re paying for the server it runs on, wasted CPU time is wasted money.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_Does_CodeGuru_Do\"><\/span>What Does CodeGuru Do?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Basically, CodeGuru is a machine-learning algorithm trained and tuned to provide recommendations to improve performance of your <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>lications. CodeGuru scans your codebase to find problematic lines of code that can be optimized to prevent wasted CPU cycles. This feature is called the CodeGuru Profiler.<\/p>\n<p>In addition to finding performance issues, CodeGuru also has another feature, the CodeGuru Reviewer, which is trained on application best practices and can catch common problems like resource leaks, race conditions, or problematic error handling.<\/p>\n<p>Of course CodeGuru isn\u2019t meant to completely replace human code reviews, and it isn\u2019t meant to do UI testing in any form. However, it will catch the things that humans may miss, and can do automated testing on every area of your application.<\/p>\n<p>CodeGuru, like most of AWS, has pay-as-you-go pricing, and is low enough to be run for every code review. For a typical pull request with 500 lines of code, AWS estimates that it would only cost $3.75 to run CodeGuru Reviewer on it. Obviously that will add up depending on how many pull requests you have, but for what it offers and the potential compute savings, CodeGuru will pay for itself for many people.<\/p>\n<p>Unfortunately, CodeGuru currently only supports Java applications. However, more languages are planned to be supported soon, and it will work largely the same. If you\u2019re reading this in the future, you can <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/aws.amazon.com\/codeguru\/?tag=reviewgeek-20\">check their website<\/a> to see which languages are supported.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Using_the_Profiler\"><\/span>Using the Profiler<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Head over to the <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"http:\/\/redirect.viglink.com?u=https%3A%2F%2Fconsole.aws.amazon.com%2Fcodeguru%2Fhome&amp;key=204a528a336ede4177fff0d84a044482\">CodeGuru Management Console<\/a>, and select \u201cProfiling Groups\u201d from the sidebar. You can create your own here, but there are two groups already made that you can explore to see how it works. We\u2019ll open up the one \u201cWith Issues\u201d to take a look.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4841\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/dac7825a0e6c40500e3669a9ce848f72\/p\/uploads\/2020\/05\/580e2ae7.png\" alt=\"profiling groups\" width=\"700\" height=\"253\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>On the main screen, you\u2019ll see a graph of all the time the CPU spends executing various functions. The flat tops are areas where the CPU is doing work in a particular function, and not spent calling other methods.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4842\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/5587a4a942c32a35371c1a7f31cf0c5a\/p\/uploads\/2020\/05\/eb3b5b2f.png\" alt=\"profiler\" width=\"700\" height=\"259\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>For example, compared to other the demo repository without issues, the code runs quicker and spends more time doing work.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" imgchk9 alignnone wp-image-4843 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/8bde3914c18374f4e14450a62dc8e1a9\/p\/uploads\/2020\/05\/1ba33b22.png\" alt=\"Code runs quicker and spends more time working\" width=\"700\" height=\"282\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>If you click on the \u201cRecommendations\u201d button, you\u2019ll be presented with a list of things CodeGuru finds that can be optimized. For example, in the demo with issues, 10% of the time was spent creating <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/fasterxml.github.io\/jackson-databind\/javadoc\/2.10\/com\/fasterxml\/jackson\/databind\/ObjectMapper.html\"><code>ObjectMappers<\/code><\/a>, which are slow to create and should only be created once as a result. CodeGuru recommends initializing this as a static variable to solve this issue.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" imgchk9 alignnone wp-image-4844 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/94c9f41898fdc7d92dd9598d649ec743\/p\/uploads\/2020\/05\/1c20e27d.png\" alt=\"10% of the time was spent creating ObjectMappers \" width=\"700\" height=\"207\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>CodeGuru will tell you which functions contain the problematic code, so you can narrow down the problem and get to fixing it quickly.<\/p>\n<p>As for testing your own applications, it\u2019s pretty easy. Create a new profiling group, and you\u2019ll be given instructions on how to integrate the profiler in your application, either by running your JVM with a special <code>-javaagent<\/code>\u00a0parameter, or by integrating it directly into your app.<\/p>\n<p>Either way, start your application and run the profiler. After 5 minutes, the first profile will be submitted, which may take up to 15 minutes to process.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4845\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/f6e9acb114c07770d50bdd7856fb7bae\/p\/uploads\/2020\/05\/cf336c93.png\" alt=\"download jar file for profiler\" width=\"700\" height=\"158\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>For the code reviewer, which gives non-performance recommendations, you\u2019ll simply need to link your repository to CodeGuru under \u201cAssociated Repositories.\u201d After that, you\u2019ll see code reviews for every pull request.\n<\/p><\/div>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener noreferrer\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/4839\/automate-code-performance-reviews-with-aws-codeguru\/\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#Automate Code Performance Reviews with AWS CodeGuru \u2013 CloudSavvy IT&#8221; CodeGuru is a service from AWS that can automatically analyze your code for common performance issues and other bugs like race conditions and memory leaks. If you\u2019re paying for the server it runs on, wasted CPU time is wasted money. What Does CodeGuru Do? Basically,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":77823,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/06\/e601b806.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-77822","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/77822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=77822"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/77822\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/77823"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=77822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=77822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=77822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}