Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8731207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:10:49+00:00 2026-06-13T09:10:49+00:00

I work on a multi-tier application and I need to optimize a long-running process

  • 0

I work on a multi-tier application and I need to optimize a long-running process in three ways :

  1. Avoiding EF update concurrency problems.
  2. Improving speed.
  3. Informing the user of the progress.

Actually, the client code calls a WCF service using a method that does all the work (evaluating the number of entities to update, querying the entities to update, updating them and finally, saving them back to the database).

The process is very long and nothing is sent back to the user except the final result once the process is done. The user can stay in front of the wait form for up to 10 minutes, not knowing what is happening.

The number, and depth of the queried entities can become really big and I sometimes hit OutOfMemoryExceptions. I had to change the service method to process entity updates 100 entities at a time, so my DbContext will be refreshed often and won’t become too big.

My actual problem is that I cannot inform the user each time an entity is updated because my service method does the whole process before returning it’s result to the user.

I read about implementing a duplex service but since I have to return two different callbacks to the user (one callback to return the number of entities to update and another callback for the result of each entity update) I have to use multiple interface inheritance on a generic callback interface and it’s becoming a little messy (well, to my taste).

Wouldn’t it be better to have one WCF service method to return the number of entities to evaluate, and another WCF method that will return a simple entity update result, which will be hit for every entity to update ? My DBContext will be living only for the time of a single entity update, so it would not grow very much, which I think is good. However, I am concerned about hitting the WCF service really often during that process.

What are you thoughts ? What can you suggest ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:10:53+00:00Added an answer on June 13, 2026 at 9:10 am

    Have you thought about adding a WCF host to your client? That way you get full two way comms.

    Client connects to server and gives server connection details back to client
    Client request long running operation to begin
    Server sends multiple updates to the clients WCF host as work progresses.
    Server sends work complete to client.

    This leaves your client free to do other things, consuming the messages from the server as you see fit. Maybe updating a status area as messages come in.

    You could even get the server to maintain a list of clients and send updates to them all.

    ——–EDIT———
    When I say WCF host I mean a ServiceHost
    It can be created automatically from your XML in App.config or though code directly.

    var myUri = new Uri[0];
    myUri[0] = new Uri("net.tcp://localhost:4000");
    var someService = new SomeService(); //implements ISomeService interface
    var host = new ServiceHost(someService, myUri);
    var binding = new NetTcpBinding(); // need to configure this
    host.AddServiceEndpoint(typeof(ISomeService), binding, "");
    host.Open();
    

    Proxy is a term I use for what a client uses to connect to the server, it was in an early example I came across and its stuck with me since. Again can be created both ways.

    var binding = new NetTcpBinding(); // need to configure this
    var endpointAddress = new EndpointAddress("net.tcp://localhost:4000");
    var factory = new ChannelFactory<ISomeService>(binding, endpointAddress);
    var proxy = factory.CreateChannel();
    proxy.DoSomeWork();
    

    So in a typical client/server app you have

    CLIENT APP 1       SERVER APP         CLIENT APP 2
    proxy------------->ServiceHost<-------proxy
    

    What I am suggesting is that you can make the client be a “server” too

    CLIENT APP 1       SERVER APP         CLIENT APP 2
    proxy------------->ServiceHostA<------proxy
    ServiceHostB<------proxy1
                       proxy2------------>ServiceHostB
    

    If you do that, you can still split your large task into smaller ones if needed (you mentioned memory issues), but from the sounds of things they still might take some time and this way progress updates can still be sent back to the client or even all clients if you want everyone to be aware of whats happening. No callbacks needed, though you can still use them if you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a large, multi-page, PHP web application for work where a
I am building a multi-tier application that will have multiple smaller apps apart from
I am writing a multi threaded application and I am also trying to work
I am trying to work with a multi-dimensional array in MSVS2010 console application, and
It's the first time I work on a multi-threads application with Delphi so all
We have a typical multi-tier/layer architecture. Application + WCF Service + Repository/EF4/Database. We are
Recently I have started work on a multi-threaded console based application using VB.Net and
I have done little work in multi-threaded environments. So, I need to know whether
Currently i am in a process of developing a application which can work in
I'm building an application that is multi-lingual, multi-timezoned and n-tier. All dates are stored

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.