OpenWGA 7.10 - OpenWGA Concepts and Features

Publishing » Special features

External file serving

If you are serving large media files via OpenWGA to a large number of users you run the risk that those requests block important system resources. If a large media file from an OpenWGA content store is served to a user this blocks a database connection as well as a J2EE server thread for a long time. Both are sparse resources and should be freed quickly to keep your site responsive. If a large number of them is occupied serving those long running requests this endangers the availability of your website for other users.

To prevent this situation OpenWGA contains a feature called "external file serving". Short described it delegates the large file serving task to a separate HTTP server. HTTP Servers like Apache have a much larger pool of worker threads that can do these tasks more efficient. Additionally those files will not be served directly from the database but from a file system cache. So after the cache is filled no database connections will need to be held while the file is served.

Prerequisites and things to consider

  • You need an HTTP server that publishes files from a directory which is reachable from the OpenWGA servers file system
  • The publishing directory must be on a Linux file system, like ReiserFS, Ext2-4
  • The external file serving will only be usable for
    • OpenWGA applications that allow anonymous read access
    • Files on content documents that are accessible anonymously i.e. are not read protected


First you need to configure some global settings for this feature:
  • Open the OpenWGA admin client in expert mode (checkbox to the top right)
  • Go to menu "Configuration" > "Basic settings" click action "Edit"
  • In section "Caches" click on "show/hide more options", find option "Enable external file serving" and select it
  • Three options will be added to the "Caches" section
    • Option "Enable external file serving" which should be checked
    • Option "Directory to store external file serving data" where you enter the file path of a directory that is published by your HTTP server
    • Option "RootURL for external file serving data" where you enter the URL under which the HTTP server offers the contents of the previously configured directory
  • By default external file serving will treat all files that are larger than 5 megabytes. If you think this setting should be something else you can add another option "Threshold (in KB) for files served by external HTTP task" and set it to the value that you want.

After saving this you need to enable the feature for individual OpenWGA applications

  • Edit the configuration for the OpenWGA application
  • On section "Publishing Settings" click "show/hide more options", find option "Enable external file serving" and select it
  • Check the newly added option
After saving this change external file serving will be active for the given application.

How it works

The external file serving cache is completely maintenance free, meaning that OpenWGA itself cares about it being up-to-date and serving valid content. What actually happens when someone requests a file while external file serving is activated is:

  • OpenWGA checks if the file is accessible anonously. If it is not it is served normally from database.
  • OpenWGA checks if the file is already written to the HTTP serving directory. If it is not or in an old version it serves the file normally from database. At the same time a task is started that will write the current file version to the HTTP serving directory.
  • If the file is available in the HTTP serving directory OpenWGA will redirect the users browsers to the URL under which the file is served by the HTTP server
If a file that was written to the HTTP serving directory is deleted in the database or is no longer available anonymously then it is picked up by a maintenance task running every 10 seconds and deleted from the directory. That way a file that goes unavailable will almost immediately be also unavailable on the external file serving cache.