User Interface | SmartSync | GenericSync | Persistence | Trace | General Programming Tips

 

Performance Recommendations - SmartSync

Recommendation

Description
Use SyncBoReplyObserver instead of registering to SyncBoInDeltaObserver. When using SyncBoInDeltaObserver instances, every inbound delta has to be instantiated as an Object that holds all fields as value objects. Therefore the data cannot be passed on to persistence layer in the faster stream-based mode.
A more performant solution to get conflict messages of the backend-processing of a SyncBoDelta is to setup a SyncBoReplyObserver for SyncReplyType.ERROR / SyncReplyType.CONFLICT / SyncReplyType.TECHNICAL.
Do not use untyped read.

An untyped read forces SmartSync to look in all relevant persistence tables for an entity with the specified key.

Example for an untyped read:

SyncBo.getRow(String);


SyncBoDataFacade.getSyncBo(String);
SyncBoDataFacade.getRow(String);

Performance improvement using RowDescriptor:

SyncBo.getRow(RowDescriptor,BigInteger);


SyncBoDataFacade.getSyncBo(SyncBoDescriptor, BigInteger);
SyncBoDataFacade.getRow(RowDescriptor, BigInteger);
SyncBo.getRow(RowDescriptor,String);
SyncBoDataFacade.getSyncBo(SyncBoDescriptor, String);
SyncBoDataFacade.getRow(RowDescriptor, String);
Use values > 18 digits only when absolutely necessary. Complex numeric values need more resources. The decision about the precision of the numeric values has to be done at the design time of the BAPI wrappers.
Use Row.modifyFieldValue(Object) instead of Row.setFieldValue().

Everytime the Row.setFieldValue() method is called, a full DB-update with transaction commit is performed.
To overcome this problem, the unlinked row has been introduce that needs less resources although the Row is cloned and various other precautions have to be taken.

Row.modifyFieldValue(Object) modifies a single field without causing a DB-operation. SyncBo.modifyRow(Row)finally makes the DB update for all changes.

For further information, please look at the coding example.

Use type specific methods to get field values.

The Row.getFieldValue(FieldDescriptor) / Row.getFieldValues() methods instantiate and return value Objects, according to the “old” mapping model, such as N>String, P>FixedDecimal and D,T>Calendar.
The persistence stores values according to the “new” mapping model, that is N>BigInteger, P>BigDecimal, D>Date, T>Time and therefore, a field value conversion is required.

Use the methods Row.getCharacterField(), Row.getDateField(), Row.getDecimalField(), Row.getNumericField(), Row.getTimeField() to get the field value.

Use SyncBoDataFacade.getRows(Query) / SyncBoDataFacade.getSyncBos(Query) before using SyncBoDataFacade.size(Query)

The SyncBoDataFacade.size(Query) method scans the entire database-table. This operation does not need so many resources as an query operation because no result set is created.
If however, a query operation has to be done anyway, it saves resoures when you invoke the query first and than call the size() method.
Avoid Query condition where possible

Queries are resource consuming. Check if different cases can really occur, based to the data definition in the backend. Try to convert user input strings to uppercase or lowercase and make one query.

Example - Query to find a part number:

The user input can be in upper or lower case or a mix of it. The application uses a query with AND to cover all possibilities.

Solution:

  1. The part number is a numeric value (characters between 0 and 9).
  2. The character case is defined by the backend. On many occasions, values will be handled in uppercase only.
Request only entries you want to display

Use the SmartSync API to get the entries you want to display (defined by starting index and number of entries), instead of getting all entries and iterating yourself. We recommend the following:

  1. Use JQuery API to select the entries required for display. Cache the keys to read the corresponding row on demand (for example, if you want to edit it).
  2. Use the result iterator to scroll forward. If you cannot avoid to store the list yourself, do not store the entire list.
  3. Execute a separate query using the COUNT (number of entries) operator.
Applications must handle synchronization at any time.

Synchronization is a framework-driven process. Synchronization will be started when a network connection is available, the user chooses the synchronization button and all transactions on the client are closed.. The application must handle a synchronization at any time.