KB Article T381322
Visible to All Users

Security - How to reduce the number of permission requests and improve overall performance

There are solutions that apply to any security type and those that can be used only for the Middle Tier application server. For more convenience, I marked simple solutions with the * symbol.

COMMON SOLUTIONS
1. Enable Server, InstantFeedback or DataView data access modes for ListViews with large amounts of data
This is not specific to the security module. Refer to the List View Data Access Modes article for more information.
2. Enable Security Permission Caching
Refer to the Security Permissions Caching article for more information.
3. Consider caching at the data store level
This may be suitable if you have many repetitive queries and the SQL server executes them slowly. See the How to use XPO caching in XAF article for more information.
4. Determine the cause of low performance and measure its effect in numbers with specialized profilers
Always profile your applications as described in the How to improve the application's performance article.
Often, you can improve the situation by modifying your custom code. For instance, you can reduce the number of SQL queries by following suggestions from points #5-7 of the aforementioned KB article.

MIDDLE TIER APPLICATION SERVER SOLUTIONS
1. Use the new and faster Middle Tier security implementation
If you are using .NET Core, migrate to v24.1+. XAF WinForms with Middle Tier Security execute much faster in v24.1. We boosted performance for both EF Core 8 and XPO ORM, as compared to v23.2 (XPO ORM results are even better - a 2.5x improvement). The graphs below show the current duration of batch of performance tests and also individual tests in 24.1 vs v23.2 for EF Core 8.
Clipboard-File-1.png

If you are using .NET Framework, refer to the migration guidelines for more information. If possible, consider migrating to .NET Core-based Middle Tier Security.

2. Adjust the data transport channel between the Middle Tier application server and client apps
- Consider using NetTcpBinding in your project. With v16.2, XAF Solution Wizard creates new projects with NetTcpBinding by default. According to the Microsoft documentation: "The Net.Tcp binding is the best performing binding type for two-way communications between different servers. One drawback is that it is not interoperable with non-WCF clients".

3. Tune a database's or an application server's response latency
In the case of long remote server response time, find the nature of this delay (client <=> service or service <=> database). Based on the results, consider moving an application's service to another server, for instance, closer to clients' applications or a database.

4. Use Client-Side Security (Integrated Mode) for ASP.NET applications
The Integrated Mode can remove unnecessary network overhead and thus improve overall application performance. The Middle Tier security does not make sense for an ASP.NET application from the logical, maintenance and performance point of view. These applications are client-server by default.

Show previous comments (3)
Dennis Garavsky (DevExpress) 8 years ago

    @Steve: Thanks for sharing your experience with the XAF community! BTW, this caching feature is enabled in new XAF v16.1+ projects by default.

      Hello,

      When i create the public static System.ServiceModel.Channels.Binding CreateDefaultBinding() { NetTcpBinding binding = new NetTcpBinding();How can i use this binding when using the code below ?

      public class CustomObjectSpaceProvider : SecuredObjectSpaceProvider

      protected override IDataLayer CreateDataLayer(IDataStore workingDataStore)
                  {
                      var node = workingDataStore as DataCacheNode;
                      if (node == null) return new ThreadSafeDataLayer(XPDictionary, workingDataStore);
                      if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["TotalMemoryPurgeThreshold"]))
                      {
                          node.TotalMemoryPurgeThreshold = Convert.ToInt64(ConfigurationManager.AppSettings["TotalMemoryPurgeThreshold"]);
                      }
                      return new ThreadSafeDataLayer(XPDictionary, node);
                  }

      Dennis Garavsky (DevExpress) 7 years ago

        @Decoder4: I've created a separate ticket on your behalf (T553861: Questions on configuring end point bindings when using the security system with a data store level cache). It has been placed in our processing queue and will be answered shortly.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.