Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a scalable ASP.NET MVC Web Application

I'm currently in the process of building an ASP.NET MVC web application in c#.

I want to make sure that this application is built so that it can scale out in the future without the need for major re-factoring.

I'm quite keen on using some sort of queue to post any writes to my database base to and have a process which polls that queue asynchronously to perform the update. Once this data has been posted back to the database the client then needs to be updated with the new information. The implication here being that the process to write the data back to the database could take a short while based on business rules executing on the server.

My question is what would be the best way to handle the update from the client\browser perspective.

I'm thinking along the lines of posting the data back to the server and adding it to the queue and immediately sending a response to the client then polling at some frequency to get the updated data. Any best practices or patterns on this would be appreciated.

Also in terms of reading data from the database would you suggest using any particular techniques or would reading straight from db be sufficient given my scenario.

Update Thought I'd post an update on this as it's been a while. We've actually ended up using Windows Azure but the solution is applicable to other platforms.

What we've ended up doing is using the Windows Azure Queue to post messages\commands to. This is a very quick process and returns immediately. We then have a worker role which processes these messages on another thread. This allows us to minimize any db writes\updates on the web role in theory allowing us to scale more easily.

We handle informing the user via emails or even silently depending on the type of data we are dealing with.

like image 479
gsobocinski Avatar asked May 27 '09 15:05

gsobocinski


People also ask

Is MVC good for scalability?

The challenges with MVC architecture are as follows: Scalability: As we still need to deploy the whole application as a single unit, MVC cannot guarantee scalability. As we cannot scale only the parts relating to performance, the application needs to be scaled as a whole.

How do you make an application scalable in C#?

To make a highly scalable system the caching should be a distributed caching which may span multiple servers. The cache data may grow from time to time but there should be an effective way to handle it. NCache/ Velocity/AppFabric are some of the good distributed caching tools options in a . NET large scale application.

Is ASP.NET scalable?

They can deploy highly scalable as well as high-performance web apps. Along with application monitoring and different other performance tools like a profiler, ASP.NET has turned out to be a powerful solution for creating incredible applications.


2 Answers

Not sure if this helps but why dont you have an auto refresh on the page every 30 seconds for example. This is sometimes how news feeds work on sports websites, saying the page will be updated every x minutes.

<meta http-equiv="refresh" content="120;url=index.aspx">
like image 144
David Avatar answered Nov 09 '22 23:11

David


Why not let the user manually poll the status of the request? This is how your typical e-commerce app is implemented. When you purchase something online, the order is submitted to a queue for fullfillment. After it's submitted, the user is presented with a "Thank you for your order" page and a link where they can check the status of the order. The user can visit the link anytime to check the status, no need for an auto-poll mechanism.

Is your scenario so different from this?

like image 33
DSO Avatar answered Nov 09 '22 23:11

DSO