How to improve response by distributing static content to remote edge servers
If the server hosting your PRPC application is distant from your users, you can improve performance by deploying static PRPC content to a cache on an “edge server,” a local computer closer to your users.
Once your application accesses these rules, the static content is cached on the server disk in the Static Content directory in the PRPC temporary directory. These cached files can be distributed to local servers for improved performance: subsequent calls for these rules are made to the local server instead of the main server hosting PRPC.
This article describes how to
- Identify and extract static content
- Deploy the static content data on another server
- Configure PRPC to use the deployed static content
Prerequisite: Your application must use the static JavaServer Page tag in HTML references. For details on using the static JSP tag, see the Developer Help.
Important: Consider the frequency of potential changes to static content. This process does not provide for automatic updates to cached content on the edge server; the process must be repeated to capture any changes to static content.
Note: For V5.X systems, See How to improve response by distributing static content to remote edge servers.
This process should be applied to each access group using the edge server.
Step 1: Identify and Extract Static Content
Use the following process for each application rule for which static content will be extracted:
- Identify the application rule.
- To trigger auto-generation of custom style sheets (CSS files), run all possible flows in the application. This manual process is required in PRPC versions 6.2 and later.
- Run the application.
- Click the Pega button () System > Tools > Extract Edge Server Files.
- On the Extract Edge Server files window, select the application and version.
- Enter a file name for the extracted content zip file.
- Click Create Zip File. The system displays progress, and when complete, an option to save the zip file locally.
Step 2: Deploy Static Content to the Edge Server
- Identify the host name, TCP/IP port, and URL path of the target edge server.
- Extract the contents of the zip file created in Step 1 to a directory on your edge (HTTP) server.
- Verify the extracted files can be read. You can enter a URL address into a web browser followed by the name of an extracted file. For example:
- hostname is the name or IP address of the edge server
- port is the port number of the HTTP (edge) server
- path is the directory where you placed the static content folders on the server
Step 3: Configure PRPC to Use Cached Static Content
PRPC provides a placeholder activity, Code-Security.ApplicationProfileSetup, which is called during user login. Modify this activity to direct the remote users’ systems to the edge server for static PRPC content.
The property pyEdgeServerURI identifies auto-generated static content references. This property is used at the Requestor level and must be set to the path of the edge server in the activity.
The remotely cached static files are valid only for users of the application specified in Step 2. Therefore the activity should be restricted to users whose access group references the application rule. Save the activity to a different RuleSet version, then add that RuleSet version to the application definition as a Production RuleSet, so it can be assigned only to the specified Access Group. (For details on Production RuleSets, see KB #25158, How Process Commander Assembles an Application RuleSet List.)
Modify Code-Security.ApplicationProfileSetup as follows:
- Create a new RuleSet and version separate from the existing application RuleSets.
- Copy the activity Code-Security.ApplicationProfileSetup to this new RuleSet Version. Do not change the name or Defined On class of this activity.
- Click the Pages & Classes tab.
- In the Page Name field, enter pxRequestor.
- In the Class field, enter Code-Pega-Requestor.
- On the Steps tab, delete the placeholder Java step.
- Use a Property-Set method to set property value pyEdgeServerURI on the pxRequestor page to the path of your edge server. Enclose the path value in quotation marks. Example:
- Save the activity.
- Add the RuleSet containing the modified ApplicationProfileSetup activity to the Application definition as a Production RuleSet.
- Add the RuleSet containing the modified ApplicationProfileSetup activity to the Access Group.
- Verify that the images and other static content are served from the edge server by testing your setup as described in the next section.
Test your setup
NOTE: Before testing your setup, clear the client browser cache. In Internet Explorer, click Tools > Internet Options. On the General tab, under Browsing History, click the Delete button. On the Delete Browsing History window, select the Temporary Internet files checkbox and click Delete.
- Clear your client browser cache.
- Log in in to Process Commander as a user associated with the appropriate Access Group.
- Using an HTTP debugging Web proxy server application such as Fiddler, verify that the static content is being served from the edge server.