c# - How to make batch remote calls to database or service? -


Hopefully some of you can give some indication on this.

I generate code, where I have to call telecommunication resources such as a web server or a database.

Consider this part of the code

  parents of the class {IEnumerable & lt; Child & gt; children; Int'sverwald () AsParallel Returns Children. Asperal () Note. Sum (C => C. Ramotkol ()); }} Child Child {Public Ink RemoteColl () {// Call Some WebSaver I want to pull these calls / without resting the rest of this code}}  

50 children For, this service is going to call 50, overhead 50 times. In my real life examples, this can easily be a million calls, it can crawl the whole thing.

I want to batch these calls in some way which is transparent for calling thread / work. Therefore instead of calling the service directly, it calls some central queue ('railway station') which batch these calls.

So when this happens, the calling task block then waits for the queue x call and then calls the telecommunication service with the list of requests.

When the result comes, this queue returns the return value for the correct job and unblock it. For the calling thread, it's all hidden and it looks just like a function call.

Can this be done? Are there archives in TPL which will allow me to do this?

It smells like a CCR in a straightforward manner, along with many things waiting to meet other things.

I can definitely rewrite this code to create a list of requests, call the parent category and then the service. The thing is that this code is generated with my real problem. That's why I have to see the child's implementation 'inside'. RemoteCall is making it all too complex, than it is already. Apart from this, the child can also be proxied for remote objects, etc. If everything is possible then it will be very difficult, I want to separate this complexity.

Hope this is understandable to anyone, if not tell me I am wide

You are extensively scratched on the surface of parallel programming. You need to think in one thing. You are starting 51 jobs, not 50 jobs that you need to batch. Additional work is that which manages 50 jobs. You need as per priorities requirement.

  JOBANTA X = GETJOBIID (); // Single Job AddJob (Jobblade X, ChildJob Y); // Job Container AddJobs (Jbendall X, ChildJobs Y); BusinessSyncExecute (Jbendall X); Waiter's salts (jbendall x);  

You need an engine in the background that defines blocked primitives (beyond those provided by an OS kernel) and to manage work threads and to manage jobs PLINQ technology, which looks at it, uses PLINQ also green thread which is good.

You mentioned that you will have a mix of databases and web-servers, so before the batch is executed, your job process / function needs to map the children to the right resources. Therefore, 50 children can be reduced to less batch-able RPC calls.

So you make your job batch and then you block it.

It would be difficult to be more accurate. But in the light of the discussion so please tell me how you have problems.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -