ContentsIndexHome
PreviousUpNext
Optimizing performance

Assigned data is buffered and sent to AIMMS in packets consisting of multiple tuple-value pairs. Although the SDK guarantees data consistency in almost every case, the performance of your application may benefit from an informed use of the IMultiDimData.sync, IDataView.flush and ISession.updateData methods.

Modifications are buffered

By default, the SDK buffers modifications to sets and multidimensional data. The SDK implicitly flushes such buffers, when

  • a maximum buffer size is reached,
  • a kind of IData object with pending modifications is closed,
  • you make a call to a procedure within your model, or
  • references to AIMMS data in your client application depend on modified data not yet being flushed.

Such flushes will either be performed asynchronously (in the background, first two scenarios) or synchronously. You can specifically request an asynchronous flush by calling the IDataView.flush method. Whether or not explicitly flushing the modification buffers will improve the total throughput is very application-specific.

Data consistency

The SDK guarantees that in most cases all reads are up-to-date: the cardinality will include all inserts and deletes; an iterator created or reset after an insert will show the correct value for the modified tuple; the newly added labels in a set are directly available to all data referring to this set. 

However, the SDK cannot correctly take into account changes to identifier domains referring to sets/parameters, for which the SDK still is buffering modifications. Such changes can be either direct, but also indirect when the buffered modifications influence a defined parameter used in the domain condition at hand. To make sure that the SDK incorporates changes to index domains, you can call the IMultiDimData.sync method for all modified identifiers that influence the index domain. 

Iterators are invalidated when their corresponding identifiers are modified directly. Iterators corresponding to identifiers that are defined in your model in terms of other identifiers modified through the SDK may invalidate when new data is retrieved from the AIMMS session. For these reasons, the use of iterators is not recommended while concurrently modifying data through the SDK.

Separate assignment of sets and parameters

If data is assigned to a parameter, the index domains are needed to validate the tuples being offered. If there are pending modifications on these domain sets, the buffered modifications to these sets are used directly instead of synchronizing these changes with AIMMS prior to this validation process. As using the buffered modifications does involve a small overhead, it is recommended, for very large data transfers, to force sets to be updated prior to initiating the data transfer. You can use the ISession.updateData method to flush all pending modifications, and rebuild any cached data on the client side. The use of this method is demonstrated in the performance example.