From 3abd4c16ea761591e4d4fc16dd56217914746bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 1 Dec 2022 11:54:11 +0300 Subject: [PATCH 1/3] "Optimizing Your Application for Production Environments" initial document --- docs/en/Deployment/Configuring-Production.md | 2 +- docs/en/Deployment/Index.md | 5 +++-- docs/en/Deployment/Optimizing-Production.md | 18 ++++++++++++++++++ docs/en/docs-nav.json | 4 ++++ 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 docs/en/Deployment/Optimizing-Production.md diff --git a/docs/en/Deployment/Configuring-Production.md b/docs/en/Deployment/Configuring-Production.md index 5efa5606213..b6d419dd960 100644 --- a/docs/en/Deployment/Configuring-Production.md +++ b/docs/en/Deployment/Configuring-Production.md @@ -1,4 +1,4 @@ -# Configuring for Production +# Configuring Your Application for Production Environments ABP Framework has a lot of options to configure and fine-tune its features. They are all explained in their own documents. Default values for these options are pretty well for most of the deployment environments. However, you may need to care about some options based on how you've structured your deployment environment. In this document, we will highlight these kind of options. So, it is highly recommended to read this document in order to not have unexpected behaviors in your system in production. diff --git a/docs/en/Deployment/Index.md b/docs/en/Deployment/Index.md index 852efa3d43f..1ca688ca0fb 100644 --- a/docs/en/Deployment/Index.md +++ b/docs/en/Deployment/Index.md @@ -6,5 +6,6 @@ However, there are some topics that you should care about when you are deploying ## Guides -* [Configuring for production](Configuring-Production.md): Notes for some important configurations for production environments. -* [Deploying to a clustered environment](Clustered-Environment.md): Explains how to configure your application when you want to run multiple instances of your application concurrently. +* [Configuring for Production](Configuring-Production.md): Notes for some essential configurations for production environments. +* [Optimization for Production](Optimizing-Production.md): Tips and suggestions for optimizing your application on production environments. +* [Deploying to a Clustered Environment](Clustered-Environment.md): Explains how to configure your application when you want to run multiple instances of your application concurrently. diff --git a/docs/en/Deployment/Optimizing-Production.md b/docs/en/Deployment/Optimizing-Production.md new file mode 100644 index 00000000000..7c9912cd67a --- /dev/null +++ b/docs/en/Deployment/Optimizing-Production.md @@ -0,0 +1,18 @@ +# Optimizing Your Application for Production Environments + +ABP Framework and the startup solution templates are configured well to get the maximum performance on production environments. However, there are still some points you need to pay attention to in order to optimize your system in production. In this document, we will mention some of these topics. + +## Caching Static Contents + +The following items are contents those can be cached in the client side (typically in the Browser) or in a CDN server: + +* **Static images** can always be cached. Here, you should be careful that if you change an image, use a different file name, or use a versioning query-string parameter, so the browser (or CDN) understands it is changed. +* **CSS and JavaScript files**. ABP's [bundling & minification](../UI/AspNetCore/Bundling-Minification.md) system always uses query-string versioning parameter and a hash value in the files names for CSS & JavaScript files for [MVC (Razor Pages)](../UI/AspNetCore/Overall.md) UI. So, you can safely cache these files in the client side or in a CDN server. +* **Application bundle files** of an [Angular UI](../UI/Angular/Quick-Start.md) application. +* **[Application Localization Endpoint](../API/Application-Localization.md)** can be cached per culture (it already has a `cultureName` query string parameter) if you don't use dynamic localization on the server-side. ABP Commercial's [Language Management](https://commercial.abp.io/modules/Volo.LanguageManagement) module provides dynamic localization. If you are using it, you can't cache that endpoint forever. However, you can still cache it for a while. Applying dynamic localization text changes to the application can delay for a few minutes, even for a few hours in a real life scenario. + +There may be more based on your solution structure and deployment environment, but these are the essential points you should consider to client-side cache in a production environment. + +## Bundling & Minification for MVC (Razor Pages) UI + +ABP's [bundling & minification](../UI/AspNetCore/Bundling-Minification.md) system automatically bundles, minifies and versions your CSS and JavaScript files in production environment. Normally, you don't need to do anything, if you haven't disabled it yourself in your application code. It is important to follow the [bundling & minification](../UI/AspNetCore/Bundling-Minification.md) document and truly use the system to get the maximum optimization. diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index d7cf2a5389b..0a01dd744c8 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -1306,6 +1306,10 @@ { "text": "Deploying to a Clustered Environment", "path": "Deployment/Clustered-Environment.md" + }, + { + "text": "Optimizing for Production", + "path": "Deployment/Optimizing-Production.md" } ] }, From 5a8b79741da5dd63b073c1a6caba766255683ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 1 Dec 2022 12:45:51 +0300 Subject: [PATCH 2/3] Added section: Background Jobs --- docs/en/Deployment/Optimizing-Production.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/en/Deployment/Optimizing-Production.md b/docs/en/Deployment/Optimizing-Production.md index 7c9912cd67a..596dbd41bbe 100644 --- a/docs/en/Deployment/Optimizing-Production.md +++ b/docs/en/Deployment/Optimizing-Production.md @@ -16,3 +16,7 @@ There may be more based on your solution structure and deployment environment, b ## Bundling & Minification for MVC (Razor Pages) UI ABP's [bundling & minification](../UI/AspNetCore/Bundling-Minification.md) system automatically bundles, minifies and versions your CSS and JavaScript files in production environment. Normally, you don't need to do anything, if you haven't disabled it yourself in your application code. It is important to follow the [bundling & minification](../UI/AspNetCore/Bundling-Minification.md) document and truly use the system to get the maximum optimization. + +## Background Jobs + +ABP's [Background Jobs](../Background-Jobs.md) system provides an abstraction with a basic implementation to enqueue works and execute them in a background thread. ABP's Default Background Job Manager may not be enough if you are adding too many jobs to the queue and want them to be executed in parallel by multiple servers with a high performance. If you need these, you should consider to configure a dedicated background job software, like [Hangfire](https://www.hangfire.io/). ABP has a pre-built [Hangfire integration](../Background-Jobs-Hangfire.md), so you can switch to Hangfire without changing your application code. From 862996127ab7606c67b5b75b534c4e1c75b246da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 1 Dec 2022 12:51:18 +0300 Subject: [PATCH 3/3] Logging section for Configuring-Production document --- docs/en/Deployment/Configuring-Production.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/en/Deployment/Configuring-Production.md b/docs/en/Deployment/Configuring-Production.md index b6d419dd960..db928c85900 100644 --- a/docs/en/Deployment/Configuring-Production.md +++ b/docs/en/Deployment/Configuring-Production.md @@ -91,6 +91,10 @@ Configure(options => Note that ABP CLI automatically sets the password to a random value on a new project creation. However, it is stored in the `appsettings.json` file and is generally added to your source control. It is suggested to use [User Secrets](https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets) or [Environment Variables](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration) to set that value. +## Logging + +ABP uses .NET's standard [Logging services](../Logging.md). So, it is compatible with any logging provider that works with .NET. ABP's startup solution templates come with [Serilog](https://serilog.net/) pre-installed and configured for you. It writes logs to file system and console with the initial configuration. File system is useful for development environment, but it is suggested you to use a different provider for your production environment, like Elasticsearch, database or any other provider that can properly work. + ## The Swagger UI ABP's startup solution templates come with [Swagger UI](https://swagger.io/) pre-installed. Swagger is a pretty standard and useful tool to discover and test your HTTP APIs on a built-in UI that is embedded into your application or service. It is typically used in development environment, but you may want to enable it on staging or production environments too.