?
Solved

WCF for Queue-ing processing intensive tasks

Posted on 2009-04-19
3
Medium Priority
?
1,199 Views
Last Modified: 2013-11-15
I am working with an ASP.NET site that must interact with a vendor's XML-based API using HTTP Request / Response pairs.  

There is a strong possibility that the site will perform poorly under a heavy traffic load due to the overhead involved in making 2 HTTPRequest calls for each user submission.

In order to deal with this problem, I would like to handle the requests asynchronously by queuing the requests and just displaying a message that says "Your request has been received.  You will receive an email when your account has been created in the database.  Thanks...".

I am struggling with the stateless-model of programming.   In a console application, I would create a separate Thread that processes Commands when the Count of the Queue is > 0.   Initial experiments using the Application object (and serialization) have failed.

After a lot of reading, I think that I may need to do this with WCF.   Can someone confirm that this situation is a good match for WCF and give me some direction as to which options I should select in order to do this in the simplest manner possible?

My service should only be callable by one aspx page - how does this affect the options I should select in creating the service?

Can a WCF application maintain the state of the queue?   Does this mean that I need to run it as a windows service?  Or can I still run it under IIS?

Some of my reading has made me wonder if I should use WCF with MSMQ.   Is this necessary?   I just need a basic command queue and I definitely don't want the client to have to install MSMQ to be able to use the app.

Would there be any advantage to creating this as a web service instead of a WCF app?

This is my first .NET application.   I am reading Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition and the O'Reily WCF book.   Any other links / resources would be appreciated.
0
Comment
Question by:trey_carroll
  • 2
3 Comments
 
LVL 25

Assisted Solution

by:apeter
apeter earned 400 total points
ID: 24181869
You can use web service and call its method asynchronous. Below is the URL which gives you more detail on how to create it. IIS is not going to be help up like synchronous call and hence you will be getting good performace. Please do load test after implementing Asynchronous way to see it gives expected performance.
http://msdn.microsoft.com/en-us/library/98t3s469(VS.80).aspx

If you lot of methods to expose as said above and if the requirement is going to change often like e.g. if you are going to access your method in HTTP or TCP in future . you can go for WCF.

You don't need to install MSMQ in the client side and it is going to queue in server so that u can read whenever you want and process them. You can use WIndows service to or you can use IIS also to host your service.
0
 

Accepted Solution

by:
trey_carroll earned 0 total points
ID: 24243832
The web service did not seem to offer a clear path to what I needed to do.   All of the mentions of maintaining state referred to the state of a particular user's session - not for an instance variable such as a queue that would have scope for multiple users' requests.  

The code examples that I did manage to locate for spawning separate threads from a web service were FAR inside of the realm of experts only - with much code that was hardly recognizable as C#.

The answer to the this problem for me turned out to be:

Install msmq.   Enqueue requests.   Create a Windows Service that runs on a timer to dequeue and process requests.  Use transactions to make sure that you don't lose any.

If you are attempting the same- a word of advice.   Create a separate console application that mirrors the code from the service for debugging purposes.   You cannot run the sevice code in the VS debugger and once you install and start it you lose communication with it.   The console "mirror" of the code will save you MUCH time and frustration.
0
 

Author Comment

by:trey_carroll
ID: 24253846
Found the Web Service would not work.   Posted alternative solution.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While Plesk offers many potential benefits to website administrators, including compatibility with Windows Server and other leading technologies, the company has also been working to differentiate it from other control panels for content management…
Tech giants such as Amazon and Google have sold Alexa and Echo to such an extent that they have become household names. And soon they are expected to be used by commoners in their homes, ordering takeout, picking out a song, answering trivia questio…
Viewers will learn how to use the Hootsuite Dashboard.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question