Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am using a wcf service call to call a method to populate a datagrid. This is taking long time to retrieve the list from the service operation contract. and sometimes when i turn off my antivirus the execution time is a little faster. Does this have anything to do with my antivirus. How can i increase the service call speed?
*IMP* the same thing has been already tested without wcf operation contract the execution is much more faster and quicker compared to wcf service contract.

What I have tried:

Tried to increase timeout,paging but with of no consequences.
Posted
Updated 14-Jul-16 5:08am
v3

1 solution

Hi Yogi@FLG,

You didn't mention how you call your WCF Service from your application(?). If you really want to know about performance you have to test it on a production-near nnvironment. You are mentioning your antivirus - that's not a good sign about your understanding of perfomance tests (more likely you use some network inspection tool, not antivirus alone). Forget about this, only use compiled and run (JITTED) code for perfomance comparison on production near, or minimum requirement system - than draw your conclusions.
Not to mention that it's logical that a direct call will always be faster than going through a service call (you understand how this works?), but that's by nature of the topic - you create Services to make tech independend, reusable parts, not for perfomance!

You didn't mention your specific Scenario, so it's quite hard to give good advice.
But for WCF some things come to my mind you may want to consider.
* Message/data protocol/serialization - SOAP/JASON (how deep are your object Graphs?) Did you design your Service methods with this in mind (I try to use the least Information passing possible. E.g if I Need the order's for a customer, wyh send the whole customer object, if you only need the customer-id to select the orders from your datastore).
* Try to simulate different network latencies.
* If data-need is very high and you can do nothing about it - maybe consider different patterns (data-paging, Caching or Background sync) - e.g. In a current project I use data-virtualization on the Client-side which will initially load only 3 pages of the data.)
* Depends how you call your wcf Service (throgh Proxy?) but if you create channelfactory and channels on demand: Best is to store the channelfactories for each contract you call in a cache (simple dictionary will do) - so create them only once in your application, then create/drop new channels as you need from your cached channelfactories (creating the factory is the expensive Task, creating channels from a cached factory is lightning fast)

Maybe I can give some further advice if you tell me what binding's you use and how you call the Service from the "client-side" (maybe anothter Service though). Other Information like hosting Environment, Instance-Context mode etc. also have a little influence on perfomace you should know about - as I said - make perfomance tests never during develpment on your machine - always use a reference system (normally you will make Debugging easy and during development you will host the services on the same computer where the client-Code is run), so real perfomance-test with real network-delay is a must if perfomance is critical.

After mentioning that all, I have to say after I have done many projects with wcf service-architecture, I wonder more often why all is so fast than why it's "slow". In the end a Service is an abstraction, and you always have to pay a price for that, but real bad perfomance (compared to a direct call) is a hint that maybe something is "wrong" - and shure a "stupid" antivirus-Suite (like forticlient or something) can have a negative Impact - but I'd only consider this if production environment forces me to do so.... (then create exceptions or rules for the tool whatever)

I hope some of my thoughts will help you.. Happy coding

Kind regards Johannes
 
Share this answer
 
Comments
Yogi@FLG 21-Jul-16 7:00am    
Thank u for the comment , i think i rather explore more knowledge about using wcf services rather than jumping into conclusions.. better have better knowledge about it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900