Here are some ways to make websites hosted on Windows Server 2019 IIS run faster.
Optimize website code
Ensure that the website code is optimized and free of errors, which can slow down the website. Use tools such as performance profilers, code analyzers, and minifiers to improve code performance.
Use caching
Caching can significantly improve website performance by reducing the amount of data that needs to be transmitted between the server and the client. Configure caching in IIS using the Output Cache feature.
To configure caching in IIS using the Output Cache feature, you need to perform the following steps:
- Open IIS Manager: To open IIS Manager, click on the Windows button, type “inetmgr” in the search bar, and press Enter.
- Select the website: In IIS Manager, expand the tree on the left-hand side and select the website for which you want to configure caching.
- Open the Output Cache feature: Right-click on the website and select “Features View.” Then, click on “Output Cache” in the middle pane.
- Add an output cache rule: In the Output Cache feature, click on the “Add” button in the right-hand pane. Enter a name for the rule and select the type of content that you want to cache (such as “All Content”). You can also set the cache duration for the content, which determines how long the cached content will be used before it is refreshed.
- Save changes: Click on the “OK” button to save the changes and enable caching for the website.
Once you have configured caching in IIS, it will store frequently-requested content in memory, so that it can be served directly from the cache instead of being generated by the server each time it is requested. This can improve website performance by reducing the load on the server and improving page load times for the client.
Compress content
Compressing content can reduce the amount of data transmitted over the network, which can improve website performance. Configure compression in IIS using the Static and Dynamic Content Compression features.
To configure compression in IIS using the Static and Dynamic Content Compression features, you need to perform the following steps:
- Open IIS Manager: To open IIS Manager, click on the Windows button, type “inetmgr” in the search bar, and press Enter.
- Select the website: In IIS Manager, expand the tree on the left-hand side and select the website for which you want to configure compression.
- Open the Compression feature: Right-click on the website and select “Features View.” Then, click on “Compression” in the middle pane.
- Enable Static Content Compression: In the Compression feature, select the “Static Content Compression” option in the right-hand pane, and then click on the “Enable” button. This will compress all static content, such as HTML, CSS, and JavaScript files, when it is sent from the server to the client.
- Enable Dynamic Content Compression: In the Compression feature, select the “Dynamic Content Compression” option in the right-hand pane, and then click on the “Enable” button. This will compress dynamic content, such as the output of PHP or ASP.NET scripts, when it is sent from the server to the client.
- Save changes: Click on the “Apply” button in the right-hand pane to save the changes and enable compression for the website.
Once you have configured compression in IIS, it will reduce the size of the data that is sent from the server to the client, which can improve website performance by reducing page load times and bandwidth usage.
Use content delivery networks (CDNs)
CDNs can help distribute content closer to the end-user, which can reduce latency and improve website performance.
Minimize HTTP requests
Each HTTP request requires a round-trip between the server and the client, which can slow down the website. Minimize the number of HTTP requests by using techniques such as combining files, using sprites, and leveraging browser caching.
Enable Keep-Alive
Keep-Alive allows multiple HTTP requests to be sent over a single connection, which can improve website performance by reducing latency. Enable Keep-Alive in IIS using the HTTP Keep-Alive feature.
To enable Keep-Alive in IIS using the HTTP Keep-Alive feature, you need to perform the following steps:
- Open IIS Manager: To open IIS Manager, click on the Windows button, type “inetmgr” in the search bar, and press Enter.
- Select the website: In IIS Manager, expand the tree on the left-hand side and select the website for which you want to enable Keep-Alive.
- Open the HTTP Response Headers feature: Right-click on the website and select “Features View.” Then, click on “HTTP Response Headers” in the middle pane.
- Add the Keep-Alive header: In the HTTP Response Headers feature, click on the “Add” button in the right-hand pane. In the “Name” field, enter “Connection,” and in the “Value” field, enter “keep-alive.”
- Save changes: Click on the “OK” button to save the changes and enable Keep-Alive for the website.
Once you have enabled Keep-Alive in IIS, it will allow multiple HTTP requests to be sent over a single connection, which can improve website performance by reducing latency.
Upgrade hardware
Upgrading hardware such as adding more memory, disk space, or a faster CPU can improve website performance.