Take a load off your ORDS server and utilize Oracle's high-speed CDN to serve the APEX product static files for your instance. This has the dual effect of improving page load times and reducing the load on your ORDS server.
Using the Oracle CDN means you do not have to host Oracle APEX Static files on your ORDS Server. This makes APEX upgrades much faster.
Use the CDN for a Specific Application
Shared Components > User Interface Attributes > General > Static File Prefix
Note: When you set the CDN URL at the Application level, APEX will also look for 'Static Application Files' under this URL. In the example from the above screenshot, the substitution string #APP_FILES# will get changed to static.oracle.com/cdn/apex/21.2.4. If you want to reference custom JS, CSS, or Image files, you cannot store them under 'Static Application Files'. You will need to host custom static files in object storage, a file server, or your CDN and provide references to the complete URL for each file. In the below screenshot, the first reference will not work, and the second will work:
Use the CDN for your Entire APEX Instance
To configure APEX to use the CDN URL for your entire APEX instance, run the following script from a schema that has the APEX_ADMINISTRATOR_ROLE database role.
begin
apex_instance_admin.set_parameter(
p_parameter => 'IMAGE_PREFIX',
p_value => 'https://static.oracle.com/cdn/apex/22.1.0/');
commit;
end;
Use the following to verify:
SELECT apex_instance_admin.get_parameter('IMAGE_PREFIX') FROM dual;
Just in case, here is the code to set static files back:
-- On-Premise Instance.
begin
apex_instance_admin.set_parameter
(p_parameter => 'IMAGE_PREFIX',
p_value => '/i/' );
commit;
end;
-- Autonomous example for APEX 22.1
-- Note: The value can change after Oracle applies patch sets 22.1.0, 22.1.1, etc.
begin
apex_instance_admin.set_parameter
(p_parameter => 'IMAGE_PREFIX',
p_value => '/i/22.1.1/' );
commit;
end;
Note: When you set the CDN URL at the Instance level, APEX will not look for 'Static Application Files' under this URL. This means you can add custom JS, CSS, or Image files in 'Static Application Files' as usual. In the below screenshot, both references will work:
Remember!
- Whenever you upgrade or patch APEX, you need to check if the CDN URL has changed and update it for each application or instance as appropriate.
- In the unlikely event that your organization does not allow any outbound connections, then using an external CDN will not work for you.
Getting the Right CDN URL
As you can imagine, the CDN URL changes for each version of APEX and sometimes for each patch set bundle. You can get the correct URL for your version and patch set from the 'Known Issues' section of the APEX Download page for your version.
Example for APEX 21.2
Performance Test
I created a blank, public APEX page with no components on it. The page was developed on an OCI Autonomous Free Tier Instance. I then disabled the browser cache using Chrome Developer tools (see screenshot below). Disabling the cache ensured that all static files were fetched from the server for every page refresh. I refreshed the page 15 times using the Oracle APEX CDN and 15 times without the CDN. A total of 15 static files were fetched for each page load. I averaged the value of the 'Finish' value in Chrome Developer tools (see screenshot above).
The page loaded 11% faster on average using the CDN.
Credits
- Credit to the 'one and only' Joel Kallman's post announcing the availability of the Oracle APEX CDN.
- Credit to Jason Straub's Post on Running Customer Managed ORDS on Autonomous Database
🔗 Read More
- 🩳 APEX Shorts
- #️⃣ APEX Posts