0

I have a service that I am writing that will poll a web service approx once every second to see if data is available for the client. The reason the polling frequency is so frequent is that the data get's sent to the client workstation that the service is running on and the users need to see this data in semi-real time. Currently I am using a WebClient object and running a ".DownloadString" operation. I am initializing the WebClient with a "using" statement and surrounding it all in an endless while loop. Currently the service is consuming over 30mb of memory in task manager and I need to try and keep it under 10mb due to the workstations it will be running on.

Any ideas on how to perform these web requests without the memory footprint that WebClient is giving me? I am open to any ideas. Or am I just using the WebClient wrong? Seemed pretty straight forward.

Thanks.

mrglover
  • 3
  • 1

1 Answers1

0

Polling data over http/html seems to be a waste of time and resources. If you use a TcpClient connection to actually send data when new data is available, you may indeed use a lot less resources.

nvoigt
  • 75,013
  • 26
  • 93
  • 142
  • The problem is having the service on the web server side actually monitoring for data. Our current architecture is setup for clients to poll the web servers. For what you are talking about, I would need to have a server setup sending packets to the client (PUSH) when data is avail right? What I also didn't mention is that this is probably going to run on about 200 clients. Would TcpClient still be a good option with this new information? – mrglover Oct 28 '13 at 17:07
  • If you need semi-realtime, polling webservers is not the prefered way. The protocol has a lot of overhead compared to binary data and polling is never efficient. The more connections there are, the more inefficient it gets. Do you know how frequent changes in the data will actually be? – nvoigt Oct 28 '13 at 17:16
  • so if I am being more specific, this is a client that brings down bar-code data to the client after a bar-code is scanned from an iPhone Scanner. So, user scans bar-code, data must appear on screen. What would be the preferred method of getting that data to the client? – mrglover Oct 28 '13 at 17:19