Quantcast
Channel: XAF Team Blog
Viewing all articles
Browse latest Browse all 148

Deploy and scale an XAF Blazor Server app: use Azure Kubernetes Service to serve hundreds of users

$
0
0

Overview

We published a GitHub example that shows how to deploy an XAF Blazor application to a Kubernetes cluster with horizontal autoscaling. We tested the application in two types of clusters: locally-run K3s and Azure Kubernetes Service (AKS). The maximum pod replica number (20) allowed around 300 concurrent users. An AKS cluster needs two nodes (B4ms machines: 4 Cores, 16 GB RAM) to operate with such a number of pod replicas and the same load.

This repository contains the following useful resources:

  • Dockerfile that helps you publish an app to a Linux container, and a version for a Windows container (Dockerfile.win)
  • *.yaml files that help you deploy an app to a Kubernetes cluster with a Microsoft SQL Server database engine container, Horizontal Pod Autoscaler, and Ingress
  • A prebuilt Docker image with Linux, .NET 6 SDK, ASP.NET Core (https://hub.docker.com/r/devexpress/xaf-container-example)

The following diagram illustrates the cluster architecture:


Motivation Behind This Example

The main reasons include the following:

  1. Though deployment is not specific to DevExpress code (XAF Blazor), we often receive general questions such as "Can I containerize my XAF Blazor app?" or "Can I deploy XAF Blazor to Kubernetes?", or "I deployed to Docker/Kubernetes/Azure/Ubuntu/Whatever, but it did not work: does XAF Blazor support this?!" In short, an XAF Blazor app is a standard ASP.NET Core Blazor Server app, and you can do anything Microsoft ASP.NET Core Blazor Server can handle (refer to Microsoft Docs | Deployment Recommendations for XAF Blazor UI). I hope our working example will address all related questions in the future.
  2. It is not secret that XAF Web apps were not designed for high-load scenarios where a single web server handles hundreds or thousands of concurrent web clients. XAF Web apps are stateful and are mostly used in a local Intranet with a limited set of users (often deployed internally). This notwithstanding, we wanted to demonstrate how to configure your deployment environment to handle additional users with multiple web servers.

Will your own XAF Blazor app work with 100, 200, 300, or more concurrent users with similar performance, provided the hardware/software are the same?It depends - our example is not an official guarantee by any means. In brief, every application is unique. Even with horizontal scaling, we recommend that you carefully:

We cannot provide a universal calculator for web server hardware/software requirements, nor can we comment on overall performance without tests. The complexity of your business model and implemented behaviors are significant factors in throughput/performance. Ultimately, performance will depend on development decisions, application type, environment, and even tested use-case scenarios. A few examples of factors that affect application performance are the number of persistent classes and their fields, Controller design, Application Model customizations, availability of memory intensive operations to end-users (frequent import/export of large data amounts, or complex report generation).

Different Ways XAF Customers Deploy Web Apps

The feedback below (from XAF customers) helps illustrate how our customers have deployed apps to Docker, Google Cloud Platform, virtual machines on Azure, Amazon Web Services, or on premises with Windows/Linux. Again, kudos to Microsoft ASP.NET Core for making this possible.

Pongpaitoon Suksudej

Just want to confirm that yesterday I deployed the xaf blazor application to native cloud successfully. It runs in linux containers and orchestrated by gcp cloud run. As a result, it scales out automatically once a container has reached a usage threshold. it also terminates the unused containers to save cost as well. using xaf blazor with linux container with autoscale is not a dream but reality.

Achmad Mulyadi

I've been working on horizontal scaling for XAF deployed on Linux server and it works extremely well. I recommend you to deploy it on containerized environment for easy deployment and scaling. If you don't need to auto scale your application, a load balancer such as NGINX in front of your containers is more than sufficient to do the task. Of course auto scaling options are available, you may need to see the possibility of using Kubernetes or Docker Swarm. Or you might want to try to deploy it on cloud such as azure or AWS. I myself has deployed an XAF ERP application on AWS and only need few clicks to deploy and configure the auto scaling using AWS Toolkit for Visual Studio.

Roman Shelomanov

We use WEB XAF in SAAS about 200 concurent users + tablets users + some integration. Single app pool, about 5 GB for IIS memory. With own WEB UI HTML 5 client implementation that minimize server load and looks quick.

New to XAF?

Check out this recent intro video and other XAF-related videos/tutorials here: Getting Started.

Your Feedback Matters!

We look forward to your feedback on our Kubernetes and load-testing examples (please post your feedback on the DevExpress Support Center). Specifically, we’d love to know how these examples address your XAF project requirements. Your feedback will help us improve XAF and its learning materials for popular usage scenarios. Thank you.

NOTE: DevExpress does not assist in administering web servers or hosting environments for customers. We do not consult on various server and operating system configurations as part of our support services. For more information, please review the "Prerequisites" and "Technical Support Scope" sections. If you experience issues, we recommend that you first make sure that your deployment scenario works without XAF. Try a pure Blazor Server app (with the same database and XPO or EF Core for data access). Once you resolve issues with that application, an XAF Blazor app should work as expected.

Viewing all articles
Browse latest Browse all 148

Trending Articles