Some general tips for improving performance in N2-based websites
- Setting checkInstallationStatus="false" in the web.config will prevent all items being queried on application startup.
- Override the IsAuthorized method on your base Page/Part types AbstractPage and AbstractItem usually.
public override bool IsAuthorizedSystem.Security.Principal.IPrincipal user
This replaces the default N2 implementation of this method, which queries the database to find all permissions currently set for the current page.
NOTE: This is not an option if you use N2s permissions structure to secure your pages.
- Avoid using Find.Items.All, or using Find.Items.Where.Filters() without first narrowing down the result set with the other methods on this interface.
- The final option is to enable caching in the web.config. In the "database" section set caching="true"
This enables NHibernates 2nd level caching feature, and requires you to reference appropriate Caches DLL in your project or bin folder the default, NHibernate.Caches.SysCache2 should be included in the lib folder of the default N2 installation