{"action":"created","comment":{"url":"https://api.github.com/repos/gomods/athens/pulls/comments/208584259","pull_request_review_id":144417740,"id":208584259,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODU4NDI1OQ==","diff_hunk":"@@ -0,0 +1,135 @@\n+package modulestorage\n+\n+import (\n+\t\"bytes\"\n+\t\"context\"\n+\t\"fmt\"\n+\t\"testing\"\n+\n+\t\"github.com/gobuffalo/suite\"\n+\t\"github.com/gomods/athens/pkg/storage\"\n+\t\"github.com/gomods/athens/pkg/storage/fs\"\n+\t\"github.com/gomods/athens/pkg/storage/mem\"\n+\t\"github.com/gomods/athens/pkg/storage/minio\"\n+\t\"github.com/gomods/athens/pkg/storage/mongo\"\n+\t\"github.com/gomods/athens/pkg/storage/rdbms\"\n+\t\"github.com/stretchr/testify/require\"\n+)\n+\n+func BenchmarkStorageList(b *testing.B) {\n+\tmodule, version := \"athens_module\", \"1.0.1\"\n+\tzip, info, mod := []byte(\"zip_data\"), []byte(\"info\"), []byte(\"mod_info\")\n+\n+\tfor _, store := range getStores(b) {\n+\n+\t\tbackend := store.Storage()\n+\n+\t\trequire.NoError(b, backend.Save(context.Background(), module, version, mod, bytes.NewReader(zip), info), \"Save for storage %s failed\", backend)\n+\n+\t\tb.Run(fmt.Sprintf(\"listing module backend %s\", store.StorageHumanReadableName()), func(b *testing.B) {\n+\t\t\tfor i := 0; i < b.N; i++ {\n+\t\t\t\tbackend.List(context.Background(), module)\n+\t\t\t}\n+\t\t})\n+\n+\t\trequire.NoError(b, store.Cleanup())\n+\t}\n+}\n+\n+func BenchmarkStorageSave(b *testing.B) {\n+\tmodule, version := \"athens_module\", \"1.0.1\"\n+\tzip, info, mod := []byte(\"zip_data\"), []byte(\"info\"), []byte(\"mod_info\")\n+\n+\tfor _, store := range getStores(b) {\n+\n+\t\tbackend := store.Storage()\n+\n+\t\tb.Run(fmt.Sprintf(\"save module backend %s\", store.StorageHumanReadableName()), func(b *testing.B) {\n+\t\t\tfor i := 0; i < b.N; i++ {\n+\t\t\t\terr := backend.Save(context.Background(), fmt.Sprintf(\"%s-%d\", module, i), version, mod, bytes.NewReader(zip), info)\n+\t\t\t\trequire.NoError(b, err)\n+\t\t\t}\n+\t\t})\n+\n+\t\trequire.NoError(b, store.Cleanup())\n+\t}\n+}\n+\n+func BenchmarkStorageDelete(b *testing.B) {\n+\tmodule, version := \"athens_module\", \"1.0.1\"\n+\tzip, info, mod := []byte(\"zip_data\"), []byte(\"info\"), []byte(\"mod_info\")\n+\n+\tfor _, store := range getStores(b) {\n+\n+\t\tbackend := store.Storage()\n+\n+\t\tfor i := 0; i < b.N; i++ {\n+\t\t\terr := backend.Save(context.Background(), fmt.Sprintf(\"del-%s-%d\", module, i), version, mod, bytes.NewReader(zip), info)","path":"pkg/storage/storage_tests/module_storage/storage_benchmark_test.go","position":67,"original_position":67,"commit_id":"554df258e1c95c3de33dc0c0a64f9bc4b883b574","original_commit_id":"554df258e1c95c3de33dc0c0a64f9bc4b883b574","user":{"login":"marwan-at-work","id":16294261,"node_id":"MDQ6VXNlcjE2Mjk0MjYx","avatar_url":"https://avatars0.githubusercontent.com/u/16294261?v=4","gravatar_id":"","url":"https://api.github.com/users/marwan-at-work","html_url":"https://github.com/marwan-at-work","followers_url":"https://api.github.com/users/marwan-at-work/followers","following_url":"https://api.github.com/users/marwan-at-work/following{/other_user}","gists_url":"https://api.github.com/users/marwan-at-work/gists{/gist_id}","starred_url":"https://api.github.com/users/marwan-at-work/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marwan-at-work/subscriptions","organizations_url":"https://api.github.com/users/marwan-at-work/orgs","repos_url":"https://api.github.com/users/marwan-at-work/repos","events_url":"https://api.github.com/users/marwan-at-work/events{/privacy}","received_events_url":"https://api.github.com/users/marwan-at-work/received_events","type":"User","site_admin":false},"body":"the outer `N` can be different from the inner `N`, and therefore some of those `backend.Delete` functions are probably being terminated early on the `Exists` check giving inaccurate benchmark results. Your only option is to save and delete at the same time inside `b.Run` and that should be accurate enough to compare between storages. ","created_at":"2018-08-08T13:40:37Z","updated_at":"2018-08-08T13:45:23Z","html_url":"https://github.com/gomods/athens/pull/426#discussion_r208584259","pull_request_url":"https://api.github.com/repos/gomods/athens/pulls/426","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/gomods/athens/pulls/comments/208584259"},"html":{"href":"https://github.com/gomods/athens/pull/426#discussion_r208584259"},"pull_request":{"href":"https://api.github.com/repos/gomods/athens/pulls/426"}}},"pull_request":{"url":"https://api.github.com/repos/gomods/athens/pulls/426","id":206951795,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2OTUxNzk1","html_url":"https://github.com/gomods/athens/pull/426","diff_url":"https://github.com/gomods/athens/pull/426.diff","patch_url":"https://github.com/gomods/athens/pull/426.patch","issue_url":"https://api.github.com/repos/gomods/athens/issues/426","number":426,"state":"open","locked":false,"title":"Benchmark storages","user":{"login":"devdinu","id":5300055,"node_id":"MDQ6VXNlcjUzMDAwNTU=","avatar_url":"https://avatars1.githubusercontent.com/u/5300055?v=4","gravatar_id":"","url":"https://api.github.com/users/devdinu","html_url":"https://github.com/devdinu","followers_url":"https://api.github.com/users/devdinu/followers","following_url":"https://api.github.com/users/devdinu/following{/other_user}","gists_url":"https://api.github.com/users/devdinu/gists{/gist_id}","starred_url":"https://api.github.com/users/devdinu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devdinu/subscriptions","organizations_url":"https://api.github.com/users/devdinu/orgs","repos_url":"https://api.github.com/users/devdinu/repos","events_url":"https://api.github.com/users/devdinu/events{/privacy}","received_events_url":"https://api.github.com/users/devdinu/received_events","type":"User","site_admin":false},"body":"- list, save, delete, exits operations with the storages are benchmarked. closes #382.\r\n- changed storage/testsuite cleanup to return error\r\n- changed `MongoConnectionTimeoutSecWithDefault` to return time.Duration instead of string\r\n\r\n\r\nCleanup/Post:\r\n- could run benchmarks as part of ci\r\n- create required storage without TestSuite,Model.","created_at":"2018-08-08T09:52:08Z","updated_at":"2018-08-08T13:45:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ace7f16b3538a327bee1466c4823d49d73d8965","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/gomods/athens/pulls/426/commits","review_comments_url":"https://api.github.com/repos/gomods/athens/pulls/426/comments","review_comment_url":"https://api.github.com/repos/gomods/athens/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gomods/athens/issues/426/comments","statuses_url":"https://api.github.com/repos/gomods/athens/statuses/554df258e1c95c3de33dc0c0a64f9bc4b883b574","head":{"label":"devslives:benchmark_storages","ref":"benchmark_storages","sha":"554df258e1c95c3de33dc0c0a64f9bc4b883b574","user":{"login":"devslives","id":36442916,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NDQyOTE2","avatar_url":"https://avatars2.githubusercontent.com/u/36442916?v=4","gravatar_id":"","url":"https://api.github.com/users/devslives","html_url":"https://github.com/devslives","followers_url":"https://api.github.com/users/devslives/followers","following_url":"https://api.github.com/users/devslives/following{/other_user}","gists_url":"https://api.github.com/users/devslives/gists{/gist_id}","starred_url":"https://api.github.com/users/devslives/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devslives/subscriptions","organizations_url":"https://api.github.com/users/devslives/orgs","repos_url":"https://api.github.com/users/devslives/repos","events_url":"https://api.github.com/users/devslives/events{/privacy}","received_events_url":"https://api.github.com/users/devslives/received_events","type":"Organization","site_admin":false},"repo":{"id":143164146,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMxNjQxNDY=","name":"athens","full_name":"devslives/athens","owner":{"login":"devslives","id":36442916,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NDQyOTE2","avatar_url":"https://avatars2.githubusercontent.com/u/36442916?v=4","gravatar_id":"","url":"https://api.github.com/users/devslives","html_url":"https://github.com/devslives","followers_url":"https://api.github.com/users/devslives/followers","following_url":"https://api.github.com/users/devslives/following{/other_user}","gists_url":"https://api.github.com/users/devslives/gists{/gist_id}","starred_url":"https://api.github.com/users/devslives/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devslives/subscriptions","organizations_url":"https://api.github.com/users/devslives/orgs","repos_url":"https://api.github.com/users/devslives/repos","events_url":"https://api.github.com/users/devslives/events{/privacy}","received_events_url":"https://api.github.com/users/devslives/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/devslives/athens","description":"A package registry and proxy server for Go","fork":true,"url":"https://api.github.com/repos/devslives/athens","forks_url":"https://api.github.com/repos/devslives/athens/forks","keys_url":"https://api.github.com/repos/devslives/athens/keys{/key_id}","collaborators_url":"https://api.github.com/repos/devslives/athens/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/devslives/athens/teams","hooks_url":"https://api.github.com/repos/devslives/athens/hooks","issue_events_url":"https://api.github.com/repos/devslives/athens/issues/events{/number}","events_url":"https://api.github.com/repos/devslives/athens/events","assignees_url":"https://api.github.com/repos/devslives/athens/assignees{/user}","branches_url":"https://api.github.com/repos/devslives/athens/branches{/branch}","tags_url":"https://api.github.com/repos/devslives/athens/tags","blobs_url":"https://api.github.com/repos/devslives/athens/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/devslives/athens/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/devslives/athens/git/refs{/sha}","trees_url":"https://api.github.com/repos/devslives/athens/git/trees{/sha}","statuses_url":"https://api.github.com/repos/devslives/athens/statuses/{sha}","languages_url":"https://api.github.com/repos/devslives/athens/languages","stargazers_url":"https://api.github.com/repos/devslives/athens/stargazers","contributors_url":"https://api.github.com/repos/devslives/athens/contributors","subscribers_url":"https://api.github.com/repos/devslives/athens/subscribers","subscription_url":"https://api.github.com/repos/devslives/athens/subscription","commits_url":"https://api.github.com/repos/devslives/athens/commits{/sha}","git_commits_url":"https://api.github.com/repos/devslives/athens/git/commits{/sha}","comments_url":"https://api.github.com/repos/devslives/athens/comments{/number}","issue_comment_url":"https://api.github.com/repos/devslives/athens/issues/comments{/number}","contents_url":"https://api.github.com/repos/devslives/athens/contents/{+path}","compare_url":"https://api.github.com/repos/devslives/athens/compare/{base}...{head}","merges_url":"https://api.github.com/repos/devslives/athens/merges","archive_url":"https://api.github.com/repos/devslives/athens/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/devslives/athens/downloads","issues_url":"https://api.github.com/repos/devslives/athens/issues{/number}","pulls_url":"https://api.github.com/repos/devslives/athens/pulls{/number}","milestones_url":"https://api.github.com/repos/devslives/athens/milestones{/number}","notifications_url":"https://api.github.com/repos/devslives/athens/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/devslives/athens/labels{/name}","releases_url":"https://api.github.com/repos/devslives/athens/releases{/id}","deployments_url":"https://api.github.com/repos/devslives/athens/deployments","created_at":"2018-08-01T14:04:06Z","updated_at":"2018-08-01T17:42:56Z","pushed_at":"2018-08-08T12:55:17Z","git_url":"git://github.com/devslives/athens.git","ssh_url":"git@github.com:devslives/athens.git","clone_url":"https://github.com/devslives/athens.git","svn_url":"https://github.com/devslives/athens","homepage":"","size":46935,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gomods:master","ref":"master","sha":"e124f7b9a0b386ae2a66e60254741deb4c450597","user":{"login":"gomods","id":36861827,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2ODYxODI3","avatar_url":"https://avatars3.githubusercontent.com/u/36861827?v=4","gravatar_id":"","url":"https://api.github.com/users/gomods","html_url":"https://github.com/gomods","followers_url":"https://api.github.com/users/gomods/followers","following_url":"https://api.github.com/users/gomods/following{/other_user}","gists_url":"https://api.github.com/users/gomods/gists{/gist_id}","starred_url":"https://api.github.com/users/gomods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gomods/subscriptions","organizations_url":"https://api.github.com/users/gomods/orgs","repos_url":"https://api.github.com/users/gomods/repos","events_url":"https://api.github.com/users/gomods/events{/privacy}","received_events_url":"https://api.github.com/users/gomods/received_events","type":"Organization","site_admin":false},"repo":{"id":122872932,"node_id":"MDEwOlJlcG9zaXRvcnkxMjI4NzI5MzI=","name":"athens","full_name":"gomods/athens","owner":{"login":"gomods","id":36861827,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2ODYxODI3","avatar_url":"https://avatars3.githubusercontent.com/u/36861827?v=4","gravatar_id":"","url":"https://api.github.com/users/gomods","html_url":"https://github.com/gomods","followers_url":"https://api.github.com/users/gomods/followers","following_url":"https://api.github.com/users/gomods/following{/other_user}","gists_url":"https://api.github.com/users/gomods/gists{/gist_id}","starred_url":"https://api.github.com/users/gomods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gomods/subscriptions","organizations_url":"https://api.github.com/users/gomods/orgs","repos_url":"https://api.github.com/users/gomods/repos","events_url":"https://api.github.com/users/gomods/events{/privacy}","received_events_url":"https://api.github.com/users/gomods/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gomods/athens","description":"A distributed proxy server for Go","fork":false,"url":"https://api.github.com/repos/gomods/athens","forks_url":"https://api.github.com/repos/gomods/athens/forks","keys_url":"https://api.github.com/repos/gomods/athens/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gomods/athens/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gomods/athens/teams","hooks_url":"https://api.github.com/repos/gomods/athens/hooks","issue_events_url":"https://api.github.com/repos/gomods/athens/issues/events{/number}","events_url":"https://api.github.com/repos/gomods/athens/events","assignees_url":"https://api.github.com/repos/gomods/athens/assignees{/user}","branches_url":"https://api.github.com/repos/gomods/athens/branches{/branch}","tags_url":"https://api.github.com/repos/gomods/athens/tags","blobs_url":"https://api.github.com/repos/gomods/athens/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gomods/athens/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gomods/athens/git/refs{/sha}","trees_url":"https://api.github.com/repos/gomods/athens/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gomods/athens/statuses/{sha}","languages_url":"https://api.github.com/repos/gomods/athens/languages","stargazers_url":"https://api.github.com/repos/gomods/athens/stargazers","contributors_url":"https://api.github.com/repos/gomods/athens/contributors","subscribers_url":"https://api.github.com/repos/gomods/athens/subscribers","subscription_url":"https://api.github.com/repos/gomods/athens/subscription","commits_url":"https://api.github.com/repos/gomods/athens/commits{/sha}","git_commits_url":"https://api.github.com/repos/gomods/athens/git/commits{/sha}","comments_url":"https://api.github.com/repos/gomods/athens/comments{/number}","issue_comment_url":"https://api.github.com/repos/gomods/athens/issues/comments{/number}","contents_url":"https://api.github.com/repos/gomods/athens/contents/{+path}","compare_url":"https://api.github.com/repos/gomods/athens/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gomods/athens/merges","archive_url":"https://api.github.com/repos/gomods/athens/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gomods/athens/downloads","issues_url":"https://api.github.com/repos/gomods/athens/issues{/number}","pulls_url":"https://api.github.com/repos/gomods/athens/pulls{/number}","milestones_url":"https://api.github.com/repos/gomods/athens/milestones{/number}","notifications_url":"https://api.github.com/repos/gomods/athens/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gomods/athens/labels{/name}","releases_url":"https://api.github.com/repos/gomods/athens/releases{/id}","deployments_url":"https://api.github.com/repos/gomods/athens/deployments","created_at":"2018-02-25T20:19:41Z","updated_at":"2018-08-08T12:13:18Z","pushed_at":"2018-08-08T13:18:11Z","git_url":"git://github.com/gomods/athens.git","ssh_url":"git@github.com:gomods/athens.git","clone_url":"https://github.com/gomods/athens.git","svn_url":"https://github.com/gomods/athens","homepage":"","size":46926,"stargazers_count":491,"watchers_count":491,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"archived":false,"open_issues_count":94,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":45,"open_issues":94,"watchers":491,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gomods/athens/pulls/426"},"html":{"href":"https://github.com/gomods/athens/pull/426"},"issue":{"href":"https://api.github.com/repos/gomods/athens/issues/426"},"comments":{"href":"https://api.github.com/repos/gomods/athens/issues/426/comments"},"review_comments":{"href":"https://api.github.com/repos/gomods/athens/pulls/426/comments"},"review_comment":{"href":"https://api.github.com/repos/gomods/athens/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gomods/athens/pulls/426/commits"},"statuses":{"href":"https://api.github.com/repos/gomods/athens/statuses/554df258e1c95c3de33dc0c0a64f9bc4b883b574"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"marwan-at-work"}}