{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/15221","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15221/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15221/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15221/events","html_url":"https://github.com/elastic/elasticsearch/pull/15221","id":120252194,"number":15221,"title":"Avoid trace logging allocations in TransportBroadcastByNodeAction","user":{"login":"jasontedor","id":4744941,"avatar_url":"https://avatars.githubusercontent.com/u/4744941?v=3","gravatar_id":"","url":"https://api.github.com/users/jasontedor","html_url":"https://github.com/jasontedor","followers_url":"https://api.github.com/users/jasontedor/followers","following_url":"https://api.github.com/users/jasontedor/following{/other_user}","gists_url":"https://api.github.com/users/jasontedor/gists{/gist_id}","starred_url":"https://api.github.com/users/jasontedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasontedor/subscriptions","organizations_url":"https://api.github.com/users/jasontedor/orgs","repos_url":"https://api.github.com/users/jasontedor/repos","events_url":"https://api.github.com/users/jasontedor/events{/privacy}","received_events_url":"https://api.github.com/users/jasontedor/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Internal","name":":Internal","color":"009800"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/enhancement","name":"enhancement","color":"4a4ea8"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/review","name":"review","color":"0052cc"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/v2.2.0","name":"v2.2.0","color":"dddddd"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/v3.0.0","name":"v3.0.0","color":"dddddd"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-03T19:40:09Z","updated_at":"2015-12-03T20:17:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/15221","html_url":"https://github.com/elastic/elasticsearch/pull/15221","diff_url":"https://github.com/elastic/elasticsearch/pull/15221.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/15221.patch"},"body":"This commit wraps the trace logging statements in\r\nTransportBroadcastByNodeAction in trace enabled checks to avoid\r\nunnecessarily allocating objects.\r\n\r\nThe most egregious offenders were the two trace logging statements in\r\nBroadcastByNodeTransportRequestHandler#onShardOperation. Aside from the\r\nusual object allocations that occur when invoking ESLogger#trace (the\r\nallocated object array for the varargs Object... parameter), these two\r\nlogging statements were invoking ShardRouting#shortSummary generating a\r\nbunch of char arrays and Strings (from the StringBuilder, and so a bunch\r\nof array copies as well). In a scenario where there are a lot of shards\r\nand this method is being invoked frequently (e.g., constantly hitting\r\nthe _stats endpoint), these two unprotected trace logging statements\r\nwere generating a lot of unnecessary allocations."},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/161770948","html_url":"https://github.com/elastic/elasticsearch/pull/15221#issuecomment-161770948","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15221","id":161770948,"user":{"login":"jasontedor","id":4744941,"avatar_url":"https://avatars.githubusercontent.com/u/4744941?v=3","gravatar_id":"","url":"https://api.github.com/users/jasontedor","html_url":"https://github.com/jasontedor","followers_url":"https://api.github.com/users/jasontedor/followers","following_url":"https://api.github.com/users/jasontedor/following{/other_user}","gists_url":"https://api.github.com/users/jasontedor/gists{/gist_id}","starred_url":"https://api.github.com/users/jasontedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasontedor/subscriptions","organizations_url":"https://api.github.com/users/jasontedor/orgs","repos_url":"https://api.github.com/users/jasontedor/repos","events_url":"https://api.github.com/users/jasontedor/events{/privacy}","received_events_url":"https://api.github.com/users/jasontedor/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T20:17:58Z","updated_at":"2015-12-03T20:17:58Z","body":"Using jmc, I profiled the difference in allocations with this change. On an otherwise quiet node but pinging indices stats every second over a sixty-second period, this change gave an 18% reduction in allocations."}}