Optimize the Loading of Validating Data: Getting Started
Optimize the Loading of Validating Data: Getting Started
When editing data in the Smart Client grid using validating tables, you select values from an edit form for a validated field. Some sites have large validating tables (for example, 90,000 departments) and slower network speeds. In these cases, when you load a table into the Smart Client grid, and click on a cell in a validated column for the first time while that table is open, loading the data produces a noticeable delay. The delay does not occur for the rest of the view’s lifetime. However, if you close and reopen the view, you will see the delay again the first time you use that same validating selection list.
For those sites with large validating tables and slow networks, the Smart Client includes an optional caching feature that creates a local cache of the data in a similar way that a Web browser caches Web pages and images. This option enables per-view caching by allowing the configuration of a local, cross-view and cross-session cache of the data. In this way, the Smart Client can load validating data shown in the edit form more quickly:
- Time to load 40,000 records from server: 16 seconds (one time, regardless of caching)
When caching is enabled:
- Time to load 40,000 records from cache: < 1 second
- Time to load 90,000 records from cache: 1.5 seconds
Caching is enabled for your installation only if you define the activity parameter for caching with a semi-colon separated list of the names of the tables you want cached. See Enabling Caching.
Note the following about caching of validating tables:
- Virtual Private Archibus (VPA). The caching feature uses a server-side record set which obeys the VPA restriction, even on non-visible fields.
- Rooms table. You can cache the Rooms table; however, doing so is typically not necessary. Sites with a large number of rooms often use VPA to divide the rooms by site or campus. Typically, validation lists within a campus - 50,000 records or less - are not a problem.
- Validation accuracy: There is no need to be concerned about the accuracy of validation, regardless of the state of the local cache. If you select an old value that is no longer valid, the program will not accept the old value, and will ask you to correct it.
- Smart Client Extension for AutoCAD. The Smart Client Extension for AutoCAD uses the same cache as the Smart Client. Changes made in the Smart Client propagate to the Extension and vice versa.
- Speed of refresh. Even with daily changes, changes typically occur on only a fraction of the database, so you are unlikely to need a changed record before the background process refreshes the data transparently. In the unlikely event this does occur, you get a message, and can click the Refresh button to get the recent validation changes. See Refreshing Data.
- Security. The application stores the cached data in the user's application folder, for example, on your computer:
C:\Users\[your name}\AppData\Local\Archibus\SmartClient\xx
Each user sees in their cache only the records they have permission to view. These files are protected by the operating system login. The cache is written per Windows user. When multiple users log in to the same workstation, each user will have separate caches, even if they sign in to Smart Client with the same Archibus user account.
Validating codes are rarely sensitive data, but if you are concerned about replication of any data, you might not want to use the caching feature. If you turn off the caching feature, you will want to delete these caching files.
-
Caching is optional. Caching is an optional tuning feature that is part of system configuration, and is controlled at the server level. An installation does not use any caching when the activity parameter is not defined with a semi-colon separated list of table names. Furthermore, an installation does not need to use caching if any combination of the following apply:
-
The validating tables are relatively small (on the order of one or two thousand records);
-
The validating tables change very frequently (many times during the day); and
-
The network is fast or their server is local.
-
How caching works
When caching is active on a particular set of validating tables, the Smart Client program does the following.
- On sign-in, runs a background process that updates the cache for validating tables if they are even a day out-of-date. The process gets the list of cacheable tables from the activity parameter, and refreshes the client-side cache files so that they hold a mirror image of the server data. This is done for tables that were not written today. This automatically refreshes all values without your needing to take any action, and ensures that tables are not out-of-date by more than a day.
- Caches validating table data into memory the first time you use the validated values editor. This in-memory version of the data is maintained until you sign out of the session.
- Retriggers the background update process whenever you use a validated values editor within the grid, and the grid notices that the number of records for that table has changed. This update is for that one table. This process happens in the background, so that you can continue editing while the process runs.
- Displays the Refresh button for the validated values editor to indicate the refresh state of the validated field. See Refreshing Data.
How errors are prevented
The program will build the caches when needed, and will never save a bad value to the server, even if the local cache is momentarily out-of-date. If you happen to enter a particular validated value into a grid row on the client just after that value has been removed from the server, you are unable to save the record, and an explanatory message displays. The notification message tells which column is incorrect, so you know to use the Refresh button to synch the editor and select a current value. Conversely, when a value has been added to the server, it will be missing from a cached validated values editor. In this case also, pressing the "Refresh" button on the validated values editor regenerates the cache from the server, and data is synchronized between the server and the client cache. enabling you to make the correct selections.
Refresh data
When working from the validated values edit form, if caching has been enabled for the validating table, the form has a Refresh button that appears in the status bar to the right of the record count, just below the table's scroll bar. When the table for the column being edited is not a table being cached, the Refresh button is absent from the editor.
The following shows a validating data editor with a blue Refresh button:
The Refresh button can indicate different refresh states. The refresh state is based on the comparison of the record count on the server and on the client. This comparison happens whenever you open a validating values editor for a cacheable table. The refresh states are as follows:
Refresh Button | Description |
---|---|
Hourglass | The hourglass indicates that the cache is in the process of being updated, typically when the editor finds a difference between the server and client record counts, and initiates a cache refresh. While the button is an hourglass, editing can continue so that if the desired data is available it can be used in the current cell editing without any interruption. However, the Refresh button is, in effect, disabled until the update is completed. Once completed, the visible table is not changed to avoid disturbing any editing being done. However, the Refresh button changes to its green arrow state to indicate the discrepancy in the record count between the client and the server. In this case, you can click the Refresh button to update the editor from the local cache |
Green arrow | Indicates that the record count on the server doesn't match the editor's count. |
Blue arrow | Indicates that the record count on the server matches the record count in the editor (that is, it matches the record count in the cached table). |
When the Refresh button shows either the blue or green arrow, a click on the button refreshes the cache and displays the new data in the editor.
Both the blue and green arrow conditions are based solely on record count because it would be too intrusive to compare the actual values of the large data sets on the server and client. In the rare event that values for records have been changed with no deletions or additions of records, or if the number of records deleted is equal to the number of records added, the Refresh button will be a blue arrow with no indication of this difference. However, if you unknowingly use an out-of-synch value in a record, you get a notification when you try to save the record. The notification message tells which column is incorrect. This is an indication that you should use the Refresh button to synch the editor for that column . You are then able to select a current value.
Enable caching
To enable the caching feature:
- From the Smart Client Navigator, select, System / Archibus Administrator - Application Configuration / Configure Application Parameters.
- From the Applications pane, select
AbSystemAdministration
. - From the Application Parameters pane, select
ClientCacheableValidatingTables
. If this does not exist, you can use Add New to create a record. Complete the Parameter Code field withClientCacheableValidatingTables
. - In the Edit Application Parameters pane, in the Parameter Value field, enter the table names separating the names with a semicolon. For example, to apply caching to the Buildings, Floors, Division, and Department tables, enter:
"bl;fl;dv;dp"
- Click Save.
- Restart the server to have caching take effect for all Smart Client users.