0

I have two applications WCF client and WCF server running on same machine. Client calls on server for image data, server prepares few images and gives those images to client and client displays them.

Client application make calls to server every 1sec. The image data here is about 10MB in size.

Following is my configuration.

transferMode="Buffered" maxBufferPoolSize="0"
maxReceivedMessageSize="10485760" maxBufferSize="1048576"
binding="netTcpBinding".

Problem: Some times GetImage call taking more time (>6sec).

Below is log info, for CallNumber 151 it is taken more then 6sec.

CallNumber=144, GetImage duration=977
CallNumber=145, GetImage duration=1060
CallNumber=146, GetImage duration=978
CallNumber=147, GetImage duration=1016
CallNumber=148, GetImage duration=1012
CallNumber=149, GetImage duration=1026
CallNumber=150, GetImage duration=1004
CallNumber=151, GetImage duration=6038
CallNumber=152, GetImage duration=954
CallNumber=153, GetImage duration=1046
CallNumber=154, GetImage duration=992

This behavior is very random. In this example above it ran up to 151 calls, some times it is very early and very frequent.

ebram khalil
  • 8,252
  • 7
  • 42
  • 60
harik
  • 563
  • 2
  • 5
  • 16
  • well its not surprising if you are making calls every second and its doing some form of large processing. have you tried multithreading? most likely it is queuing up until the thread is free to process the next incoming request. post the code you are using to send and receive the data. – Ahmed ilyas Oct 10 '13 at 06:39
  • No threads. The timer handler is locked if it is handling a call and Application.Current.Dispatcher.Invoke is used for updating images in WPF UI. And no threads at server application. Any site where I can upload these two projects (client and server)? – harik Oct 10 '13 at 06:50
  • you should make the server app multithreaded for processing requests at such a high level (i.e every second). Having re-read your comment I think you are saying the timer is disabled until the call is complete, yes? Please post code you are using on the server side :) – Ahmed ilyas Oct 10 '13 at 06:52
  • public AcqImage[] GetImage(int callNo) { var buffer = _images[0].Buffer; _imageGenerator.GenerateBufferFromSeed(ref buffer); buffer = _images[1].Buffer; _imageGenerator.GenerateBufferFromSeed(ref buffer); return _images; } – harik Oct 10 '13 at 07:00
  • its difficult to say. I think it could be the cleanup process that may take longer. it really depends on what the code is like in the imageGenerator object (GenerateBufferFromSeed). Try doing some timing around that specific method. – Ahmed ilyas Oct 10 '13 at 07:17
  • I had put few more logs with timestamps and checked it. Seems that Server GetImage returns the call. But the client GetImage does not return immediatly. It means delay is happening in WCF framework after server GetImage returns to Client. – harik Oct 10 '13 at 10:13
  • Any issues with GC or Memory Pool of WCF? – harik Oct 10 '13 at 10:14
  • Not AFAIK. I will check. What happens if you use a console app as the client to do the calls? Same issue? – Ahmed ilyas Oct 10 '13 at 12:55
  • Yes, it is same issue. Seems to be WCF issue, i tried on VS2012 same result. As a workaround I have switched to shared memory it seems to be working as expected. – harik Nov 12 '13 at 00:41

0 Answers0