{"action":"created","comment":{"url":"https://api.github.com/repos/joyent/smartos-live/pulls/comments/49501925","id":49501925,"diff_hunk":"@@ -337,8 +387,17 @@ function zfs(options, cmd, args, lineHandler, callback)\n \n     // we don't expect data on stderr, so treat as a warning\n     zfs_child.stderr.on('data', function (data) {","path":"src/vm/node_modules/vmload/vmload-datasets.js","position":94,"original_position":94,"commit_id":"97b9c2a8dfa2cf46e5e7d5569e39c44c3b0c79cf","original_commit_id":"97b9c2a8dfa2cf46e5e7d5569e39c44c3b0c79cf","user":{"login":"bahamas10","id":1205722,"avatar_url":"https://avatars.githubusercontent.com/u/1205722?v=3","gravatar_id":"","url":"https://api.github.com/users/bahamas10","html_url":"https://github.com/bahamas10","followers_url":"https://api.github.com/users/bahamas10/followers","following_url":"https://api.github.com/users/bahamas10/following{/other_user}","gists_url":"https://api.github.com/users/bahamas10/gists{/gist_id}","starred_url":"https://api.github.com/users/bahamas10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bahamas10/subscriptions","organizations_url":"https://api.github.com/users/bahamas10/orgs","repos_url":"https://api.github.com/users/bahamas10/repos","events_url":"https://api.github.com/users/bahamas10/events{/privacy}","received_events_url":"https://api.github.com/users/bahamas10/received_events","type":"User","site_admin":false},"body":"it's possible (not likely) to get incomplete data here, and possibly break on only half a line... it may be worth it to store all of the stderr then post-process it in the exit handler.","created_at":"2016-01-12T19:33:42Z","updated_at":"2016-01-12T19:33:42Z","html_url":"https://github.com/joyent/smartos-live/pull/445#discussion_r49501925","pull_request_url":"https://api.github.com/repos/joyent/smartos-live/pulls/445","_links":{"self":{"href":"https://api.github.com/repos/joyent/smartos-live/pulls/comments/49501925"},"html":{"href":"https://github.com/joyent/smartos-live/pull/445#discussion_r49501925"},"pull_request":{"href":"https://api.github.com/repos/joyent/smartos-live/pulls/445"}}},"pull_request":{"url":"https://api.github.com/repos/joyent/smartos-live/pulls/445","id":35186403,"html_url":"https://github.com/joyent/smartos-live/pull/445","diff_url":"https://github.com/joyent/smartos-live/pull/445.diff","patch_url":"https://github.com/joyent/smartos-live/pull/445.patch","issue_url":"https://api.github.com/repos/joyent/smartos-live/issues/445","number":445,"state":"open","locked":false,"title":"OS-5062 VM.load should use \"zfs list -r\" where possible","user":{"login":"arekinath","id":496427,"avatar_url":"https://avatars.githubusercontent.com/u/496427?v=3","gravatar_id":"","url":"https://api.github.com/users/arekinath","html_url":"https://github.com/arekinath","followers_url":"https://api.github.com/users/arekinath/followers","following_url":"https://api.github.com/users/arekinath/following{/other_user}","gists_url":"https://api.github.com/users/arekinath/gists{/gist_id}","starred_url":"https://api.github.com/users/arekinath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arekinath/subscriptions","organizations_url":"https://api.github.com/users/arekinath/orgs","repos_url":"https://api.github.com/users/arekinath/repos","events_url":"https://api.github.com/users/arekinath/events{/privacy}","received_events_url":"https://api.github.com/users/arekinath/received_events","type":"User","site_admin":false},"body":"Currently, calling VM.load on one specific zone causes it to do a \"zfs list\" on all datasets and snapshots on the entire system. When we already know the zone is of the `joyent[-minimal]` or `lx` brands, we don't have to do this, as we can safely assume all the related datasets are under the zone's root dataset as children. So we can use `zfs list -r` and not have to walk the entire pool.\r\n\r\nThis makes `VM.load` (and thus `vmadm get` and also the SDC heartbeating) faster on systems with many ZFS datasets. It also reduces the CPU load generated by regular heartbeats and lock contention.\r\n\r\nFor example, on one of my CNs, before this patch:\r\n\r\n```\r\n[root@a0-36-9f-29-7b-f4 (gps-1) ~]# time vmadm get $uuid >/dev/null\r\nreal\t0m1.679s\r\nuser\t0m0.787s\r\nsys\t0m0.907s\r\n[root@a0-36-9f-29-7b-f4 (gps-1) ~]# time vmadm get $uuid >/dev/null\r\nreal\t0m1.655s\r\nuser\t0m0.789s\r\nsys\t0m0.882s\r\n[root@a0-36-9f-29-7b-f4 (gps-1) ~]# time vmadm get $uuid >/dev/null\r\nreal\t0m1.680s\r\nuser\t0m0.786s\r\nsys\t0m0.910s\r\n```\r\n\r\nAnd after this patch:\r\n\r\n```\r\n[root@a0-36-9f-29-7b-f4 (gps-1) ~]# time vmadm get $uuid >/dev/null\r\nreal\t0m0.868s\r\nuser\t0m0.456s\r\nsys\t0m0.409s\r\n[root@a0-36-9f-29-7b-f4 (gps-1) ~]# time vmadm get $uuid >/dev/null\r\nreal\t0m0.864s\r\nuser\t0m0.456s\r\nsys\t0m0.406s\r\n[root@a0-36-9f-29-7b-f4 (gps-1) ~]# time vmadm get $uuid >/dev/null\r\nreal\t0m0.910s\r\nuser\t0m0.475s\r\nsys\t0m0.414s\r\n```","created_at":"2015-05-12T01:40:16Z","updated_at":"2016-01-12T19:33:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dbf2c3b0c4e919da972a792549db0ff8555d1db1","assignee":{"login":"joshwilsdon","id":78194,"avatar_url":"https://avatars.githubusercontent.com/u/78194?v=3","gravatar_id":"","url":"https://api.github.com/users/joshwilsdon","html_url":"https://github.com/joshwilsdon","followers_url":"https://api.github.com/users/joshwilsdon/followers","following_url":"https://api.github.com/users/joshwilsdon/following{/other_user}","gists_url":"https://api.github.com/users/joshwilsdon/gists{/gist_id}","starred_url":"https://api.github.com/users/joshwilsdon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshwilsdon/subscriptions","organizations_url":"https://api.github.com/users/joshwilsdon/orgs","repos_url":"https://api.github.com/users/joshwilsdon/repos","events_url":"https://api.github.com/users/joshwilsdon/events{/privacy}","received_events_url":"https://api.github.com/users/joshwilsdon/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/joyent/smartos-live/pulls/445/commits","review_comments_url":"https://api.github.com/repos/joyent/smartos-live/pulls/445/comments","review_comment_url":"https://api.github.com/repos/joyent/smartos-live/pulls/comments{/number}","comments_url":"https://api.github.com/repos/joyent/smartos-live/issues/445/comments","statuses_url":"https://api.github.com/repos/joyent/smartos-live/statuses/97b9c2a8dfa2cf46e5e7d5569e39c44c3b0c79cf","head":{"label":"arekinath:zfslimit","ref":"zfslimit","sha":"97b9c2a8dfa2cf46e5e7d5569e39c44c3b0c79cf","user":{"login":"arekinath","id":496427,"avatar_url":"https://avatars.githubusercontent.com/u/496427?v=3","gravatar_id":"","url":"https://api.github.com/users/arekinath","html_url":"https://github.com/arekinath","followers_url":"https://api.github.com/users/arekinath/followers","following_url":"https://api.github.com/users/arekinath/following{/other_user}","gists_url":"https://api.github.com/users/arekinath/gists{/gist_id}","starred_url":"https://api.github.com/users/arekinath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arekinath/subscriptions","organizations_url":"https://api.github.com/users/arekinath/orgs","repos_url":"https://api.github.com/users/arekinath/repos","events_url":"https://api.github.com/users/arekinath/events{/privacy}","received_events_url":"https://api.github.com/users/arekinath/received_events","type":"User","site_admin":false},"repo":{"id":12395668,"name":"smartos-live","full_name":"arekinath/smartos-live","owner":{"login":"arekinath","id":496427,"avatar_url":"https://avatars.githubusercontent.com/u/496427?v=3","gravatar_id":"","url":"https://api.github.com/users/arekinath","html_url":"https://github.com/arekinath","followers_url":"https://api.github.com/users/arekinath/followers","following_url":"https://api.github.com/users/arekinath/following{/other_user}","gists_url":"https://api.github.com/users/arekinath/gists{/gist_id}","starred_url":"https://api.github.com/users/arekinath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arekinath/subscriptions","organizations_url":"https://api.github.com/users/arekinath/orgs","repos_url":"https://api.github.com/users/arekinath/repos","events_url":"https://api.github.com/users/arekinath/events{/privacy}","received_events_url":"https://api.github.com/users/arekinath/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arekinath/smartos-live","description":"smartos with amd-kvm and some ipv6 and stuff","fork":true,"url":"https://api.github.com/repos/arekinath/smartos-live","forks_url":"https://api.github.com/repos/arekinath/smartos-live/forks","keys_url":"https://api.github.com/repos/arekinath/smartos-live/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arekinath/smartos-live/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arekinath/smartos-live/teams","hooks_url":"https://api.github.com/repos/arekinath/smartos-live/hooks","issue_events_url":"https://api.github.com/repos/arekinath/smartos-live/issues/events{/number}","events_url":"https://api.github.com/repos/arekinath/smartos-live/events","assignees_url":"https://api.github.com/repos/arekinath/smartos-live/assignees{/user}","branches_url":"https://api.github.com/repos/arekinath/smartos-live/branches{/branch}","tags_url":"https://api.github.com/repos/arekinath/smartos-live/tags","blobs_url":"https://api.github.com/repos/arekinath/smartos-live/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arekinath/smartos-live/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arekinath/smartos-live/git/refs{/sha}","trees_url":"https://api.github.com/repos/arekinath/smartos-live/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arekinath/smartos-live/statuses/{sha}","languages_url":"https://api.github.com/repos/arekinath/smartos-live/languages","stargazers_url":"https://api.github.com/repos/arekinath/smartos-live/stargazers","contributors_url":"https://api.github.com/repos/arekinath/smartos-live/contributors","subscribers_url":"https://api.github.com/repos/arekinath/smartos-live/subscribers","subscription_url":"https://api.github.com/repos/arekinath/smartos-live/subscription","commits_url":"https://api.github.com/repos/arekinath/smartos-live/commits{/sha}","git_commits_url":"https://api.github.com/repos/arekinath/smartos-live/git/commits{/sha}","comments_url":"https://api.github.com/repos/arekinath/smartos-live/comments{/number}","issue_comment_url":"https://api.github.com/repos/arekinath/smartos-live/issues/comments{/number}","contents_url":"https://api.github.com/repos/arekinath/smartos-live/contents/{+path}","compare_url":"https://api.github.com/repos/arekinath/smartos-live/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arekinath/smartos-live/merges","archive_url":"https://api.github.com/repos/arekinath/smartos-live/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arekinath/smartos-live/downloads","issues_url":"https://api.github.com/repos/arekinath/smartos-live/issues{/number}","pulls_url":"https://api.github.com/repos/arekinath/smartos-live/pulls{/number}","milestones_url":"https://api.github.com/repos/arekinath/smartos-live/milestones{/number}","notifications_url":"https://api.github.com/repos/arekinath/smartos-live/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arekinath/smartos-live/labels{/name}","releases_url":"https://api.github.com/repos/arekinath/smartos-live/releases{/id}","created_at":"2013-08-27T03:13:23Z","updated_at":"2014-12-04T09:51:40Z","pushed_at":"2015-12-23T22:27:53Z","git_url":"git://github.com/arekinath/smartos-live.git","ssh_url":"git@github.com:arekinath/smartos-live.git","clone_url":"https://github.com/arekinath/smartos-live.git","svn_url":"https://github.com/arekinath/smartos-live","homepage":"http://imgapi.uqcloud.net/builds","size":34513,"stargazers_count":13,"watchers_count":13,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":0,"forks":4,"open_issues":0,"watchers":13,"default_branch":"eait"}},"base":{"label":"joyent:master","ref":"master","sha":"e23a7bd40d21328848e334ba180368a8a7c2555a","user":{"login":"joyent","id":10161,"avatar_url":"https://avatars.githubusercontent.com/u/10161?v=3","gravatar_id":"","url":"https://api.github.com/users/joyent","html_url":"https://github.com/joyent","followers_url":"https://api.github.com/users/joyent/followers","following_url":"https://api.github.com/users/joyent/following{/other_user}","gists_url":"https://api.github.com/users/joyent/gists{/gist_id}","starred_url":"https://api.github.com/users/joyent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joyent/subscriptions","organizations_url":"https://api.github.com/users/joyent/orgs","repos_url":"https://api.github.com/users/joyent/repos","events_url":"https://api.github.com/users/joyent/events{/privacy}","received_events_url":"https://api.github.com/users/joyent/received_events","type":"Organization","site_admin":false},"repo":{"id":2203782,"name":"smartos-live","full_name":"joyent/smartos-live","owner":{"login":"joyent","id":10161,"avatar_url":"https://avatars.githubusercontent.com/u/10161?v=3","gravatar_id":"","url":"https://api.github.com/users/joyent","html_url":"https://github.com/joyent","followers_url":"https://api.github.com/users/joyent/followers","following_url":"https://api.github.com/users/joyent/following{/other_user}","gists_url":"https://api.github.com/users/joyent/gists{/gist_id}","starred_url":"https://api.github.com/users/joyent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joyent/subscriptions","organizations_url":"https://api.github.com/users/joyent/orgs","repos_url":"https://api.github.com/users/joyent/repos","events_url":"https://api.github.com/users/joyent/events{/privacy}","received_events_url":"https://api.github.com/users/joyent/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joyent/smartos-live","description":"For more information, please see http://smartos.org/  For any questions that aren't answered there, please join the SmartOS discussion list: http://smartos.org/smartos-mailing-list/","fork":false,"url":"https://api.github.com/repos/joyent/smartos-live","forks_url":"https://api.github.com/repos/joyent/smartos-live/forks","keys_url":"https://api.github.com/repos/joyent/smartos-live/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joyent/smartos-live/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joyent/smartos-live/teams","hooks_url":"https://api.github.com/repos/joyent/smartos-live/hooks","issue_events_url":"https://api.github.com/repos/joyent/smartos-live/issues/events{/number}","events_url":"https://api.github.com/repos/joyent/smartos-live/events","assignees_url":"https://api.github.com/repos/joyent/smartos-live/assignees{/user}","branches_url":"https://api.github.com/repos/joyent/smartos-live/branches{/branch}","tags_url":"https://api.github.com/repos/joyent/smartos-live/tags","blobs_url":"https://api.github.com/repos/joyent/smartos-live/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joyent/smartos-live/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joyent/smartos-live/git/refs{/sha}","trees_url":"https://api.github.com/repos/joyent/smartos-live/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joyent/smartos-live/statuses/{sha}","languages_url":"https://api.github.com/repos/joyent/smartos-live/languages","stargazers_url":"https://api.github.com/repos/joyent/smartos-live/stargazers","contributors_url":"https://api.github.com/repos/joyent/smartos-live/contributors","subscribers_url":"https://api.github.com/repos/joyent/smartos-live/subscribers","subscription_url":"https://api.github.com/repos/joyent/smartos-live/subscription","commits_url":"https://api.github.com/repos/joyent/smartos-live/commits{/sha}","git_commits_url":"https://api.github.com/repos/joyent/smartos-live/git/commits{/sha}","comments_url":"https://api.github.com/repos/joyent/smartos-live/comments{/number}","issue_comment_url":"https://api.github.com/repos/joyent/smartos-live/issues/comments{/number}","contents_url":"https://api.github.com/repos/joyent/smartos-live/contents/{+path}","compare_url":"https://api.github.com/repos/joyent/smartos-live/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joyent/smartos-live/merges","archive_url":"https://api.github.com/repos/joyent/smartos-live/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joyent/smartos-live/downloads","issues_url":"https://api.github.com/repos/joyent/smartos-live/issues{/number}","pulls_url":"https://api.github.com/repos/joyent/smartos-live/pulls{/number}","milestones_url":"https://api.github.com/repos/joyent/smartos-live/milestones{/number}","notifications_url":"https://api.github.com/repos/joyent/smartos-live/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joyent/smartos-live/labels{/name}","releases_url":"https://api.github.com/repos/joyent/smartos-live/releases{/id}","created_at":"2011-08-14T01:08:28Z","updated_at":"2016-01-09T13:56:05Z","pushed_at":"2016-01-11T14:11:23Z","git_url":"git://github.com/joyent/smartos-live.git","ssh_url":"git@github.com:joyent/smartos-live.git","clone_url":"https://github.com/joyent/smartos-live.git","svn_url":"https://github.com/joyent/smartos-live","homepage":"","size":37313,"stargazers_count":985,"watchers_count":985,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":150,"mirror_url":null,"open_issues_count":215,"forks":150,"open_issues":215,"watchers":985,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/joyent/smartos-live/pulls/445"},"html":{"href":"https://github.com/joyent/smartos-live/pull/445"},"issue":{"href":"https://api.github.com/repos/joyent/smartos-live/issues/445"},"comments":{"href":"https://api.github.com/repos/joyent/smartos-live/issues/445/comments"},"review_comments":{"href":"https://api.github.com/repos/joyent/smartos-live/pulls/445/comments"},"review_comment":{"href":"https://api.github.com/repos/joyent/smartos-live/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/joyent/smartos-live/pulls/445/commits"},"statuses":{"href":"https://api.github.com/repos/joyent/smartos-live/statuses/97b9c2a8dfa2cf46e5e7d5569e39c44c3b0c79cf"}}}}