Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimize Performance or Attribute Routing and Routing table

I am working with Attribute Routing in asp.net mvc 4 web application. It is a single application that supports 15 different cultures and 20+ languages. The result of this, my routing table is extremely large, over 3000 routes. The main reason for so many routes is because the routes are localized per language. The follow on effect of this is that it results in a slow route lookup and in turn poor performance of the site.

I am looking at ways to improve performance. So looking for tips. Unfortunately I can't alter my routing structure due to business restrictions. The main reason I have so many routes is due to translations - there is an entry in the routing table for each language. Any way to avoid this?

Also, I note in the routing table, entries for POST methods - is this required? Can it be avoided to have entries in routing table for POST's?

Is there any form of caching that can be included to avoid routing table lookup and instead read from memory?

Any performance optimization tips of Attribute Routing or with routing in general would be excellent.

like image 294
amateur Avatar asked Nov 11 '22 05:11

amateur


1 Answers

This is a complicated question, as no one clearly knows how complicated your route table is and what business restrictions you are facing when re-organize your web application. So what I can do is prompting some options for you to explore:

  • Use "area" in your application. Area can be considered as standalone web application with its own route table. You can refer to this links: http://www.codeproject.com/Articles/714356/Areas-in-ASP-NET-MVC and https://msdn.microsoft.com/en-us/library/ee671793(v=vs.100).aspx
  • Use virtual directory in IIS to de-composite your web application. Similar to "area", virtual directory allows you to separate big application into several smaller ones and keep transparency to end users

The suggestions above can be based on locale or language. For example, when you visit www.apple.com, you can find their local website like Canada or Italy are set up like virtual directory "www.apple.com/ca" or "www.apple.com/it".

Hope this helps! Henry

like image 60
Henry Liang Avatar answered Nov 15 '22 07:11

Henry Liang