{"action":"created","issue":{"url":"https://api.github.com/repos/boltdb/bolt/issues/285","labels_url":"https://api.github.com/repos/boltdb/bolt/issues/285/labels{/name}","comments_url":"https://api.github.com/repos/boltdb/bolt/issues/285/comments","events_url":"https://api.github.com/repos/boltdb/bolt/issues/285/events","html_url":"https://github.com/boltdb/bolt/pull/285","id":54654123,"number":285,"title":"Add transaction batching","user":{"login":"tv42","id":419909,"avatar_url":"https://avatars.githubusercontent.com/u/419909?v=3","gravatar_id":"","url":"https://api.github.com/users/tv42","html_url":"https://github.com/tv42","followers_url":"https://api.github.com/users/tv42/followers","following_url":"https://api.github.com/users/tv42/following{/other_user}","gists_url":"https://api.github.com/users/tv42/gists{/gist_id}","starred_url":"https://api.github.com/users/tv42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tv42/subscriptions","organizations_url":"https://api.github.com/users/tv42/orgs","repos_url":"https://api.github.com/users/tv42/repos","events_url":"https://api.github.com/users/tv42/events{/privacy}","received_events_url":"https://api.github.com/users/tv42/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-17T07:21:37Z","updated_at":"2015-01-18T18:09:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/boltdb/bolt/pulls/285","html_url":"https://github.com/boltdb/bolt/pull/285","diff_url":"https://github.com/boltdb/bolt/pull/285.diff","patch_url":"https://github.com/boltdb/bolt/pull/285.patch"},"body":"Batcher makes it easy to make lots of small transactions with\r\nsignificantly better performance. Batcher.Update combines multiple\r\nUpdate calls into a single disk transaction, managing errors smartly.\r\n\r\n\r\nI'm aware of https://github.com/boltdb/coalescer. I wrote the original version of this before you pushed coalescer, it just took a while for me to circle back to cleaning it up. This code doesn't leave a goroutine around, and is a few percent faster ;) But the real difference to coalescer is this: with this code, callers don't need to write a for loop around ErrRollback. I pull failing updaters out of the transaction, and retry the others automatically.\r\n\r\nI'd really like to see this as part of bolt, and I feel like having a good batcher mechanism would help significantly with performance complaints like https://github.com/boltdb/bolt/issues/244 . If this looks promising, it could even sit alongside DB.Update as DB.Batch -- or even become DB.Update (though beware the \"runs multiple times\" behavior difference).\r\n\r\nWith this in place, I see no reason why any of my apps would ever again bother doing non-batched transactions.\r\n\r\nLet me know what you think. If you say no, this'll live as tv42/semiauto (as opposed to bolt action..)"},"comment":{"url":"https://api.github.com/repos/boltdb/bolt/issues/comments/70418571","html_url":"https://github.com/boltdb/bolt/pull/285#issuecomment-70418571","issue_url":"https://api.github.com/repos/boltdb/bolt/issues/285","id":70418571,"user":{"login":"davecgh","id":2115102,"avatar_url":"https://avatars.githubusercontent.com/u/2115102?v=3","gravatar_id":"","url":"https://api.github.com/users/davecgh","html_url":"https://github.com/davecgh","followers_url":"https://api.github.com/users/davecgh/followers","following_url":"https://api.github.com/users/davecgh/following{/other_user}","gists_url":"https://api.github.com/users/davecgh/gists{/gist_id}","starred_url":"https://api.github.com/users/davecgh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davecgh/subscriptions","organizations_url":"https://api.github.com/users/davecgh/orgs","repos_url":"https://api.github.com/users/davecgh/repos","events_url":"https://api.github.com/users/davecgh/events{/privacy}","received_events_url":"https://api.github.com/users/davecgh/received_events","type":"User","site_admin":false},"created_at":"2015-01-18T18:09:55Z","updated_at":"2015-01-18T18:09:55Z","body":"I would highly recommend this pull request include documentation additions to README.md with example usage, caveats, etc."}}