WCF Service hosted on Web Server, gets CPU usage 100% very quickly RRS feed

  • Question

  • Hello,

    I have implemented one WCF Service, which is having one method to insert data into database as below.

    1. WCF Service Configuration
    2. <serviceBehaviors>
              <behavior name="WCFServiceBehavior">
                <serviceThrottling maxConcurrentCalls="128" maxConcurrentInstances="2147483647"/>
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
    3. WCF Service Runs concurrently ([ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)])
    4. Insert Data method - I am passing C# list as parameter to this method, and there are around 50,000 rows and 15 columns of data. I am using SQLBulkCopy insert method with Batch size of 100000 rows at a time.

    When we run this service, it blocks CPU by its 100% usage very quickly.

    What can be the reason behind this? Is this because of the List object I am using? Do I need to recycle or reuse it in someway ?

    Please suggest.

    Thank you,

    Friday, July 31, 2015 5:08 AM


  • May be you should be using MS SQL Server Service Broker, which can use the .NET Common Language Runtime. It means that you can create a .NET program that the MS SQL Server Service Broker can host.   It also means that you can consume a Service Broker just like you can consume a WCF service over the Internet or Intranet with security as needed.
    Friday, July 31, 2015 5:32 PM