Rocket Uniface User Forum

 View Only

Best practices: Uniface applications handling resources.

By Jan Cees Boogaard posted 09-13-2021 05:27

  

With this blog, we'd like to brush up on your knowledge about resources, a.k.a. runtime objects. Also, as we recently included some improvements in Uniface 10.3.02 patches 61 and 62, this is a great time to recap about how to get the best out of standardized deployment. Pay special attention to the ability to specify a plain network path in your assignment file, which is explained below.

This blog pertains to Uniface 10. and partly also to Uniface 9 using standardized deployment.

Resources

With the Uniface 10 IDE, the user defines development objects such as components, entities, application shells, global objects, and so on. The IDE compiles them into runtime objects, also known as resources. These resources are then ready for use by your Uniface applications.

Resource locations

Resource locations are the files and paths where Uniface applications search for the resources they need. A Uniface application specifies its resource locations in its assignment file, where they are listed in the [RESOURCES] section.

There are three kinds of resource locations:

  • Local resource locations
  • Remote resource locations
  • Plain network paths

Local resource locations
Local resources are either UAR files or resource directories that comply with Uniface's standardized directory structure. The resource locations are referenced by a file or directory path. For example:

  • ./my_resources.uar
  • ./resource_directory/

Remote resource locations
Remote resources are also either UAR files or directories in the standardized directory structure, The resource locations are also specified by a file or directory path, but it is prefixed by a network path (as defined in the [PATHS] section). Uniface accesses these remote resource locations over a client-server connection. For example:

  • $MY_PATH:res.uar
  • $MY_PATH:resdir/

Plain network paths

Remote resources can also be specified using plain network paths, introduced in Uniface 10.3.02.061. In this case, there is no need to specify individual UARs or directories. You only need to specify the path to a Uniface Server. For example:

  • $MY_REMOTE_RESOURCES:

The Uniface application delegates the search for resources to the specified server. The server searches for the resource in its own set of resource locations, which are specified in the server's assignment file.

This minimizes the number of network calls between client and server and improves performance.

Resource searching

When a Uniface application needs a resource, it searches for the resource in the first resource location specified in the [RESOURCES] section of its assignment file. If Uniface does not find the resource, it continues the search in subsequent resource locations, in the order specified in the [RESOURCES] section.

Uniface applications also use the usys:usys.asn assignment file, which by default specifies usys:usys.uar as a resource location. This means that by default, all Uniface applications use usys:usys.uar as their last resource location.

Fallback resources

For certain types of resources — the ones whose development objects are defined in libraries — if Uniface cannot find the requested resource in any of the resource locations, it goes through the same list of resource locations again, in search of a fallback resource. For example, if Uniface didn't find the French version of a message, it searches for the USA version of that message. This is described in detail in the Uniface documentation <<Link to online documentation for Deploying Applications > Application Resources > Searching Resource Locations > Search Order for Global Objects>>. Note: depending on the type of resource, there could be one, three, or even five possible fallback resources!

Performance of resource searching

There are some obvious ways in which you can influence the performance of resource searches:

  • First and foremost: keep the number of searches low.
    Take care that all resources your application needs are available where they are needed. That way, Uniface will not spend time searching for fallback resources.
  • Keep the number of resource locations low.
    The fewer resource locations, the fewer places Uniface has to look for the application's resources.
  • Reduce client-server communication.
    If possible, use resource locations that are local to the application.
    • If you do need a remote resource location, consider using a network share rather than using a client-server connection.
    • If you have several remote resource locations on the same server, consider a plain network path as a resource location. This way, the search is delegated to the server, thereby reducing the need for network requests for each remote resource location.
  • Use UARs rather than directories.
    • Uniface performance is better if you put your resources into UARs. Standard directories are meant for development purposes, it is advised to use UARs in deployed applications.
    • Note: if your network has stability issues and you do need remote resource locations, standard directories may provide better stability than UARs.
0 comments
6 views