Skip to content

Commit

Permalink
Presentation: Enable an option for presentation backend to use memory…
Browse files Browse the repository at this point in the history
… mapped i/o for worker SQLite connections (#690)
  • Loading branch information
grigasp authored Feb 1, 2021
1 parent b3fc3c6 commit 83e76fd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export interface DefaultNativePlatformProps {
isChangeTrackingEnabled: boolean;
cacheConfig?: IModelJsNative.ECPresentationHierarchyCacheConfig;
contentCacheSize?: number;
useMmap?: boolean | number;
}

/** @internal */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,16 @@ export interface PresentationManagerProps {
/** @alpha */
contentCacheSize?: number;

/**
* Use [SQLite's Memory-Mapped I/O](https://sqlite.org/mmap.html) for worker connections. This mode improves performance of handling
* requests with high I/O intensity, e.g. filtering large tables on non-indexed columns. No downsides have been noticed.
*
* Set to a falsy value to turn off. `true` for memory-mapping the whole iModel. Number value for memory-mapping the specified amount of bytes.
*
* @alpha
*/
useMmap?: boolean | number;

/**
* An identifier which helps separate multiple presentation managers. It's
* mostly useful in tests where multiple presentation managers can co-exist
Expand Down Expand Up @@ -307,6 +317,7 @@ export class PresentationManager {
isChangeTrackingEnabled,
cacheConfig: createCacheConfig(this._props.cacheConfig),
contentCacheSize: this._props.contentCacheSize,
useMmap: this._props.useMmap,
});
this._nativePlatform = new nativePlatformImpl();
}
Expand Down
1 change: 1 addition & 0 deletions test-apps/presentation-test-app/src/backend/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { PresentationBackendLoggerCategory, PresentationBackendNativeLoggerCateg
taskAllocationsMap: {
[RequestPriority.Max]: 1,
},
useMmap: true,
});
// __PUBLISH_EXTRACT_END__

Expand Down

0 comments on commit 83e76fd

Please sign in to comment.