{"id":20306,"date":"2013-05-10T12:49:34","date_gmt":"2013-05-10T07:19:34","guid":{"rendered":"http:\/\/vskills.in\/certification\/tutorial\/?p=20306"},"modified":"2024-04-12T14:16:40","modified_gmt":"2024-04-12T08:46:40","slug":"heap-and-thread-monitoring","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/","title":{"rendered":"Heap and thread monitoring"},"content":{"rendered":"<p><a class=\"vsc\" href=\"http:\/\/www.vskills.in\/certification\/Certified-Cassandra-Professional\"><span class=\"vsc-cn\" style=\"text-align: center;\"><span style=\"color: red;\">Certify and Increase Opportunity.<\/span><br \/>\n<span style=\"color: green;\">Be <\/span><br \/>\nGovt. Certified Apache Cassandra Professional<br \/>\n<\/span><\/a><\/p>\n<p><strong>Heap and thread monitoring<\/strong><\/p>\n<p style=\"text-align: center;\"><a ref=\"magnificPopup\" href=\"http:\/\/vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-40058\" src=\"http:\/\/vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png\" alt=\"binary heap\" width=\"362\" height=\"361\" srcset=\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png 362w, https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap-150x150.png 150w, https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap-300x300.png 300w\" sizes=\"auto, (max-width: 362px) 100vw, 362px\" \/><\/a><\/p>\n<p>While Java takes care most of the details of memory and heap management, situations can occur where memory is never reclaimed. This recipe uses two java tools jmap and jhat, to capture a heap dump and examine it.<\/p>\n<p>Steps to complete it<br \/>\nDetermine the pid of a running java process<br \/>\n$ ps -ef | grep java<br \/>\nedward&nbsp;&nbsp;&nbsp; 3736&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp; 1 01:46 pts\/0&nbsp;&nbsp;&nbsp; 00:00:06<\/p>\n<p>Use the jmap tool to dump the heap to a file.<br \/>\n$ jmap&nbsp; -dump:file=b&nbsp; 3736<br \/>\nDumping heap to \/home\/edward\/hpcas\/b \u2026<br \/>\nHeap dump file created<\/p>\n<p>Start a jhat web server on 7001 (this defaults to 7000 the cassandra storage port.<br \/>\n$jhat -port 7001 \/home\/edward\/hpcas\/b<br \/>\nChasing references, expect 15 dots\u2026\u2026\u2026\u2026\u2026<br \/>\nEliminating duplicate references\u2026\u2026\u2026\u2026\u2026<br \/>\nSnapshot resolved.<br \/>\nStarted HTTP server on port 7001<br \/>\nServer is ready.<\/p>\n<p>Jhat and jmap allow you to capture and review heap dumps. This is a valuable tool when chasing down memory leaks or un-explained memory usage.<\/p>\n<p><span style=\"text-decoration: underline;\">Tuning Java Heap<\/span><\/p>\n<p>Because Cassandra is a database, it spends significant time interacting with the operating system&#8217;s I\/O infrastructure through the JVM, so a well-tuned Java heap size is important. Cassandra&#8217;s default configuration opens the JVM with a heap size that is based on the total amount of system memory:<\/p>\n<table border=\"1\">\n<colgroup>\n<col width=\"28%\">\n<col width=\"72%\"> <\/colgroup>\n<thead valign=\"bottom\">\n<tr>\n<th>System Memory<\/th>\n<th>Heap Size<\/th>\n<\/tr>\n<\/thead>\n<tbody valign=\"top\">\n<tr>\n<td>Less than 2GB<\/td>\n<td>1\/2 of system memory<\/td>\n<\/tr>\n<tr>\n<td>2GB to 4GB<\/td>\n<td>1GB<\/td>\n<\/tr>\n<tr>\n<td>Greater than 4GB<\/td>\n<td>1\/4 system memory, but not more than 8GB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>General Guidelines<\/strong><\/p>\n<p>Many users new to Cassandra are tempted to turn up Java heap size too high, which consumes the majority of the underlying system&#8217;s RAM. In most cases, increasing the Java heap size is actually detrimental for these reasons:<\/p>\n<ul>\n<li>In most cases, the capability of Java 6 to gracefully handle garbage collection above 8GB quickly diminishes.<\/li>\n<li>Modern operating systems maintain the OS page cache for frequently accessed data and are <em>very<\/em> good at keeping this data in memory, but can be prevented from doing its job by an elevated Java heap size.<\/li>\n<\/ul>\n<p>To change a JVM setting, modify the cassandra-env.sh file.<\/p>\n<p>Because MapReduce runs outside the JVM, changes to the JVM do not affect Hadoop operations directly.<\/p>\n<div id=\"thread-pool-statistics\">\n<h3>Thread Pool Statistics<\/h3>\n<p>Cassandra maintains distinct thread pools for different stages of execution. Each of these thread pools provide statistics on the number of tasks that are active, pending and completed. Watching trends on these pools for increases in the pending tasks column is an excellent indicator of the need to add additional capacity. Once a baseline is established, alarms should be configured for any increases past normal in the pending tasks column. Details on each thread pool are<\/p>\n<table border=\"1\">\n<colgroup>\n<col width=\"24%\">\n<col width=\"76%\"> <\/colgroup>\n<thead valign=\"bottom\">\n<tr>\n<th>Thread Pool<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody valign=\"top\">\n<tr>\n<td>AE_SERVICE_STAGE<\/td>\n<td>Shows anti-entropy tasks<\/td>\n<\/tr>\n<tr>\n<td>CONSISTENCY-MANAGER<\/td>\n<td>Handles the background consistency checks if they were triggered from the client&#8217;s <cite>consistency level &lt;consistency&gt;<\/cite><\/td>\n<\/tr>\n<tr>\n<td>FLUSH-SORTER-POOL<\/td>\n<td>Sorts flushes that have been submitted<\/td>\n<\/tr>\n<tr>\n<td>FLUSH-WRITER-POOL<\/td>\n<td>Writes the sorted flushes<\/td>\n<\/tr>\n<tr>\n<td>GOSSIP_STAGE<\/td>\n<td>Activity of the Gossip protocol on the ring<\/td>\n<\/tr>\n<tr>\n<td>LB-OPERATIONS<\/td>\n<td>The number of load balancing operations<\/td>\n<\/tr>\n<tr>\n<td>LB-TARGET<\/td>\n<td>Used by nodes leaving the ring<\/td>\n<\/tr>\n<tr>\n<td>MEMTABLE-POST-FLUSHER<\/td>\n<td>Memtable flushes that are waiting to be written to the commit log.<\/td>\n<\/tr>\n<tr>\n<td>MESSAGE-STREAMING-POOL<\/td>\n<td>Streaming operations. Usually triggered by bootstrapping or decommissioning nodes.<\/td>\n<\/tr>\n<tr>\n<td>MIGRATION_STAGE<\/td>\n<td>Tasks resulting from the call of <tt>system_*<\/tt> methods in the API that have modified the schema<\/td>\n<\/tr>\n<tr>\n<td>MISC_STAGE<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>MUTATION_STAGE<\/td>\n<td>API calls that are modifying data<\/td>\n<\/tr>\n<tr>\n<td>READ_STAGE<\/td>\n<td>API calls that have read data<\/td>\n<\/tr>\n<tr>\n<td>RESPONSE_STAGE<\/td>\n<td>Response tasks from other nodes to message streaming from this node<\/td>\n<\/tr>\n<tr>\n<td>STREAM_STAGE<\/td>\n<td>Stream tasks from this node<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3><\/h3>\n<div class=\"apply\">\n<h3>Apply for Apache Cassandra Certification Now!!<\/h3>\n<p><a href=\"http:\/\/www.vskills.in\/certification\/Certified-Cassandra-Professional\">http:\/\/www.vskills.in\/certification\/Certified-Apache-Cassandra-Professional<\/a><\/p>\n<h5>Go To Tutorial-&nbsp;<a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/apache-cassandra-professional\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Certified Apache Cassandra Professional Tutorial<\/strong><\/a><\/h5>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Certify and Increase Opportunity. Be Govt. Certified Apache Cassandra Professional Heap and thread monitoring While Java takes care most of the details of memory and heap management, situations can occur where memory is never reclaimed. This recipe uses two java tools jmap and jhat, to capture a heap dump and examine it. Steps to complete&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[63],"tags":[],"class_list":["post-20306","page","type-page","status-publish","hentry","category-apache-cassandra"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Heap and thread monitoring - Tutorial<\/title>\n<meta name=\"description\" content=\"Heap and thread monitoring. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Heap and thread monitoring - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Heap and thread monitoring. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:46:40+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/\",\"name\":\"Heap and thread monitoring - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png\",\"datePublished\":\"2013-05-10T07:19:34+00:00\",\"dateModified\":\"2024-04-12T08:46:40+00:00\",\"description\":\"Heap and thread monitoring. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/#primaryimage\",\"url\":\"http:\/\/vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png\",\"contentUrl\":\"http:\/\/vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Heap and thread monitoring\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Heap and thread monitoring - Tutorial","description":"Heap and thread monitoring. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/","og_locale":"en_US","og_type":"article","og_title":"Heap and thread monitoring - Tutorial","og_description":"Heap and thread monitoring. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:46:40+00:00","og_image":[{"url":"http:\/\/vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/","name":"Heap and thread monitoring - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/#primaryimage"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/#primaryimage"},"thumbnailUrl":"http:\/\/vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png","datePublished":"2013-05-10T07:19:34+00:00","dateModified":"2024-04-12T08:46:40+00:00","description":"Heap and thread monitoring. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/#primaryimage","url":"http:\/\/vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png","contentUrl":"http:\/\/vskills.in\/certification\/tutorial\/wp-content\/uploads\/2013\/05\/binary-heap.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/heap-and-thread-monitoring\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Heap and thread monitoring"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/20306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=20306"}],"version-history":[{"count":9,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/20306\/revisions"}],"predecessor-version":[{"id":122119,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/20306\/revisions\/122119"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=20306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=20306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=20306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}