SonicLab18 lessons · Available
On this page
Foundations · 03 of 03

Databases and the Configuration-to-Forwarding Path

Separate intent, derived application state, and programming evidence—then trace two concrete examples.

Prerequisite: Architecture and ServicesConcept lesson · no running lab required
By the end, you should be able to:
  • Explain the different questions answered by the main databases.
  • Trace a VLAN configuration and a learned route without merging their origins.
  • Interpret a database entry as one piece of evidence.
Scope: a common single-ASIC SONiC model. Release, image, platform, feature, and transport choices can change details. Commands and outputs here are teaching examples; no live SONiC behavior has been verified.

One engine, several meanings

SONiC uses Redis logical databases and structured tables to exchange state. A table entry typically has a key and field/value pairs. Names such as CONFIG_DB describe a role, not a stage that every event must visit. Different services produce and consume different tables; one service can do both.

DatabaseWhat it representsExample relationship
CONFIG_DBRunning configuration intentManagement tools write configuration; managers and relevant orchestration components consume it.
APPL_DBApplication-level state for networking objectsfpmsyncd produces route state; neighbor synchronization produces neighbor state; orchestration consumes relevant tables.
ASIC_DBSAI-oriented object state and operation transport in the conventional Redis designSAI Redis and syncd exchange programming operations and related state.
STATE_DBOperational and dependency informationServices publish readiness or observed state; other services use relevant information to coordinate work.
COUNTERS_DBCollected statistics and supporting mappingsCounter collection populates data consumed by show commands and monitoring.

This is a useful subset, not a complete database inventory. Instance layout and namespaces can differ on multi-ASIC systems. Use database names with image-supported tooling instead of assuming a numeric Redis index or a single global instance.

Read further: SWSS database schema definitions · Neighbor synchronization implementation · SONiC architecture.

Example A: a VLAN configuration

Suppose an operator adds a VLAN and a member port using a supported configuration interface. The intended VLAN and membership appear in CONFIG_DB. In a common implementation, vlanmgrd consumes those tables, manages related Linux bridge/interface state, and publishes application state. Orchestration then handles the relevant forwarding objects.

The dependency matters: an intended member port must refer to an available port. Creating a key does not make that dependency disappear. Some features have orchestration components that consume CONFIG_DB directly, so do not turn the VLAN example into a rule that every configuration must be copied through APPL_DB.

Running configuration and saved startup configuration also differ. /etc/sonic/config_db.json is commonly the startup configuration file; supported save/load workflows control persistence. A running change should not be assumed to survive a reboot.

Read further: VLAN manager implementation · Configuration database & models.

Example B: a BGP-learned route

Two origins, shared orchestration boundary
Two origins, shared orchestration boundaryConfiguration tools write VLAN intent to CONFIG DB, consumed by VLAN manager and application VLAN tables. Separately bgpd and zebra feed fpmsyncd, producing application route state. Both examples reach relevant orchagent components, then SAI Redis and ASIC DB, syncd, vendor SAI and hardware. State DB supports dependencies and Counters DB supplies observation.Configuration interfaceVLAN / member intentCONFIG_DB → vlanmgrdExample configuration consumerAPPL_DB VLAN tablesDerived application statebgpd → zebraLearned / selected routefpmsyncdFPM integrationAPPL_DB route tableConventional Redis route pathSTATE_DBDependencies / readinessCOUNTERS_DBObservation / statisticsRelevant orchagent componentsResolve dependencies; issue SAI operationsSAI Redis / ASIC_DB → syncd → vendor SAI → ASIC
Original simplified examples. STATE_DB is not a mandatory serial hop. COUNTERS_DB is not a route-programming stage. Arrows omit responses, kernel paths, other consumers, and release-specific transport alternatives.

A dynamically learned route does not need a matching CONFIG_DB key for its prefix. BGP configuration may establish the session and policy, but the route itself originates in protocol state. On the illustrated route path, zebra exports forwarding updates through FPM; fpmsyncd publishes application route state. RouteOrch, part of orchagent, processes routes and their dependencies.

For the conventional SAI Redis path, orchagent calls the SAI API through the Redis client library. Serialized operations cross the ASIC_DB boundary; syncd processes them and calls vendor SAI. The ASIC_DB representation is not an independent readback of every hardware table. Success at one software boundary does not prove end-to-end delivery.

Read further: RouteSync implementation · Route orchestration implementation · SAI Redis & syncd · syncd implementation.

Read intent without changing it

sonic-db-cli CONFIG_DB HGETALL 'PORT|Ethernet0'

Read-only command example, not executed. Requires suitable permissions and the correct database namespace.

admin_status
up
mtu
9100

Illustrative shortened response only. Port name, fields, formatting, and values are not observations from a device.

This example says the configured administrative status is up. It says nothing by itself about carrier, a resolved neighbor, or a particular packet. For a conventional application route table, an investigation might also inspect sonic-db-cli APPL_DB HGETALL 'ROUTE_TABLE:203.0.113.0/24'; verify the actual VRF, key format, and transport for the chosen image first.

A disciplined trace: compare intent, protocol selection, application state, dependencies, programming responses/logs, and packet evidence. Updates are asynchronous; account for convergence. An entry can be present while work is pending or a downstream operation has failed. Avoid editing database keys as a troubleshooting shortcut.

Read further: Configuration database & models · fpmsyncd implementation.

Key takeaways

  • The main databases answer different questions; they are not one universal pipeline.
  • Configuration and learned routes have different origins and consumers.
  • Dependency resolution and asynchronous processing affect when state becomes usable.
  • ASIC_DB state alone does not prove successful hardware forwarding.
  • Use read-only evidence from the correct release, instance, VRF, and packet path.

Check your understanding

Six questions, four choices each. Check each answer for an explanation, then review your score and retry.

Official references

Reviewed 18 October 2026. Living upstream references describe several generations of SONiC; match operational details to the selected release. Implementation links support the examples, not a claim that every image runs current master.

Lesson 03 · Knowledge check