{"id":3159,"date":"2013-07-08T22:28:57","date_gmt":"2013-07-09T03:28:57","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=3159"},"modified":"2013-07-08T22:28:57","modified_gmt":"2013-07-09T03:28:57","slug":"which-threads-are-running-on-a-given-cpu","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2013\/07\/08\/which-threads-are-running-on-a-given-cpu\/","title":{"rendered":"Which threads are running on a given CPU"},"content":{"rendered":"<p>We had a need to see which threads were running on a given CPU, as utilization was not balanced amongst the cores.<\/p>\n<p>We used what is below to do so.  In our case, our java PID was 488.<\/p>\n<pre lang=\"text\">\r\n-bash-4.1$ jstack 488 > l.txt; for p in $(ps -eL -o pid,psr,lwp | grep 488 | awk '$2 == 0 {print $NF}'); do\r\n>   PID=$(printf \"%x\\n\" $p)\r\n>   grep \"nid=0x${PID}\" l.txt\r\n> done | awk '{gsub(\"[0-9]\",\"\",$1); print $1}' | sort | uniq -c | sort -n\r\n      1 \"ajp-...--Acceptor-\"\r\n      1 \"\/atg\/deployment\/file\/FileDeploymentServer-ConnectionAcceptor\"\r\n      1 \"\/atg\/dynamo\/server\/SQLRepositoryEventServer_production-ConnectionAcceptor\"\r\n      1 \"\/atg\/dynamo\/server\/SQLRepositoryEventServer_production-SendAsynchronousGSAEventThread\"\r\n      1 \"\/atg\/dynamo\/server\/SQLRepositoryEventServer-SendAsynchronousGSAEventThread\"\r\n      1 \"\/atg\/dynamo\/service\/ClientLockManager-MessageReadingThread\"\r\n      1 \"\/atg\/dynamo\/service\/ClientLockManager_production-MessageReadingThread\"\r\n      1 \"\/atg\/dynamo\/service\/GSACacheClientManager-MessageReadingThread\"\r\n      1 \"\/atg\/dynamo\/service\/Scheduler-reusablejobhandler-\/atg\/epub\/file\/ConfigEmptyDirDeleter-folderCleanup\"\r\n      1 \"\/atg\/dynamo\/service\/Scheduler-reusablejobhandler-JMS-POLL\"\r\n      1 \"\/atg\/dynamo\/service\/Scheduler-reusablejobhandler-MSG-LIMBO-POLL\"\r\n      1 \"\/atg\/dynamo\/service\/Scheduler-reusablejobhandler-null\"\r\n      1 \"\/atg\/dynamo\/service\/Scheduler-reusablejobhandler-OrderSharderRotationServcie\"\r\n      1 \"\/atg\/dynamo\/service\/Scheduler-reusablejobhandler-PlaceScheduledOrders\"\r\n      1 \"\/atg\/dynamo\/service\/Scheduler-reusablejobhandler-Reset\r\n      1 \"\/atg\/dynamo\/service\/Scheduler-reusablejobhandler-SitemapWriterService\"\r\n      1 \"\/atg\/reporting\/datacollection\/commerce\/ClaimableLogEntryQueueSink-\"\r\n      1 \"\/atg\/reporting\/datacollection\/commerce\/OrderLogEntryQueueSink-\"\r\n      1 \"\/atg\/reporting\/datacollection\/search\/EnvironmentLogEntryQueueSink-\"\r\n      1 \"\/atg\/reporting\/datacollection\/search\/QueryLogEntryQueueSink-\"\r\n      1 \"Attach\r\n      1 \".data\"\r\n      1 \"Gang\r\n      1 \"IdleRemover\"\r\n      1 \"JBossLifeThread\"\r\n      1 \"JCA\r\n      1 \"JmDNS.SocketListener\"\r\n      1 \"MultiThreadedHttpConnectionManager\r\n      1 \"net.sf.ehcache.CacheManager@ba\"\r\n      1 \"New\r\n      1 \"QueueItemChangedThread\"\r\n      1 \"Thread-\"\r\n      2 \"http-...--Acceptor-\"\r\n      2 \"RMI\r\n      3 \"\/atg\/dynamo\/service\/Scheduler-reusablejobhandler-reinitialize\r\n     19 \"\/atg\/dynamo\/server\/SQLRepositoryEventServer_production-\"\r\n     41 \"pool--thread-\"\r\n     81 \"http-...--\"\r\n     93 \"\/atg\/dynamo\/server\/SQLRepositoryEventServer-\"\r\n-bash-4.1$\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>We had a need to see which threads were running on a given CPU, as utilization was not balanced amongst the cores. We used what is below to do so. In our case, our java PID was 488. -bash-4.1$ jstack&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2013\/07\/08\/which-threads-are-running-on-a-given-cpu\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[28,27],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3159"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3159"}],"version-history":[{"count":3,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3159\/revisions"}],"predecessor-version":[{"id":3165,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3159\/revisions\/3165"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3159"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}