Use Space BIFs to improve performance in Visual LANSA applications
|Date:||20 September 2001|
|Product/Release:||LANSA for Windows 9.0 and above|
|Abstract:||Performance improvements in Visual LANSA applications by using the SPACE BIFs|
|Submitted By:||LANSA Technical Support|
A simple maintenance form in a Client/Server application can often require a large number of records from the server to be loaded before it can be displayed.
For example, drop downs showing lists of products, users, regions, account codes, etc.
If the application only allows a single maintenance form to be displayed at a time, then you can load the data into the instance during the CreateInstance routine for the component, and then reuse it. In this situation, the first time will be slow, but after that, all of the data is memory resident, so performance is greatly improved.
Now consider a situation where the application allows multiple instances to be viewed simultaneously. Every time an instance of the maintenance form is loaded, the data has to be retrieved from the server. This is a very inefficient way of handling the load of the form, and can often lead to a delay in the form being displayed.
A very good way of getting round this issue is to store static data in the individual client PC's memory. This can be achieved very simply by using spaces. A space allows the developer to store file data in a global memory area. In concept, it is much like a working list. The major difference is that a working list is confined to the component/function in which it defined, where as a space is global, and therefore can be used by every component.
Spaces are controlled using the space BIFs:
CREATE_SPACE, FETCH_IN_SPACE, SELECT_IN_SPACE, SELECTNEXT_IN_SPACE, INSERT_IN_SPACE, UPDATE_IN_SPACE and DELETE_IN_SPACE.
These are documented in the LANSA BIFs guide.
As part of the application initialisation, load all static data into spaces (Products, users etc.). This is best done during the display of a splash screen. The overhead of starting the application greatly outweighs any delay opening individual items when running the application.
Once the data has been added to the space, it can be used to populate dropdowns, treeviews, lists etc, and can also be used for fetching descriptions for code values. This will also cut down the number of I/O operations that the server has to make.