{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/orleans/pulls/comments/49389831","id":49389831,"diff_hunk":"@@ -0,0 +1,306 @@\n+﻿\n+using System;\n+using System.Collections.Concurrent;\n+using System.Collections.Generic;\n+using System.Linq;\n+using Orleans.Streams;\n+\n+namespace Orleans.Providers.Streams.Common\n+{\n+    public class PooledQueueCache<TQueueMessage, TCachedMessage>","path":"src/OrleansProviders/Streams/Common/PooledCache/PooledQueueCache.cs","position":10,"original_position":10,"commit_id":"ea3bb9d33f3d4cf65925f4d885f9e46c3782950d","original_commit_id":"ea3bb9d33f3d4cf65925f4d885f9e46c3782950d","user":{"login":"jdom","id":1361686,"avatar_url":"https://avatars.githubusercontent.com/u/1361686?v=3","gravatar_id":"","url":"https://api.github.com/users/jdom","html_url":"https://github.com/jdom","followers_url":"https://api.github.com/users/jdom/followers","following_url":"https://api.github.com/users/jdom/following{/other_user}","gists_url":"https://api.github.com/users/jdom/gists{/gist_id}","starred_url":"https://api.github.com/users/jdom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdom/subscriptions","organizations_url":"https://api.github.com/users/jdom/orgs","repos_url":"https://api.github.com/users/jdom/repos","events_url":"https://api.github.com/users/jdom/events{/privacy}","received_events_url":"https://api.github.com/users/jdom/received_events","type":"User","site_admin":false},"body":"Description of what this class does? Due to the double layer of pooling and also different objects for metadata and the message payload, it is a little confusing to follow (at least in the diff). Would it be possible to have a place somewhere that puts all the pieces together? Maybe in ObjectPool which I assume should be the \"root\" of all this hierarchy? Or if there's a better place, go for it","created_at":"2016-01-11T22:36:05Z","updated_at":"2016-01-11T22:36:05Z","html_url":"https://github.com/dotnet/orleans/pull/1245#discussion_r49389831","pull_request_url":"https://api.github.com/repos/dotnet/orleans/pulls/1245","_links":{"self":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/comments/49389831"},"html":{"href":"https://github.com/dotnet/orleans/pull/1245#discussion_r49389831"},"pull_request":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/1245"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/orleans/pulls/1245","id":55288119,"html_url":"https://github.com/dotnet/orleans/pull/1245","diff_url":"https://github.com/dotnet/orleans/pull/1245.diff","patch_url":"https://github.com/dotnet/orleans/pull/1245.patch","issue_url":"https://api.github.com/repos/dotnet/orleans/issues/1245","number":1245,"state":"open","locked":false,"title":"PooledQueueCache","user":{"login":"jason-bragg","id":10675494,"avatar_url":"https://avatars.githubusercontent.com/u/10675494?v=3","gravatar_id":"","url":"https://api.github.com/users/jason-bragg","html_url":"https://github.com/jason-bragg","followers_url":"https://api.github.com/users/jason-bragg/followers","following_url":"https://api.github.com/users/jason-bragg/following{/other_user}","gists_url":"https://api.github.com/users/jason-bragg/gists{/gist_id}","starred_url":"https://api.github.com/users/jason-bragg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jason-bragg/subscriptions","organizations_url":"https://api.github.com/users/jason-bragg/orgs","repos_url":"https://api.github.com/users/jason-bragg/repos","events_url":"https://api.github.com/users/jason-bragg/events{/privacy}","received_events_url":"https://api.github.com/users/jason-bragg/received_events","type":"User","site_admin":false},"body":"This is the initial prototype of a pooled cache for the recoverable `EventHubStreamProvider`.\r\n\r\nSee: Recoverable Event Hub Persistent Stream Provider #1096\r\nThis is approximately what is described in \"2. Introduce BigQueueCache...\"\r\n\r\nAt this point, this queue cache is mainly a set of components that can be assembled into a fast in memory cache.  Further development will work to wrap and simplify these components.\r\n\r\nThe main goal of this cache is to support the caching of high throughput queues (~2k+ messages / queue / second) for an extended period of time (~30 minutes of data) amounting to gigs worth of data with minimal performance degradation due to garbage collection.\r\n\r\nUnlike the simple queue cache, this queue purges data when cache capacity is reached, regardless of whether the events have been delivered or not.  The reasons for this is that it's intended for fast recoverable real time processing, so if processing gets too far behind (~15-30 minutes) it's preferable to drop those events and process new events in a timely manner than to fall further and further behind.\r\n\r\nThis implementation currently has no mechanism for regulating backpressure from stream processing delays.\r\n\r\nSome components this implementation includes:\r\n- A basic object pool\r\n- A fixed size object pool that will trigger a purge of resources when it's capacity is reached.\r\n- A fixed size buffer that allocates blocks of data used to cached serialized message payloads\r\n- A block of tightly packed message metadata structures for cached messages.\r\n\r\nTesting:\r\n- Minimal BVT tests have been added - more are needed.\r\n- GeneratorStreamProvider has been updated to use the PooledQueueCache.  It's test now exersize this code.","created_at":"2016-01-07T01:11:47Z","updated_at":"2016-01-11T22:36:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2069c159a4a8d18d1143caf2e45f7f647be8e300","assignee":{"login":"gabikliot","id":10171207,"avatar_url":"https://avatars.githubusercontent.com/u/10171207?v=3","gravatar_id":"","url":"https://api.github.com/users/gabikliot","html_url":"https://github.com/gabikliot","followers_url":"https://api.github.com/users/gabikliot/followers","following_url":"https://api.github.com/users/gabikliot/following{/other_user}","gists_url":"https://api.github.com/users/gabikliot/gists{/gist_id}","starred_url":"https://api.github.com/users/gabikliot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabikliot/subscriptions","organizations_url":"https://api.github.com/users/gabikliot/orgs","repos_url":"https://api.github.com/users/gabikliot/repos","events_url":"https://api.github.com/users/gabikliot/events{/privacy}","received_events_url":"https://api.github.com/users/gabikliot/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/orleans/pulls/1245/commits","review_comments_url":"https://api.github.com/repos/dotnet/orleans/pulls/1245/comments","review_comment_url":"https://api.github.com/repos/dotnet/orleans/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/orleans/issues/1245/comments","statuses_url":"https://api.github.com/repos/dotnet/orleans/statuses/ea3bb9d33f3d4cf65925f4d885f9e46c3782950d","head":{"label":"jason-bragg:PooledQueueCache","ref":"PooledQueueCache","sha":"ea3bb9d33f3d4cf65925f4d885f9e46c3782950d","user":{"login":"jason-bragg","id":10675494,"avatar_url":"https://avatars.githubusercontent.com/u/10675494?v=3","gravatar_id":"","url":"https://api.github.com/users/jason-bragg","html_url":"https://github.com/jason-bragg","followers_url":"https://api.github.com/users/jason-bragg/followers","following_url":"https://api.github.com/users/jason-bragg/following{/other_user}","gists_url":"https://api.github.com/users/jason-bragg/gists{/gist_id}","starred_url":"https://api.github.com/users/jason-bragg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jason-bragg/subscriptions","organizations_url":"https://api.github.com/users/jason-bragg/orgs","repos_url":"https://api.github.com/users/jason-bragg/repos","events_url":"https://api.github.com/users/jason-bragg/events{/privacy}","received_events_url":"https://api.github.com/users/jason-bragg/received_events","type":"User","site_admin":false},"repo":{"id":29758989,"name":"orleans","full_name":"jason-bragg/orleans","owner":{"login":"jason-bragg","id":10675494,"avatar_url":"https://avatars.githubusercontent.com/u/10675494?v=3","gravatar_id":"","url":"https://api.github.com/users/jason-bragg","html_url":"https://github.com/jason-bragg","followers_url":"https://api.github.com/users/jason-bragg/followers","following_url":"https://api.github.com/users/jason-bragg/following{/other_user}","gists_url":"https://api.github.com/users/jason-bragg/gists{/gist_id}","starred_url":"https://api.github.com/users/jason-bragg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jason-bragg/subscriptions","organizations_url":"https://api.github.com/users/jason-bragg/orgs","repos_url":"https://api.github.com/users/jason-bragg/repos","events_url":"https://api.github.com/users/jason-bragg/events{/privacy}","received_events_url":"https://api.github.com/users/jason-bragg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jason-bragg/orleans","description":"Repo for Orleans - Distributed Actor Model","fork":true,"url":"https://api.github.com/repos/jason-bragg/orleans","forks_url":"https://api.github.com/repos/jason-bragg/orleans/forks","keys_url":"https://api.github.com/repos/jason-bragg/orleans/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jason-bragg/orleans/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jason-bragg/orleans/teams","hooks_url":"https://api.github.com/repos/jason-bragg/orleans/hooks","issue_events_url":"https://api.github.com/repos/jason-bragg/orleans/issues/events{/number}","events_url":"https://api.github.com/repos/jason-bragg/orleans/events","assignees_url":"https://api.github.com/repos/jason-bragg/orleans/assignees{/user}","branches_url":"https://api.github.com/repos/jason-bragg/orleans/branches{/branch}","tags_url":"https://api.github.com/repos/jason-bragg/orleans/tags","blobs_url":"https://api.github.com/repos/jason-bragg/orleans/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jason-bragg/orleans/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jason-bragg/orleans/git/refs{/sha}","trees_url":"https://api.github.com/repos/jason-bragg/orleans/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jason-bragg/orleans/statuses/{sha}","languages_url":"https://api.github.com/repos/jason-bragg/orleans/languages","stargazers_url":"https://api.github.com/repos/jason-bragg/orleans/stargazers","contributors_url":"https://api.github.com/repos/jason-bragg/orleans/contributors","subscribers_url":"https://api.github.com/repos/jason-bragg/orleans/subscribers","subscription_url":"https://api.github.com/repos/jason-bragg/orleans/subscription","commits_url":"https://api.github.com/repos/jason-bragg/orleans/commits{/sha}","git_commits_url":"https://api.github.com/repos/jason-bragg/orleans/git/commits{/sha}","comments_url":"https://api.github.com/repos/jason-bragg/orleans/comments{/number}","issue_comment_url":"https://api.github.com/repos/jason-bragg/orleans/issues/comments{/number}","contents_url":"https://api.github.com/repos/jason-bragg/orleans/contents/{+path}","compare_url":"https://api.github.com/repos/jason-bragg/orleans/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jason-bragg/orleans/merges","archive_url":"https://api.github.com/repos/jason-bragg/orleans/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jason-bragg/orleans/downloads","issues_url":"https://api.github.com/repos/jason-bragg/orleans/issues{/number}","pulls_url":"https://api.github.com/repos/jason-bragg/orleans/pulls{/number}","milestones_url":"https://api.github.com/repos/jason-bragg/orleans/milestones{/number}","notifications_url":"https://api.github.com/repos/jason-bragg/orleans/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jason-bragg/orleans/labels{/name}","releases_url":"https://api.github.com/repos/jason-bragg/orleans/releases{/id}","created_at":"2015-01-23T23:54:23Z","updated_at":"2015-05-08T07:33:42Z","pushed_at":"2016-01-08T20:20:05Z","git_url":"git://github.com/jason-bragg/orleans.git","ssh_url":"git@github.com:jason-bragg/orleans.git","clone_url":"https://github.com/jason-bragg/orleans.git","svn_url":"https://github.com/jason-bragg/orleans","homepage":"","size":9229,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"1ae027febed6e58c00b931e53bb73146e9d57a81","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":28232663,"name":"orleans","full_name":"dotnet/orleans","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/orleans","description":"Orleans - Distributed Virtual Actor Model","fork":false,"url":"https://api.github.com/repos/dotnet/orleans","forks_url":"https://api.github.com/repos/dotnet/orleans/forks","keys_url":"https://api.github.com/repos/dotnet/orleans/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/orleans/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/orleans/teams","hooks_url":"https://api.github.com/repos/dotnet/orleans/hooks","issue_events_url":"https://api.github.com/repos/dotnet/orleans/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/orleans/events","assignees_url":"https://api.github.com/repos/dotnet/orleans/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/orleans/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/orleans/tags","blobs_url":"https://api.github.com/repos/dotnet/orleans/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/orleans/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/orleans/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/orleans/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/orleans/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/orleans/languages","stargazers_url":"https://api.github.com/repos/dotnet/orleans/stargazers","contributors_url":"https://api.github.com/repos/dotnet/orleans/contributors","subscribers_url":"https://api.github.com/repos/dotnet/orleans/subscribers","subscription_url":"https://api.github.com/repos/dotnet/orleans/subscription","commits_url":"https://api.github.com/repos/dotnet/orleans/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/orleans/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/orleans/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/orleans/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/orleans/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/orleans/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/orleans/merges","archive_url":"https://api.github.com/repos/dotnet/orleans/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/orleans/downloads","issues_url":"https://api.github.com/repos/dotnet/orleans/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/orleans/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/orleans/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/orleans/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/orleans/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/orleans/releases{/id}","created_at":"2014-12-19T14:32:50Z","updated_at":"2016-01-11T11:19:24Z","pushed_at":"2016-01-11T21:59:27Z","git_url":"git://github.com/dotnet/orleans.git","ssh_url":"git@github.com:dotnet/orleans.git","clone_url":"https://github.com/dotnet/orleans.git","svn_url":"https://github.com/dotnet/orleans","homepage":"http://dotnet.github.io/orleans","size":29966,"stargazers_count":1431,"watchers_count":1431,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":347,"mirror_url":null,"open_issues_count":130,"forks":347,"open_issues":130,"watchers":1431,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/1245"},"html":{"href":"https://github.com/dotnet/orleans/pull/1245"},"issue":{"href":"https://api.github.com/repos/dotnet/orleans/issues/1245"},"comments":{"href":"https://api.github.com/repos/dotnet/orleans/issues/1245/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/1245/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/1245/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/orleans/statuses/ea3bb9d33f3d4cf65925f4d885f9e46c3782950d"}}}}