Use ORDA to boost performance in Client/Server mode

Using ORDA to access large tables (especially those with relations) in Client/Server mode has been greatly enhanced. With 4D v17 R5, you’ll see 2-3xs improved LAN performance and up to 30xs faster WAN performance. And best of all – there’s no need to change anything in your code, it’s all automatic. Interesting, isn’t it? Well, let’s delve into the details.

Typically when loading a record in a client application, all of the record’s fields are transferred from the server. Even ones that you don’t need. Therefore performance depends on your application design, your database structure, and the network capabilities … especially when using large tables with multiple or large fields. For example on a slow WAN, using just a few fields in selection-based list boxes (of tables with dozens of fields having many relations/fields and large text/pictures), your application will soon be out of service.

ORDA requests previously used the same field loading principle … until now! With v17 R5, the server analyzes the attributes you need in each dataclass and identifies the related attributes so that only the requested data is transferred between the server and the client.

CASE STUDY

To illustrate these improvements, let’s use a simple database:

The Book table has 1,000 records. Its summary field contains anywhere from 100 to 2,000 characters and its thumbnail field contains around 10KB images. In the related Author table, the biography field contains 10,000 characters in each record.

Using this database, we created two selection-based list boxes: one using an ORDA entity selection and the other using a classic selection. In each list box, we’ve chosen to display the book’s title with its author in order to activate relations. We’ve also added an action to automatically scroll the list box so no human action can disturb the results: 

The measurements in the table below show the TCP frames that were transmitted between the server and the client (including all acknowledgment response) of the example in the video. The client’s network connection is Wi-Fi type “802.11ac” (250Mbps download, 100Mbps upload , with 1ms delay):

Mode Frames Overall size (bytes) Duration (ms)
Classic 4,070 473,924 5,747
ORDA 46 6,744 692

As you can see, using ORDA means only a few frames are transferred! And duration? The slower the network, the bigger the difference between ORDA and the classic approach.

A new concept: OPTIMIZATION context

This allows you to record what the system has learned, then reuse it later. To do this, you just need to create an option object containing a “context” attribute and then specify the desired value before setting the object as parameter:

If (Form.currentContext=Null)
    Form.currentContext:=New object("context";"contextListboxBookAndAuthor")
End if
Form.books:=ds.Book.all(Form.currentContext)

This option object can now be used with the Create entity selection command and the following member methods: dataClass.query(), entitySelection.query(), dataClass.fromCollection(), and dataClass.all().

N.B: In the measurements table, we haven’t activated the context feature to be as accurate as possible.

To conclude:

ORDA simplifies your developments:

  • It speeds up the transfer of information – with no code changes.
  • You don’t need to move large fields from a table and store them in a 1-1 related table to prevent impacts on Client/Server mode.
  • When you want to access the server outside the LAN, you can now connect the client directly … without using remote desktop technologies.

 

Avatar
• Product Owner •Damien Fuzeau has joined the 4D Product team in February 2019. As a Product Owner, he is in charge of writing user stories, then translating them to functional specifications. His job also entails making sure that the feature implementations delivered are meeting the customer needs.Damien is graduated from the University of Nantes in software engineering. He spent more than 23 years in its former company, first as developer (discovering 4D in 1997), and later as engineering manager and software architect. This company is a 4D OEM partner and deployed 4D based business softwares for thousands users, on hundreds servers. So, Damien is used to 4D development and deployment in a multi-language context.