{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/606","labels_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/606/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/606/comments","events_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/606/events","html_url":"https://github.com/Azure/azure-webjobs-sdk/pull/606","id":121142634,"number":606,"title":"Perf work for Dashboard logging and ServiceBus (PrefetchCount)","user":{"login":"mathewc","id":1056548,"avatar_url":"https://avatars.githubusercontent.com/u/1056548?v=3","gravatar_id":"","url":"https://api.github.com/users/mathewc","html_url":"https://github.com/mathewc","followers_url":"https://api.github.com/users/mathewc/followers","following_url":"https://api.github.com/users/mathewc/following{/other_user}","gists_url":"https://api.github.com/users/mathewc/gists{/gist_id}","starred_url":"https://api.github.com/users/mathewc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathewc/subscriptions","organizations_url":"https://api.github.com/users/mathewc/orgs","repos_url":"https://api.github.com/users/mathewc/repos","events_url":"https://api.github.com/users/mathewc/events{/privacy}","received_events_url":"https://api.github.com/users/mathewc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/labels/cla-already-signed","name":"cla-already-signed","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-09T01:51:21Z","updated_at":"2015-12-10T18:11:05Z","closed_at":"2015-12-09T01:53:58Z","pull_request":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/606","html_url":"https://github.com/Azure/azure-webjobs-sdk/pull/606","diff_url":"https://github.com/Azure/azure-webjobs-sdk/pull/606.diff","patch_url":"https://github.com/Azure/azure-webjobs-sdk/pull/606.patch"},"body":"Adding a new **TraceLevelAttribute** that can be applied at the class/method level to control Console/Dashboard logging for a particular function. The idea is to allow very high scale functions to opt out of Dashboard logging (since this logging introduces a bit of overhead) to increase throughput. Notes on this feature:\r\n\r\n* If the TraceLevel is set to Off for a function, no Console or Dashboard logs will be written for function invocations\r\n* If the TraceLevel is set to Error for a function, normal invocations will not produce logs, but if a function errors it will produce logs (both Console and Dashboard)\r\n* When functions are invoked manually via Dashboard Run/Replay, or via JobHost.Call, any TraceLevelAttribute annotation will be ignored, and normal full logs will be produced. This facilitates development/debugging, while retaining the benefits of actual steady state production behavior.\r\n\r\nAdding a **ServiceBusConfiguration.PrefetchCount** setting to allow users to easily configure this for performance. The value will be applied to all MessageReceivers the runtime creates (`MessageReceiver.PrefetchCount`). Also adding a new virtual method **MessagingProvider.CreateMessageReceiver** to allow users to further customize MessageReceivers as needed. Users can override this to to return a receiver they have configured.\r\n\r\nUsing these two new features (setting PrefetchCount to 100), we are able to achieve throughput parity for a high scale ServiceBus job function (below). In my testing, this function could process the same number of messages per second as a non-WebJobs ServiceBus MessageReceiver configured with the same settings. In my testing, I was pushing this to ~800 messages per second on a single instance.\r\n\r\n```csharp\r\n[TraceLevel(TraceLevel.Error)]\r\npublic static async Task ProcessMessageAsync(\r\n    [ServiceBusTrigger(\"perftest\")] BrokeredMessage message)\r\n{\r\n    Program.MessageProcessed();\r\n    await Task.Delay(10);\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/comments/163705950","html_url":"https://github.com/Azure/azure-webjobs-sdk/pull/606#issuecomment-163705950","issue_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/606","id":163705950,"user":{"login":"mathewc","id":1056548,"avatar_url":"https://avatars.githubusercontent.com/u/1056548?v=3","gravatar_id":"","url":"https://api.github.com/users/mathewc","html_url":"https://github.com/mathewc","followers_url":"https://api.github.com/users/mathewc/followers","following_url":"https://api.github.com/users/mathewc/following{/other_user}","gists_url":"https://api.github.com/users/mathewc/gists{/gist_id}","starred_url":"https://api.github.com/users/mathewc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathewc/subscriptions","organizations_url":"https://api.github.com/users/mathewc/orgs","repos_url":"https://api.github.com/users/mathewc/repos","events_url":"https://api.github.com/users/mathewc/events{/privacy}","received_events_url":"https://api.github.com/users/mathewc/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T18:11:05Z","updated_at":"2015-12-10T18:11:05Z","body":"Thanks guys. What do you guys thing about the new **MessagingProvider.CreateMessageReceiver** overload I added to allow people to override the creation of the MessageReceiver used by the listener? I did that as an escape hatch in case any other additional advanced options might need to be configured for perf, like PrefetchCount. I promoted PrefetchCount to top level ServiceBusConfiguration because like OnMessageOptions it is likely a common thing to configure. Are there any other things that SB users might want to configure that I'm missing, or do you think these settings and methods allow most of the scenarios?"}}