views:

352

answers:

2

We are developing a Windows Forms application that will be installed on about 1,000 employee pcs. Users may run multiple instances of the application at the same time. The clients are all on a single intranet.

Changes in the application may cause database record changes, which in turn must be communicated to the other clients so their UIs are updated.

Our team has talked about two different approaches:

1. Multicast packets

The source client modifies the records and then sends out a multicast packet with a payload that something has changed. The other clients receive this and fetch the data specified. We need to account for the cases when the packet is not received, falling back onto actively retrieving the data.

My question at this point is how does a client know it didn't receive a packet? (don't know what you don't know) Which brings us to some sort of event log with timestamps in the database, and UI controls track the last time they were updated. They come into focus, check their timestamps, and update as needed.

Someone else said the UI elements would just reload every time they come into focus (think modes in outlook, bringing controls to the front of a stack workspace with CAB). And that the multicast is to update the clients that their current context has changed. If they miss it they work with stale data until they change modes and come back.

2. WCF and Callbacks

Clients register with WCF contracts for callbacks over a tcp binding. The primary technical concern with this is the server maintaining many open sockets. We have read up on how it isn't open in the traditional sense, it is put to sleep for a maximum of 90 seconds and then re-established at that point. We also read about the maximum number of open connections a Windows 2003 Server machine can handle, and how to modify that in the registry.

If we have 1,000 open socket connections to a server is this going to fall apart?

If anyone has faced this same situation and tried or evaluated the WCF approach we would love to hear about it.

+1  A: 

I have not implemented a situation like this. However, I would think that one of the duplex bindings would not necessarily have a high overhead.

It all depends on how much information the server needs to send back to the clients. I understand you said the information will be used for them to update their UI. However it seems possible that they may not all need the same amount of information at the same time. For instance, if information about the Western region has changed, all 1000 clients may want to know that there is a change, and they may all want to update summary-level information about the Western region, but perhaps only 1/4 of them may need to see the details of the change.

If this is the case, then I'd recommend that the callback only provide information about what has changed, mostly at a summary level. Let those clients who are interested in the details of the change ask for the details. You might even go as far as to provide all the details for the top one or two levels of hierarchy, then for the rest, just include information saying "this changed at time". That way, depending on the level of hierarchy being viewed by a particular client, the client could then ask or not ask.

If necessary, you could batch updates together. If the clients only need to be updated once per second, then you could accumulate the changes for the last second and send them all at once.

You may also want to use some of the Peer to Peer bindings for some tasks. Perhaps the clients in a particular area of your business would like to know a little about what each other are working on - that sort of thing.

John Saunders
You touch on many things we have discussed and are thinking about, such as batching updates. You highlight that I did not fully describe the environment, but it is approximately 1,000 users on the same physical LAN in geographically adjacent buildings. The data doesn't span multiple vertical areas, all the users are pretty much looking at the same data, its just some may edit items, and most cannot, the exception being a personal organization module. I think your answer helps, so +1, but I am going to see if anyone has tried this and knows of any performance / resource issues. Thank you.
blu
Great. In fact, I'd be interested to learn the outcome of this; at least of any proof of concept you may do. It'd be a great thing for you to blog about (hint, hint).
John Saunders
A: 

Take a look at this article, it uses WCF and Callbacks to update multiple clients whenever any of them makes a change: http://www.devx.com/dotnet/Article/38814/1763

Nader