{"action":"created","comment":{"url":"https://api.github.com/repos/m3db/m3aggregator/pulls/comments/198694459","pull_request_review_id":132671426,"id":198694459,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODY5NDQ1OQ==","diff_hunk":"@@ -130,12 +145,14 @@ type elemBase struct {\n \taggOpts               raggregation.Options\n \tparsedPipeline        parsedPipeline\n \tnumForwardedTimes     int\n+\twriteForwardedFn      writeForwardedMetricFn\n+\tonForwardedWrittenFn  onAggregationKeyDoneFn","path":"aggregator/elem_base.go","position":81,"original_position":81,"commit_id":"1bf3025065756c47c72adbb726bfde312809c8f3","original_commit_id":"1bf3025065756c47c72adbb726bfde312809c8f3","user":{"login":"xichen2020","id":12239421,"node_id":"MDQ6VXNlcjEyMjM5NDIx","avatar_url":"https://avatars1.githubusercontent.com/u/12239421?v=4","gravatar_id":"","url":"https://api.github.com/users/xichen2020","html_url":"https://github.com/xichen2020","followers_url":"https://api.github.com/users/xichen2020/followers","following_url":"https://api.github.com/users/xichen2020/following{/other_user}","gists_url":"https://api.github.com/users/xichen2020/gists{/gist_id}","starred_url":"https://api.github.com/users/xichen2020/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xichen2020/subscriptions","organizations_url":"https://api.github.com/users/xichen2020/orgs","repos_url":"https://api.github.com/users/xichen2020/repos","events_url":"https://api.github.com/users/xichen2020/events{/privacy}","received_events_url":"https://api.github.com/users/xichen2020/received_events","type":"User","site_admin":false},"body":"I can change `writeForwardedFn` to `writeForwardedMetricFn` sure thing, it's a bit verbose but probably ok.\r\n\r\nRe `onForwardedWrittenFn` and `onAggregationKeyDoneFn`, `onAggregationKeyDoneFn` makes more sense in the context of the `forwardedMetricWriter`, whereas `onForwardedWrittenFn` makes more sense in the context of the element processing.","created_at":"2018-06-28T02:42:27Z","updated_at":"2018-06-28T02:49:41Z","html_url":"https://github.com/m3db/m3aggregator/pull/133#discussion_r198694459","pull_request_url":"https://api.github.com/repos/m3db/m3aggregator/pulls/133","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/m3db/m3aggregator/pulls/comments/198694459"},"html":{"href":"https://github.com/m3db/m3aggregator/pull/133#discussion_r198694459"},"pull_request":{"href":"https://api.github.com/repos/m3db/m3aggregator/pulls/133"}},"in_reply_to_id":198689746},"pull_request":{"url":"https://api.github.com/repos/m3db/m3aggregator/pulls/133","id":197296037,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3Mjk2MDM3","html_url":"https://github.com/m3db/m3aggregator/pull/133","diff_url":"https://github.com/m3db/m3aggregator/pull/133.diff","patch_url":"https://github.com/m3db/m3aggregator/pull/133.patch","issue_url":"https://api.github.com/repos/m3db/m3aggregator/issues/133","number":133,"state":"open","locked":false,"title":"Batch writing forwarded metric values for better scalability","user":{"login":"xichen2020","id":12239421,"node_id":"MDQ6VXNlcjEyMjM5NDIx","avatar_url":"https://avatars1.githubusercontent.com/u/12239421?v=4","gravatar_id":"","url":"https://api.github.com/users/xichen2020","html_url":"https://github.com/xichen2020","followers_url":"https://api.github.com/users/xichen2020/followers","following_url":"https://api.github.com/users/xichen2020/following{/other_user}","gists_url":"https://api.github.com/users/xichen2020/gists{/gist_id}","starred_url":"https://api.github.com/users/xichen2020/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xichen2020/subscriptions","organizations_url":"https://api.github.com/users/xichen2020/orgs","repos_url":"https://api.github.com/users/xichen2020/repos","events_url":"https://api.github.com/users/xichen2020/events{/privacy}","received_events_url":"https://api.github.com/users/xichen2020/received_events","type":"User","site_admin":false},"body":"cc @cw9 @jeromefroe \r\n\r\nThis PR changes how forwarded metrics are written to ensure that if there are multiple metrics in the same shard that produce the same forwarded metric, the forwarded metric values are accumulated internally and only flushed as one batch after all source metrics have been processed during each flush. This is so that each batch is uniquely associated with the shard on the destination server where the forwarded metric is stored, and as such the shard can be used as the source id for deduplication during a leader re-election, leading to significant memory efficiency improvement. \r\n\r\nCompared to the existing approach that uses the metric ID as the source id, this approach significantly reduces the amount of memory required for computing forwarded metrics. In the worst case, each aggregation window requires ~512 bytes to keep track of the shards assuming a 4K shard setup on the server where the forwarded metric lives, whereas the current approach requires a memory size that's proportional to the number of IDs being rolled up into the forwarded metric to track the source IDs. For example, this would require at least 50K x 200 = 10MB for each aggregation window to store the source metric IDs in a map for rolling up 50K metric IDs into a forwarded metric. ","created_at":"2018-06-26T04:04:29Z","updated_at":"2018-06-28T02:49:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca21acfa9887a347017e2890411fe75e651df4fc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/m3db/m3aggregator/pulls/133/commits","review_comments_url":"https://api.github.com/repos/m3db/m3aggregator/pulls/133/comments","review_comment_url":"https://api.github.com/repos/m3db/m3aggregator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/m3db/m3aggregator/issues/133/comments","statuses_url":"https://api.github.com/repos/m3db/m3aggregator/statuses/1bf3025065756c47c72adbb726bfde312809c8f3","head":{"label":"m3db:xichen-write-forward-batch-per-list","ref":"xichen-write-forward-batch-per-list","sha":"1bf3025065756c47c72adbb726bfde312809c8f3","user":{"login":"m3db","id":19937171,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5OTM3MTcx","avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"repo":{"id":74390805,"node_id":"MDEwOlJlcG9zaXRvcnk3NDM5MDgwNQ==","name":"m3aggregator","full_name":"m3db/m3aggregator","owner":{"login":"m3db","id":19937171,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5OTM3MTcx","avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/m3db/m3aggregator","description":"Metrics aggregation server","fork":false,"url":"https://api.github.com/repos/m3db/m3aggregator","forks_url":"https://api.github.com/repos/m3db/m3aggregator/forks","keys_url":"https://api.github.com/repos/m3db/m3aggregator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m3db/m3aggregator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m3db/m3aggregator/teams","hooks_url":"https://api.github.com/repos/m3db/m3aggregator/hooks","issue_events_url":"https://api.github.com/repos/m3db/m3aggregator/issues/events{/number}","events_url":"https://api.github.com/repos/m3db/m3aggregator/events","assignees_url":"https://api.github.com/repos/m3db/m3aggregator/assignees{/user}","branches_url":"https://api.github.com/repos/m3db/m3aggregator/branches{/branch}","tags_url":"https://api.github.com/repos/m3db/m3aggregator/tags","blobs_url":"https://api.github.com/repos/m3db/m3aggregator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m3db/m3aggregator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m3db/m3aggregator/git/refs{/sha}","trees_url":"https://api.github.com/repos/m3db/m3aggregator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m3db/m3aggregator/statuses/{sha}","languages_url":"https://api.github.com/repos/m3db/m3aggregator/languages","stargazers_url":"https://api.github.com/repos/m3db/m3aggregator/stargazers","contributors_url":"https://api.github.com/repos/m3db/m3aggregator/contributors","subscribers_url":"https://api.github.com/repos/m3db/m3aggregator/subscribers","subscription_url":"https://api.github.com/repos/m3db/m3aggregator/subscription","commits_url":"https://api.github.com/repos/m3db/m3aggregator/commits{/sha}","git_commits_url":"https://api.github.com/repos/m3db/m3aggregator/git/commits{/sha}","comments_url":"https://api.github.com/repos/m3db/m3aggregator/comments{/number}","issue_comment_url":"https://api.github.com/repos/m3db/m3aggregator/issues/comments{/number}","contents_url":"https://api.github.com/repos/m3db/m3aggregator/contents/{+path}","compare_url":"https://api.github.com/repos/m3db/m3aggregator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m3db/m3aggregator/merges","archive_url":"https://api.github.com/repos/m3db/m3aggregator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m3db/m3aggregator/downloads","issues_url":"https://api.github.com/repos/m3db/m3aggregator/issues{/number}","pulls_url":"https://api.github.com/repos/m3db/m3aggregator/pulls{/number}","milestones_url":"https://api.github.com/repos/m3db/m3aggregator/milestones{/number}","notifications_url":"https://api.github.com/repos/m3db/m3aggregator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m3db/m3aggregator/labels{/name}","releases_url":"https://api.github.com/repos/m3db/m3aggregator/releases{/id}","deployments_url":"https://api.github.com/repos/m3db/m3aggregator/deployments","created_at":"2016-11-21T17:58:46Z","updated_at":"2018-06-25T19:49:36Z","pushed_at":"2018-06-26T18:43:24Z","git_url":"git://github.com/m3db/m3aggregator.git","ssh_url":"git@github.com:m3db/m3aggregator.git","clone_url":"https://github.com/m3db/m3aggregator.git","svn_url":"https://github.com/m3db/m3aggregator","homepage":null,"size":979,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":11,"watchers":5,"default_branch":"master"}},"base":{"label":"m3db:master","ref":"master","sha":"d08066e6fe05be1f16d35b27029154efb3812db0","user":{"login":"m3db","id":19937171,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5OTM3MTcx","avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"repo":{"id":74390805,"node_id":"MDEwOlJlcG9zaXRvcnk3NDM5MDgwNQ==","name":"m3aggregator","full_name":"m3db/m3aggregator","owner":{"login":"m3db","id":19937171,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5OTM3MTcx","avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/m3db/m3aggregator","description":"Metrics aggregation server","fork":false,"url":"https://api.github.com/repos/m3db/m3aggregator","forks_url":"https://api.github.com/repos/m3db/m3aggregator/forks","keys_url":"https://api.github.com/repos/m3db/m3aggregator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m3db/m3aggregator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m3db/m3aggregator/teams","hooks_url":"https://api.github.com/repos/m3db/m3aggregator/hooks","issue_events_url":"https://api.github.com/repos/m3db/m3aggregator/issues/events{/number}","events_url":"https://api.github.com/repos/m3db/m3aggregator/events","assignees_url":"https://api.github.com/repos/m3db/m3aggregator/assignees{/user}","branches_url":"https://api.github.com/repos/m3db/m3aggregator/branches{/branch}","tags_url":"https://api.github.com/repos/m3db/m3aggregator/tags","blobs_url":"https://api.github.com/repos/m3db/m3aggregator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m3db/m3aggregator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m3db/m3aggregator/git/refs{/sha}","trees_url":"https://api.github.com/repos/m3db/m3aggregator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m3db/m3aggregator/statuses/{sha}","languages_url":"https://api.github.com/repos/m3db/m3aggregator/languages","stargazers_url":"https://api.github.com/repos/m3db/m3aggregator/stargazers","contributors_url":"https://api.github.com/repos/m3db/m3aggregator/contributors","subscribers_url":"https://api.github.com/repos/m3db/m3aggregator/subscribers","subscription_url":"https://api.github.com/repos/m3db/m3aggregator/subscription","commits_url":"https://api.github.com/repos/m3db/m3aggregator/commits{/sha}","git_commits_url":"https://api.github.com/repos/m3db/m3aggregator/git/commits{/sha}","comments_url":"https://api.github.com/repos/m3db/m3aggregator/comments{/number}","issue_comment_url":"https://api.github.com/repos/m3db/m3aggregator/issues/comments{/number}","contents_url":"https://api.github.com/repos/m3db/m3aggregator/contents/{+path}","compare_url":"https://api.github.com/repos/m3db/m3aggregator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m3db/m3aggregator/merges","archive_url":"https://api.github.com/repos/m3db/m3aggregator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m3db/m3aggregator/downloads","issues_url":"https://api.github.com/repos/m3db/m3aggregator/issues{/number}","pulls_url":"https://api.github.com/repos/m3db/m3aggregator/pulls{/number}","milestones_url":"https://api.github.com/repos/m3db/m3aggregator/milestones{/number}","notifications_url":"https://api.github.com/repos/m3db/m3aggregator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m3db/m3aggregator/labels{/name}","releases_url":"https://api.github.com/repos/m3db/m3aggregator/releases{/id}","deployments_url":"https://api.github.com/repos/m3db/m3aggregator/deployments","created_at":"2016-11-21T17:58:46Z","updated_at":"2018-06-25T19:49:36Z","pushed_at":"2018-06-26T18:43:24Z","git_url":"git://github.com/m3db/m3aggregator.git","ssh_url":"git@github.com:m3db/m3aggregator.git","clone_url":"https://github.com/m3db/m3aggregator.git","svn_url":"https://github.com/m3db/m3aggregator","homepage":null,"size":979,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":11,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/m3db/m3aggregator/pulls/133"},"html":{"href":"https://github.com/m3db/m3aggregator/pull/133"},"issue":{"href":"https://api.github.com/repos/m3db/m3aggregator/issues/133"},"comments":{"href":"https://api.github.com/repos/m3db/m3aggregator/issues/133/comments"},"review_comments":{"href":"https://api.github.com/repos/m3db/m3aggregator/pulls/133/comments"},"review_comment":{"href":"https://api.github.com/repos/m3db/m3aggregator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/m3db/m3aggregator/pulls/133/commits"},"statuses":{"href":"https://api.github.com/repos/m3db/m3aggregator/statuses/1bf3025065756c47c72adbb726bfde312809c8f3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"xichen2020"}}