c# - Proper way to handle thousands of calls to external service from asp.net (mvc) -


I have been assigned to create a web application. I am currently using c # & amp; m; Asp.net (MVC - but I doubt about it related to this question) - I'm a cheat developer and purifies something new.

In the creation of the application, a part of the argument, smsgateway through killing a particular url with a request - either in the webpage (as part of the action initiated by a user in the message Something may happen) or as a part of the daily scheduling run (and several thousand messages can be sent). Regarding a daily work, I am afraid that looping - says - in a thread 10.000 times (especially if im also to take action based on the response of the request - like write a db ) Is not the best strategy and I can get some performance / repeated benefits from some parallelism.

Eventually I am afraid that at the same time thousands of users (very likely) will complete the task that triggers a check. For every request, any type of background thread (whatever is called), I am afraid of hundreds / thousands of requests once upon a time.

So if my beliefs are correct - how do I work with it? Do I have to manually generate any suitable number of new thread () and coordinate their work with a queue like a manufacturer / consumer, or is there any easy way?

Cheers

This means if you have to make 10,000 requests in a service That's the service's API null - maybe the CRUD-based, thin wrapper on a database rather than a real service.

For a well-designed service, a single "request" should provide all the information needed to "work together" each other - in other words, a lot of requests from 10,000 requests , Or at least one minor requests, this is especially important if requests are going on remote server or long to complete (and 2-3 seconds for a extremely Computing has a long time Awareness is).

If you do not have access to the service, if you do not have the capability to change the specification or API - then I think you will find it very difficult. A single machine can not handle 10,000 outgoing connections at once; It will also struggle with a few hundred. You can try to parallel it, but if you take ten times increase in throughput, even then it is going to take half an hour to complete, which is a type of work Which you probably do not want to run on a public-facing website (but then, maybe you do this, I do not know special).

Perhaps you can be more specific about the environment, architecture and what you are trying to do?


As a result of your updates (potentially thousands of users who take the same action at the same time, for which you will have to send one or two SMS messages for each):

It seems that the same scenario in which you should use. In fact, it is not really difficult to establish one. Why do some of the main reasons use a message queue:

  • There are a large number of messages to send;
  • Applications that send them wait for synchronous or any type of feedback;
  • Eventually messages will be delivered sure .

And Glove Your Needs Since you already are on the Microsoft Stack, I definitely recommend an asynchronous WCF service supported by MSMQ.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

c++ - QtQuick: QQmlApplicationEngine failed to load component qrc:/main.qml:23 Invalid attached object assignment -