Beta250 File GDB discovery performance

With ThinkGeo.FileGeoDatabase 15.0.0-beta250, discovery of a GDB on a network drive
still takes 19.073 seconds. It processes 92 catalog entries, accepts 91 with
compatible geometry, and reports no failed classes or unhandled exception in this
run. Module ID: 29fb43a9-8e13-49a4-bd69-ef3cad0b98de.

The same GDB was also tested from local storage and reportedly loaded in about
1 second, versus 19.073 seconds from the network drive: approximately 19x faster.
This strongly points to storage access as the main contributor. The local result
is an approximate reported total; a local phase log and cache/repeat controls have
not been supplied.

Our discovery sequence is:

  1. Call FileGeoDatabaseFeatureLayer.GetTableNames(path) once.
  2. For each name, create FileGeoDatabaseFeatureLayer(path, name, string.Empty),
    Open it and call QueryTools.GetFirstFeaturesWellKnownType() to filter the list.
  3. Retain the first successfully opened source across the entire loop and subsequent
    dialog operations. Close each other source after its probe.

This discovery operation does not request a preview or full feature/attribute scan.

Timed phase Milliseconds
Catalog listing 7,238.1
All class opens 6,226.1
First-geometry probes 5,582.1
Close/dispose 12.8
Total request 19,073.3

The first successful owner’s Open took 43.1 ms, included in the Open total. No
class’s combined Open/probe/cleanup time reached our 500 ms logging threshold;
inspection averages 128.5 ms per entry. Worker queueing and return to the UI account
for only 2.1 ms. Timers include possible SDK lock waits. The same-GDB local test
strengthens the storage diagnosis, but we have not isolated the particular source
of delay within the network-storage path or measured native-call round trips.

Could you profile this discovery pattern on a GDB with roughly 100 classes in
feature datasets over network storage, and advise on a supported faster path?
Inspection of this build identifies these candidates:

  • Catalog enumeration issues two GetChildDatasets calls per feature dataset plus
    three at the root. Can catalog discovery reduce those native calls?
  • Each new source’s Open refreshes column metadata, although class discovery only
    needs to determine whether it has compatible geometry. Could a discovery API
    avoid fetching the full column schema for every entry?
  • The first-geometry probe uses Search("*", "", RowInstance.Recycle) and constructs
    a ThinkGeo geometry to get its type; the polygon conversion can also repair
    geometry. Could it request only the geometry field and
    determine the type without constructing the entire geometry where safe?

A bulk discovery API would also be useful if it can supply the required information
more efficiently. We need to preserve the existing filter: exclude empty,
non-spatial and unsupported/invalid first-row geometries; source replacement also
checks the geometry family. Declared schema type alone may change that behavior.
Please preserve the shared ownership, native-call serialization and finalizer
protections. We have not added an SDK bypass or changed the filtering behavior.

Thank you!

Hi Julian,

We reproduced your profile with a geodatabase of 92 entries in ten feature datasets (91 classes with rows, one table) opened through a loopback SMB share, counting the SMB requests per phase. It’s fixed in beta254.

The catalog listing walked Esri’s API: GetChildDatasets on the root and on each feature dataset, 2N+3 calls for N feature datasets, 23 on that geodatabase. Each call is about a thousand file operations inside the Esri library, and a share answers them one round trip at a time: one listing took 4.3 s and 24,830 SMB requests over the share, against 0.2 s from the local disk. GetTableNames also releases the geodatabase when it returns, so the first Open after it walks the catalog again unless another source already holds the geodatabase; your 43 ms first Open suggests one of yours did, which is the right way to run it.

Fixed in ThinkGeo.FileGeoDatabase 15.0.0-beta254: the catalog is read with one query on the GDB_Items system table, keeping feature classes and tables in the order the walk gave (each feature dataset’s classes, then its tables, then the root’s). GetTableNames and the name check in Open both use it, and the walk remains as the fallback for a catalog the query cannot read. Measured on the beta254 packages over the same share: the listing went from 4.3 s and 24,830 SMB requests to about 0.25 s and 920, and your whole loop from 13.0 s to 2.6-2.8 s; from the local disk it went from 0.60 s to 0.31 s. Shared ownership, the one lock and the finalizer protections are unchanged, and the three cases from the earlier thread still run clean on this build.

On your other candidates, measured over the same share against the Esri API directly:

  • The column refresh in Open costs at most 1.4 ms and no SMB requests, because Esri’s OpenTable already holds the field list. The time in Open is OpenTable itself, 17 to 20 ms per class over loopback, and the Esri API has no cheaper way to open a table. Your 68 ms per class is the same call over a slower link.
  • The first-row probe costs 4 to 9 ms per class whatever the subfields: Search(“*”), the shape field alone and OBJECTID alone all take the same time, so the cost is setting up the Search, not reading fields. Building the ThinkGeo geometry from the first shape is CPU only and under a millisecond, polygon ring check included. Requesting only the geometry would gain nothing measurable, so the probe is unchanged.
  • GetCount reads Esri’s in-memory row count after Open, so excluding empty classes costs nothing extra, but it does not remove the probe for the others.

What remains is one OpenTable and one Search per class, about 180 SMB requests each, roughly 12 s of your 19 s. That shrinks only by opening fewer classes or by caching the discovery result on your side.

For opening fewer, beta254 also adds FileGeoDatabaseFeatureLayer.GetTableInfos(path), also on FileGeoDatabaseFeatureSource. It returns the names of GetTableNames in the same order, each with the GeometryType the catalog declares: Point, Multipoint, Line for a polyline class, Polygon for a polygon class, and Invalid for a table without a shape field or a multipatch class. It uses the same catalog query and opens nothing: 92 entries in 0.2 s over the share. The declared type is a family: a polyline class reads as Line or Multiline, a polygon class as Polygon or Multipolygon. On every geodatabase we have, it matched the first-row type of every class whose first shape converts; one annotation class declares Polygon and still probes Invalid. So it does not replace your probe: use it to drop Invalid entries and unsupported families before any Open, and keep the probe for the rest. On a geodatabase like yours, where 91 of 92 entries pass, that saves little; it helps where many entries are tables or unsupported.

Thanks,
Ben