Modifying the hosts file to improve performance for certain environments
KB001678
PRODUCT
Introduction
When installing K2 blackpearl and K2 smartforms for a scalable, high-performance environment, K2 recommends that the K2 smartforms runtime and design time websites should be co-located on the same physical server as the K2 blackpearl Server. This recommendation and environment is further described in the Supported Topology: Large Scale for Optimal Performance topic of the blackpearl installation and configuration documentation.
In addition to installing the SmartForms websites and the K2 blackpearl server on the same server, additional configuration is recommended to further improve performance. This configuration change will reduce the amount of network traffic and round-trips that may occur in a Network Load Balanced (NLB) environment.
![]() | The recommended hosts file change will force all communication between the SmartForms website and the K2 Service to remain local to the same server. Requests will be sent to the local server instead of to the load balancer, which means that the failover functionality provided by NLB is bypassed. Given the rapid life cycle of requests, this might not be an issue but consider this behavior against your requirements carefully before making the hosts file changes recommended in this article. |
![]() | The recommended hosts file change should only be applied in environments where the SmartForms websites and the K2 server are co-located on the same physical machine, as recommended in Supported Topology: Large Scale for Optimal Performance. Applying these changes in a differently-installed environment may impact the operation of those environments. |
Understanding the recommended change
To understand the recommended change, consider the example request path for a SmartForm that retrieves the current user’s K2 worklist, with and without the recommended hosts file modification:
Without hosts file modification:
The request to retrieve the worklist traverses as follows:
Client Machine > (LoadBalancer) > SmartForms Runtime Site > (LoadBalancer) > K2Server > (LoadBalancer) > SmartObjectServer > (LoadBalancer) > WorklistServer
With hosts file modification:
The request to retrieve the worklist traverses as follows:
Client Machine > (LoadBalancer) > SmartForms Runtime Site > K2Server (local) > SmartObjectServer (local) > WorklistServer (local)
As you can see from the examples above, implementing the hosts file change removes several calls to the LoadBalancer that are made to resolve and connect to a K2 server. Since the K2 server component is installed on the same physical machine as the SmartForms website and the request life-cycle is relatively short, we can force all the communication for this request to remain local on the machine and therefore improve performance by removing the additional calls to the NLB.
Implementing the recommended change
Perform the following steps to modify your system’s hosts file on each server where the SmartForms websites and K2 server are installed on the same physical machine:
![]() | Modifying system files should only be performed by users who understand the impact of the changes being made. |
- Navigate to the directory hC:WindowsSystem32driversetc]
- Make a backup of the hosts file and store the backup in another directory
- Edit the hosts file shown below with Notepad. (You may need to run notepad as administrator for environments where UAC is enabled.)
- Add 127.0.0.1 and your NLB ClusterName to the file and save changes. In this sample, we are forcing all requests to K2Cluster.domain.local to go to the standard local IP address: 127.0.0.1
- Save your changes. (If you cannot save the modified hosts file after modifying it, save a copy of the file to the desktop and then to windows explorer to copy the modified file to the eC:WindowsSystem32driversetc] directory and overwrite the existing hosts file)
- Open a command prompt and issue an
ipconfig /flushdns
command to clear out the DNS cache on the local machine - Open a command prompt and issue a
ping <NLB ClusterName]
command. You should see that the ping request resolves to the local machine’s IP address. - Remember to repeat these steps on each physical server where the SmartForms websites are co-located with the K2 blackpearl server.
Additional Information
For more information on modifying the HOSTS file see
http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file
http://technet.microsoft.com/en-us/library/ff807405%28v=ws.10%29.aspx