launchdarkly / dotnet-server-sdk

LaunchDarkly Server-Side SDK for .NET
https://launchdarkly.com
Other
54 stars 25 forks source link

.NET client doesn't use SSE #55

Closed ahofman closed 6 years ago

ahofman commented 7 years ago

The LD documentation gives the impression that the SDK's use SSE (emphasis mine)

SSE - Do you make a remote call every time a feature flag is requested? LaunchDarkly uses a novel streaming architecture to serve feature flags without making remote requests. We use server-sent events (SSE), a protocol for one-way real-time messaging, to send messages to your servers whenever you change the feature flag rules on your dashboard. SSE is widely used for server-to-browser messaging, but it works equally well for server-to-server communication. The SSE connection is all handled under the hood by our SDKs.

However on inspection it looks like the .NET SDK kicks off a long-running task that requests all feature flag values once per second.

In our application, the .NET LD SDK is responsible for the vast majority of outbound network connections, most probably because of this polling behavior. Ideally it would use long lived SSE connections as the documentation states.

atrakh commented 7 years ago

Hi @ahofman - thanks for reaching out! We just rolled out a pre-release version of our .NET SDK which adds streaming functionality.

The code is hosted on the following branch: https://github.com/launchdarkly/.net-client/tree/streaming-beta.

New functionality is documented here: https://docs.launchdarkly.com/docs/dotnet-sdk-reference#section-streaming-beta.

ahofman commented 7 years ago

Thanks for your prompt response, we'll try out the streaming preview when we get a chance.

ahofman commented 7 years ago

Hi guys, initially our testing went well but after a day or so all our services started crashing with this

Description: The process was terminated due to an unhandled exception.
Exception Info: Newtonsoft.Json.JsonReaderException
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(Newtonsoft.Json.JsonReader, System.Type, Boolean)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(Newtonsoft.Json.JsonReader, System.Type)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(System.String, System.Type, Newtonsoft.Json.JsonSerializerSettings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.String, Newtonsoft.Json.JsonSerializerSettings)
   at LaunchDarkly.Client.StreamProcessor+<OnMessage>d__16.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

Please be aware that as paying customers we have no interest in carrying out testing on your alpha releases; please implement the streaming functionality as promised on your marketing material to a level of quality that customers are happy to pay good money for. Thankyou

atrakh commented 6 years ago

Hi @ahofman,

Thank you for reporting this, and for your patience.

The crashes you've reported have been resolved in the official release of .net-client v3.4.0. Please also note that with the introduction of this new version we will end support for the previous version of the SDK on Friday, January 12, 2018. So, we'd recommend updating to the most recent of .net-client at your earliest convenience.