Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have write a one store procedure it return 23000 records and its getting 00:00:01 Sec. Timing in Sql-Server ,but when i call this store procedure using WCF + Entity Framework its require timing is 10 Sec (in local Network) for getting result from database

So how to decrease WCF Service Function Processing Timing......
Posted

1 solution

Database server (SQL Server) is a stand-alone application that doesn't have to rely on anything to provide you with data, apart from a few factors such as latency rate etc. So that is why, executing the command (SELECT) would take only 1 second.

Whereas WCF on other hand has to depend on multiple factors, networking for example. User makes request, server handles it, when code wants to connect to another server (SQL Server for instance), the request is then transferred to that page, SQL Server executes command returns the data. WCF server continues to use that data and provide you with other details.

The above process does take a lot of time, a lot of CPU cycles, heap memory and many other things. That is why the process that SQL Server itself took 1 second, is now increased to 10 seconds. You cannot do anything to prevent this from happening. But there can be a tip, for you to solve the problem.

1. Efficient code
The more efficient your code, less time it takes to execute it. There are a lot of factors that cause the CPU to waste its cycles in a process that is of no use. Too many variable initialization, string concatenation, value updating and so on. These factors cause your machine to perform less efficiently.

2. Increase machine specifications
As already said, applications and frameworks perform less efficiently when CPU is wasting its cycles for nothing. To overcome, you can upgrade your machine; CPU cycle frequency (Hz), RAM size (GB) and other similar things. If your service is hosted on a separate machine, then the network bandwidth size and so on.

But, after all. I would suggest 1. Efficient code way of overcoming this problem. Because second option would consume more resources, but still won't fix the problem. Writing efficient code would solve the problem at no cost; all using your logic and common sense.
 
Share this answer
 

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