Guide for building E3 applications operated via Web, in slow or high-latency networks.

This article discusses some important topics for improving performance in applications with some kind of network restriction (speed, latency, lateness, errors, etc.).

1) Avoid Synchronous Operations

Try to avoid all kinds of synchronous operations between the Viewer and the Server. Synchronous operations are all those operations that need a response from the other end to proceed with the normal process flow.

For example, consider Viewer scripts that retrieve the value of a server tag through the functions Application.GetObject or Application.GetValue. Until the value required by the function is finally retrieved (or until there is a timeout error, for example), the process flow will stall.

In such cases, you should move the scripts to another object in the server (internal tags, data objects, data libraries – XObjects, etc.), and then pass to the Viewer only the final value of process, via links.

Another kind of synchronous operation to be avoided happens in E3Chart, which has two possible ways of updating historical data: methods Queries.UpdateData and LoadData. LoadData method must only be used to print reports, because it is a synchronous operation, which means it will only go to the next line in script after all data from the query are at E3Chart, allowing the report to be printed only if the chart is complete.

To update queries on screen, use UpdateData method, because it will cause the chart to receive data as the query is being completed, which will allow the user to better browse between screens.

2) Use Asynchronous Operations

The asynchronous operations between the Viewer and the Server are those executed only on demand and happening in the background, with no explicit requisition from the application. A classic example is the links between objects. The value of a tag linked to a screen display, for example, will only generate communication the moment there is a change on the tag’s value in the server. Still, this operation will happen asynchronously, that is, in a separate process and on the background, which will incur neither in late processing for the Viewer nor in issues for the user (that is, screen browsing, value input, etc., will occur independently).


3) Avoid unnecessary traffic

Even when using links, try to avoid the traffic of unnecessary information. For example: how can you have a display on screen showing the current time? There are many ways to do the same thing, but the most common one is to create a demo tag inside a data folder in the server, set as type 3-CurrentTime, and link it to the display. However, the user will be able to choose the tag’s update period, in milliseconds. Therefore, a poor setting for this time can generate hundreds of communications per second for the Viewer. 

If the Viewer does not necessarily need to view the exact time of the server, you can create this time tag inside the Viewer itself, by right-clicking it over the Viewer object (in the Studio) and selecting the option Insert. This way, there will be no traffic from the Viewer to the Server.

Another example is the creation of “report”-like screens, which are used to fill the search intervals in databases, to set initial and final date intervals.  You can use the screen objects’ Value properties directly to store these values, instead of linking tags (which are in the server) to these objects. In the first method, there is no communication with the server, or there will only be when the query is taking place; in the second method, however, each operation with the objects will demand communication with the server.

4) Avoid using images

Whenever possible, try to use the drawing primitive tools of E3 instead of image files.  Image files, depending on the network, will take a long time to be downloaded; however, once they are copied to the Viewer’s machine, they will require only local process to be opened. In this case, there is also the issue of drawing performance, especially higher for the former objects.

If you really have to use image files though, always prefer compacted formats (.GIF, .JPG) to bitmaps (.BMP).

5) Queries to the Database

Queries to the database should be restricted whenever possible. Avoid especially unfiltered queries, because as the database grows, data will increase significantly, up to the point where its volume is unpractical for the network’s infrastructure, for the application, and for the database itself.

Also avoid queries that return the same data multiple times (for example, disable E3Browser’s automatic updates), and query data only when required by the user.

6) Use Libraries

Use E3 libraries for objects that occur multiple times in your application. There are many advantages for doing so, from smaller screens for download to better planning and maintenance of the system for the future.

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Deixe seu Comentário

Seu endereço de e-mail não será publicado. Campos marcados com asterisco são obrigatórios *