Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing OR Polling

I have a SL client and a WCF service. The client polls the WCF every 4 seconds and I have almost 100 clients at a time.

The web server is an entry level server with 512 MB RAM.

I want to know, if polling is dependent on the server configuration, if I increase the server configuration will the polling for clients work better?

And second, would pushing (duplex) be better than polling? I have got some mixed response from the blogs I have been reading.

Moreover, what are the best practices in optimizing polling for quicker response at the client? My application needs real-time data

Thanks

like image 676
Jayesh Avatar asked Oct 12 '22 11:10

Jayesh


2 Answers

My guess would be that you have some kind of race condition that is showing up only with a larger number of clients. What concurrency and instancing modes are you using for your WCF service? (See MSDN: WCF Sessions, Instancing, and Concurrency at http://msdn.microsoft.com/en-us/library/ms731193.aspx)

If you're "losing" responses the first thing I would do is start logging or tracing what's happening at the server. For instance, when a client "doesn't see" a response, is the server ever getting a request? (If so, what happens to it, etc etc.)

I would also keep an eye on memory usage -- you don't say what OS you're using, but 512 MB is awfully skinny these days. If you ever get into a swap-to-disk situation, it's clearly not going to be a good thing.

Lastly, assuming that your service is CPU-bound (i.e. no heavy database & filesystem calls), the best way to raise your throughput is probably to reduce the message payload (wire size), use the most performant bindings (i.e. if client is .NET and you control it, NetTcp binding is much faster than HTTP), and, of course, multithread your service. IMHO, with the info you've provided -- and all other things equal -- polling is probably fine and pushing might just make things more complex. If it's important, you really want to bring a true engineering approach to the problem and identify/measure your bottlenecks.

Hope this helps!

like image 97
Keith Bluestone Avatar answered Oct 15 '22 10:10

Keith Bluestone


"Push" notifications generally have a lower network overhead, since no traffic is sent when there's nothing to communicate. But "pull" notifications often have a lower application overhead, since you don't have to maintain state when the client is just idling waiting for a notification.

Push notifications also tend to be "faster", since clients are notified immediately when the event happens rather than waiting for the next polling interval. But pull notifications are more flexible -- you can use just about any server or protocol you want, and you can double your client capacity just by doubling your polling wait interval.

like image 23
tylerl Avatar answered Oct 15 '22 11:10

tylerl