{"action":"created","issue":{"url":"https://api.github.com/repos/EventStore/EventStore/issues/982","repository_url":"https://api.github.com/repos/EventStore/EventStore","labels_url":"https://api.github.com/repos/EventStore/EventStore/issues/982/labels{/name}","comments_url":"https://api.github.com/repos/EventStore/EventStore/issues/982/comments","events_url":"https://api.github.com/repos/EventStore/EventStore/issues/982/events","html_url":"https://github.com/EventStore/EventStore/pull/982","id":165713123,"number":982,"title":"Better queues","user":{"login":"Scooletz","id":519707,"avatar_url":"https://avatars.githubusercontent.com/u/519707?v=3","gravatar_id":"","url":"https://api.github.com/users/Scooletz","html_url":"https://github.com/Scooletz","followers_url":"https://api.github.com/users/Scooletz/followers","following_url":"https://api.github.com/users/Scooletz/following{/other_user}","gists_url":"https://api.github.com/users/Scooletz/gists{/gist_id}","starred_url":"https://api.github.com/users/Scooletz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scooletz/subscriptions","organizations_url":"https://api.github.com/users/Scooletz/orgs","repos_url":"https://api.github.com/users/Scooletz/repos","events_url":"https://api.github.com/users/Scooletz/events{/privacy}","received_events_url":"https://api.github.com/users/Scooletz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-07-15T05:18:39Z","updated_at":"2016-07-17T19:50:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/EventStore/EventStore/pulls/982","html_url":"https://github.com/EventStore/EventStore/pull/982","diff_url":"https://github.com/EventStore/EventStore/pull/982.diff","patch_url":"https://github.com/EventStore/EventStore/pull/982.patch"},"body":"This PR is still **WIP**.\r\n\r\nThis PR introduces much better concurrent queues fitting ES system better than `ConcurrentQueue`:\r\n\r\n1. a multi producer single consumer queue (MPSC)\r\n1. a single producer single consumer queue (SPSC) - currently not used.\r\n\r\nThis results in introducing two new `IQueuedHandler` implementations:\r\n\r\n1. ` QueuedHandlerMresWithMpsc` - an optimized counter part of `QueuedHandlerMRES`\r\n1. ` QueuedHandlerAutoResetWithMpsc` - an optimized counter part of `QueuedHandlerAutoReset`\r\n\r\nEach of them has following properties:\r\n\r\n1. It does no allocate after construction\r\n1. It uses only one field in the array as `Message` is a reference type and can be written with `volatile` (acquire/release barrier) instead of a pair of a value field and a status field (`ConcurrentQueue`).\r\n1. Enables getting and dispatching messages in batches which amortizes the cost of accessing the concurrent structure on the consumers end.\r\n1. It uses padding & mapping to the array address to limit false sharing (`ConcurrentQueue` doesn't have this property)\r\n1. It works only with `IntPtr.Size == 8` as it requires an equivalent of `Volatile.Reaf(ref long)`\r\n1. Tests with 2 producers run on my 4 core machine showed great improvement. Tests with 10 producers didn't but this looks like a scheduling issue."},"comment":{"url":"https://api.github.com/repos/EventStore/EventStore/issues/comments/233200287","html_url":"https://github.com/EventStore/EventStore/pull/982#issuecomment-233200287","issue_url":"https://api.github.com/repos/EventStore/EventStore/issues/982","id":233200287,"user":{"login":"Scooletz","id":519707,"avatar_url":"https://avatars.githubusercontent.com/u/519707?v=3","gravatar_id":"","url":"https://api.github.com/users/Scooletz","html_url":"https://github.com/Scooletz","followers_url":"https://api.github.com/users/Scooletz/followers","following_url":"https://api.github.com/users/Scooletz/following{/other_user}","gists_url":"https://api.github.com/users/Scooletz/gists{/gist_id}","starred_url":"https://api.github.com/users/Scooletz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scooletz/subscriptions","organizations_url":"https://api.github.com/users/Scooletz/orgs","repos_url":"https://api.github.com/users/Scooletz/repos","events_url":"https://api.github.com/users/Scooletz/events{/privacy}","received_events_url":"https://api.github.com/users/Scooletz/received_events","type":"User","site_admin":false},"created_at":"2016-07-17T19:50:06Z","updated_at":"2016-07-17T19:50:06Z","body":"@gregoryyoung Do you mean this [line](https://github.com/Scooletz/EventStore/blob/7d165f8ffad42bcd6d00e822683890c28d2a1481/src/EventStore.Core/Bus/QueuedHandlerMRESWithMPSC.cs#L178)? If yes, then as I understand ES, you wanted not to spin when queues are empty. If you meant sth else, could you point me to it?\r\n"}}
{"actor":{"display_login":"Scooletz"}}