SignalR - Webfarm with Sticky Sessions scenario - signalr

Is it possible to use SignalR in a webfarm with Sticky Sessions? If yes, how?

Yes and No, Yes it's possible. No, not right now because the scaleout is being rewritten for 1.1 (which is in a few weeks). When it's out you'l be able to use SignalR on sticky or non sticky sessions (it's irrelevant really) using Sql server, service bus or redis. There'll be more info about it on http://asp.net/signalr in weeks to come.

Related

how to show updated data to the users as fast as possible (not real-time)?

In database some entity is getting updated by some backend process. We want to show this updated value to the user not real-time but as fast as possible on website.
Problems we are facing with these approaches.
Polling :- As we know that there are better techniques then polling like SSE, WebSockets.
SSE :- In SSE the connection open for long time(I search on internet and found that it uses long polling). Which might cause problem when user increases.
WebSockets :- As we need only one way communication(from server to client), SSE is better then this.
Our Solution
We check database on every request of user and update the value.(It is not very good as it will depend upon user next request)
Is it good approach or is there any better way to do this or Am I missing something about SSE(misunderstood something).
Is it fine to use SignalR instead of this all?(is there any long connection issue in it or not?)
Thanks.
It's just up to your requirements what you should use.
Options:
You clients need only the update information, in the case they make a request -> Go your way
If you need a solution with different client types like (Webclient, Winformclient, Androidclient,....) and you have for example different browser types which you should support. Not all browsers support all mechanisme... SignalR was designed to choose automatically the right transport mechanisme according to the mechanisme which a clients supports --> SignalR is an option. (Read more details here: https://www.asp.net/signalr) Has also options that your connection keeps alive.
There are also alternatives like https://pusher.com/ (For short this is only a queue where you can send messages, and also subscribe for messages) But these services are only free until for example some data volume.
You can use event based communication. When ever there is a change(event) in the backend/database, server should send a message to clients.
Your app should register to respective events and refresh the UI when ever there is an update.
We used Socket IO for this usecase, in our apps and it worked well.
Here is the website https://socket.io/

Cross-server communication in load-balanced ASP.NET web application

My ASP.NET application stores some expensive (to load) data in an application-accessible static field (using System.Web.Caching.Cache is inappropriate in this case).
My application is also load-balanced across a couple of webservers with a central SQL Server on another machine.
There are times when this cache will be invalidated. If the user submits some updated data on Server01 then that application knows about it can will clear its local cache when it also submits the data to the database.
However, how can Server01 notify Server02 of this change so Server02's cache will be invalidated?
I'm not aware of any built-in inter-server IPC in ASP.NET for web-farm communication, it seems that I would have to create a URI handler in the application (e.g. http://mysite/InvalidateCache) that would be called by the other server, but it seems a bit hackish. Is there a better way?
I was having a bit of a brain-fart and realized that web-servers can communicate between each other simply by sending each other requests - there is no need for a special side-channel line. I earlier call the idea hackish, but it's sound in theory.
Obviously for security purposes these requests need to go through a physical private network connection, or have cryptographically signed requests, but I really can't think of anything wrong with that approach now.
I would suggest you explore a distributed cache like AppFabric. http://msdn.microsoft.com/en-us/library/ff383731(v=azure.10).aspx

AppFabric DataCacheSessionStoreProvider : some feedback?

Has anyone some feedback on DataCacheSessionStoreProvider included in AppFabric ?
(Performance, Best Practices, Design guidelines, ...)
Thanks
Good out of box solution if you want to use AppFabric as your caching system. In our performance tests AppFabric session cache performance is about 2000 requests per second (AppFabric 1.0? only one server without secondary caches). It seems that this WCF service performance limit.
Though i have never use it with AppFabric but I've used NCache session Store Provider.NCache lets you transform your regular ASP.NET sessions into distributed sessions without any code change. You follow a few simple steps and your existing ASP.NET applications can immediately benefit from powerful distributed sessions. please check This Link, it might help you .

Is there a way to check server's session timeout without having access to the server itself?

Basically I am interacting with a .NET web application and I want to know what is the session timeout of that server.
I know that usually for IIS 6 is between 8-20 minutes by default but I want the specific timeout without speculating or keeping timers etc.
Thanks in advance.
I don't think is possible unless the server explicitly has provisions to allow it (expose it) to the front-end querying the server's services...

AppFabric SessionState with SQL Server as a backup

If you wish to use AppFabric in high availability mode then you need to ensure that all of your cache servers are running Enterprise edition of Server 2008. This isn't possible for us in our environment.
We currently use a single machine acting as a state server for our web farm. Obviously this leaves us open with a single point of failure.
On investigating AppFabric I found that it was able to handle session state. We are looking at introducing it anyway in our caching layer.
The problem with not running it in HA mode is that if a node goes down you lose the sessions hosted on that box.
I wondered if anyone had implemented a custom state provider which supported AppFabric and asynchronously backed the state off to a SQL Server so that in the event of a server going dark for whatever reason the state could be rebuilt.
I have put no development time into in my idea yet but thought I would float the idea past some clever devs to see if it has been attempted,considered or there are any glaring holes in my idea.
i found here http://netpl.blogspot.fr/2007/06/wrapped-inprocsessionstatestore.html, a solution for having a generic wrapper, but it does not seems quite robust.
Maybe it is possible to switch between providers based upon a particular event or variable.

Resources