SLAM_show_resources
Overview
Reports Speediful's current resource governance settings: the memory and concurrency budget it allows itself while loading and querying data, and whether each setting comes from an explicit override or was sized automatically for this machine. The values are the ones every query, replicate and load run on this machine uses.
Speediful bounds five settings while it runs, so that a run cannot exhaust the machine's
memory or overwhelm SQL Server with concurrent bulk writes. The limits apply within one
run (one EXEC of a Speediful procedure). Runs that execute at the same time each get
their own budget, so the limits do not add up across them.
| Setting | What it controls |
|---|---|
| Max In-Flight Bytes | Total memory Speediful uses for data across all in-progress loads and downloads within one run |
| Max Concurrent SQL Writes | How many BULK INSERT operations can run at the same time within one run |
| Max Concurrent Downloads | How many Salesforce downloads (blobs, bulk job results) can run at the same time within one run |
| Max Write Unit Bytes | The memory reserved up front for each download before its real size is known, and the memory each Bulk v2 query page is sized to fit. SQL writes are charged their own estimated memory, not this value |
| SQL Server Co-located | Whether SQL Server runs on this same machine. Changes how Max In-Flight Bytes is sized |
Defaults
Max In-Flight Bytes is the only setting sized from this machine's RAM. Max Write Unit
Bytes is derived from it, Max Concurrent SQL Writes defaults to 3, and Max Concurrent
Downloads defaults to the number of concurrent writes plus 2. Any setting can be left at
its default or pinned to a specific value with
configure_resources (see Resource Governance).
SLAM_show_resources sizes each setting the same way a run does. It checks whether SQL
Server runs on this machine and, when it does, reads SQL Server's max server memory
setting. To read it, Speediful connects to the master database of the SQL Server
configured with configure_server (see SQL Server Connection). The procedure needs no Salesforce connection.
Parameters
None.
Usage Examples
EXEC dbo.SLAM_show_resources
Example output (Results pane, column output):
Resource governance settings for this run:
SqlServerColocated = 1 (detected)
MaxInFlightBytes = 3633.1MB (detected)
MaxConcurrentSqlWrites = 3 (detected)
MaxConcurrentDownloads = 5 (detected)
MaxWriteUnitBytes = 454.1MB (detected)
Total RAM = 31.9GB
SQL Server max server memory = 24GB
Assessment:
No issues were found.
Every query, replicate and load run prints the same settings lines in its output.
The last two lines show what Max In-Flight Bytes was sized from. They are not settings and
cannot be changed with configure_resources:
| Line | Values |
|---|---|
Total RAM | The machine's installed memory, in GB |
SQL Server max server memory | SQL Server's max server memory setting in GB or MB when it is set; uncapped when it is left at SQL Server's default; unknown (could not be read) when SQL Server runs on this machine but Speediful could not read the setting; not checked, with the reason, when it does not affect the budget (SQL Server runs on another machine, or Max In-Flight Bytes is set with configure_resources) |
Each line shows where that value came from:
| Source | Meaning |
|---|---|
configured | Set explicitly via configure_resources |
detected | Computed from this machine's RAM and, when SQL Server runs on this machine, SQL Server's max server memory, because no override is set |
clamped | Detected, but adjusted to stay within Speediful's supported range (256MB–8GB for Max In-Flight Bytes) |
Assessment
After the settings, the output ends with an Assessment: section. It tells you when your
settings work against each other, so that Speediful does not behave differently from what
you set. Each finding is one sentence that names the setting to change. The assessment is
informational: the procedure still completes successfully either way.
For example, with Max In-Flight Bytes at 8GB, Max Concurrent SQL Writes at 8, Max Concurrent Downloads at 10 and Max Write Unit Bytes at 1GB:
Assessment:
At most 8 downloads can start at once, because 10 downloads x 1GB is more than the 8GB budget; lower MaxConcurrentDownloads or MaxWriteUnitBytes, or raise MaxInFlightBytes.
Each download reserves Max Write Unit Bytes up front, so the budget cannot cover more downloads than it holds write units.
The assessment reports:
| Finding | What to change |
|---|---|
| Downloads x Max Write Unit Bytes is more than the budget, so fewer downloads can start than you allowed | MaxConcurrentDownloads, MaxWriteUnitBytes or MaxInFlightBytes |
| Writes plus downloads, each reserving Max Write Unit Bytes, is more than the budget, so downloads wait while writes hold memory | MaxConcurrentSqlWrites, MaxConcurrentDownloads, MaxWriteUnitBytes or MaxInFlightBytes |
| Max Write Unit Bytes is larger than the budget, so no write or download can start | MaxWriteUnitBytes or MaxInFlightBytes |
| Max In-Flight Bytes is at Speediful's minimum (256MB) or maximum (8GB) because the automatic size fell outside that range | MaxInFlightBytes, using configure_resources |
When none of these apply, the assessment says No issues were found.
When SQL Server runs on this machine, its max server memory is unlimited (SQL Server's default) and Max In-Flight Bytes is not pinned, the same warning a run prints comes just before the settings:
WARNING: SQL Server's max server memory is uncapped on a co-located install; sizing SLAM's own memory budget conservatively (10% of RAM, capped at 2GB) because SQL Server may claim the rest under pressure. Run configure_resources to set an explicit MaxInFlightBytes instead.
Max In-Flight Bytes is then 10% of RAM, up to 2GB. To give Speediful a larger budget, set
SQL Server's max server memory, or pin Max In-Flight Bytes with configure_resources.
When batches are larger than the budget
When one batch of an object's query results needs more memory than Max In-Flight Bytes, Speediful loads those batches one at a time, with nothing else in the run loading alongside them. A run with many such batches is slow even though nothing is wrong. The run prints one line per object the first time this happens, for example:
The batches of OrderItem are larger than Speediful's memory budget (about 3.8GB of memory against MaxInFlightBytes = 2GB), so they are loaded one at a time, with nothing else loading alongside them. To load more at once, raise MaxInFlightBytes with configure_resources, or set SQL Server's max server memory so that Speediful can size its budget from the memory SQL Server leaves free, or use a smaller @pkchunksize so that each batch is smaller.
The memory figure is the memory the batch needs while Speediful processes it, which is several times the batch's size in Salesforce's CSV format. The line names only what applies to the procedure that printed it:
| Procedure | Batches | What the line suggests |
|---|---|---|
SLAM_replicate | Bulk v1 batches | Raise Max In-Flight Bytes, or a smaller @pkchunksize |
SLAM_query_bulk (and SLAM_query with @api = 'bulk') | Bulk v1 batches | Raise Max In-Flight Bytes, or a smaller @pkchunksize |
SLAM_query_bulkv2 (and SLAM_query with @api = 'bulkv2') | Bulk v2 result chunks | Raise Max In-Flight Bytes. Bulk v2 has no batch size parameter |
SLAM_query_soap (and SLAM_query with @api = 'soap') | SOAP API pages | Raise Max In-Flight Bytes, or a smaller @batch_size |
In every case, when SQL Server runs on this machine with its max server memory uncapped (or
unreadable) and Max In-Flight Bytes is not set with configure_resources, the line also
suggests setting SQL Server's max server memory. Speediful then sizes its budget from the
memory SQL Server leaves free, instead of 10% of RAM up to 2GB.
A smaller @pkchunksize or @batch_size makes each batch smaller, so more batches can load
at once. Writing the same records to SQL Server in smaller batches takes about the same
time. Each batch is a separate Salesforce request, and Bulk v1 batches count toward
Salesforce's daily batch limit (see Choosing a chunk
size).
The line is informational: the run continues and its data is unchanged.
If a value looks wrong (too small on a large box, or too large on a constrained one),
run configure_resources to set it explicitly rather than relying on auto-sizing.
Auto-sizing is a starting point, not a guarantee it matches your workload.