{"id":5220,"date":"2015-11-21T14:09:05","date_gmt":"2015-11-21T19:09:05","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=5220"},"modified":"2015-11-21T14:11:00","modified_gmt":"2015-11-21T19:11:00","slug":"calculating-gaps-between-full-cms-cycles","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2015\/11\/21\/calculating-gaps-between-full-cms-cycles\/","title":{"rendered":"Calculating gaps between full CMS cycles"},"content":{"rendered":"<p>While troubleshooting a performance issue, we had a need to graph the number of seconds between full collections.<\/p>\n<p>We used what is below.  This assumes you have added -XX:+PrintGCDetails and -XX:+PrintGCDateStamps as well as a file location for -Xloggc: to your startup script.  You can use the output in Excel, or pipe it to another scripting language such as awk for additional dynamic reporting.<\/p>\n<p>The output fields are start time, finish time, seconds for collection to run, and the number of seconds since the completion and the previous cycle and the start of this one.<\/p>\n<pre>\r\n#!\/usr\/bin\/env python\r\n\r\nimport datetime, time, sys\r\nstartTime = 0\r\nfinishTime = 0\r\ngap = -1\r\nfor line in open(sys.argv[1],\"r\"):\r\n  if line.find(\"CMS-initial-mark:\") > -1:\r\n    start = line.split(\" \")[0].split(\".\")[0]\r\n    tmp = line.split(\" \")[0].split(\".\")[0]\r\n    startTime = time.mktime(time.strptime(tmp,'%Y-%m-%dT%H:%M:%S'))\r\n    if finishTime != 0:\r\n      gap = startTime - finishTime\r\n  elif line.find(\"CMS-concurrent-reset:\") > -1:\r\n    finish = line.split(\" \")[0].split(\".\")[0]\r\n    tmp = time.strptime(line.split(\" \")[0].split(\".\")[0],'%Y-%m-%dT%H:%M:%S')\r\n    finishTime = time.mktime(tmp)\r\n    duration = finishTime - startTime\r\n    if gap != -1:\r\n      print start,finish,duration, gap\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>While troubleshooting a performance issue, we had a need to graph the number of seconds between full collections. We used what is below. This assumes you have added -XX:+PrintGCDetails and -XX:+PrintGCDateStamps as well as a file location for -Xloggc: to&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2015\/11\/21\/calculating-gaps-between-full-cms-cycles\/\">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":[24,25],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5220"}],"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=5220"}],"version-history":[{"count":4,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5220\/revisions"}],"predecessor-version":[{"id":5224,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5220\/revisions\/5224"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=5220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=5220"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=5220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}