A method comprising: receiving, by a primary network device of a high-availability cluster, a packet of a network session, the packet comprising application-layer data; detecting, by the primary network device, a beginning of a new transaction from the application-layer data of the packet; calculating, by the primary network device, a sequence number corresponding to a first packet of a next transaction of the network session, wherein the next transaction follows the new transaction; forwarding, by the primary network device, a state update message that includes the calculated sequence number to a backup network device for the primary network device of the high-availability cluster; receiving, by the backup network device of the high-availability cluster, the state update message from the primary network device of the high-availability cluster, wherein the state update message indicates the network session being inspected by the primary network device and an identified application-layer protocol for the network session; in response to determining, by the backup network device, that the primary network device has switched over or failed over to the backup network device, receiving, by the backup network device, a packet of the network session, the packet comprising application-layer data; detecting, by the backup network device, a beginning of a new transaction from the application-layer data of the packet; and processing, by the backup network device, the application-layer data of the network session that include and follow the beginning of the new transaction without performing stateful processing of application-layer data that precede the beginning of the new transaction. receiving, by a primary network device of a high-availability cluster, a packet of a network session, the packet comprising application-layer data; detecting, by the primary network device, a beginning of a new transaction from the application-layer data of the packet; calculating, by the primary network device, a sequence number corresponding to a first packet of a next transaction of the network session, wherein the next transaction follows the new transaction; forwarding, by the primary network device, a state update message that includes the calculated sequence number to a backup network device for the primary network device of the high-availability cluster; receiving, by the backup network device of the high-availability cluster, the state update message from the primary network device of the high-availability cluster, wherein the state update message indicates the network session being inspected by the primary network device and an identified application-layer protocol for the network session; in response to determining, by the backup network device, that the primary network device has switched over or failed over to the backup network device, receiving, by the backup network device, a packet of the network session, the packet comprising application-layer data; detecting, by the backup network device, a beginning of a new transaction from the application-layer data of the packet; and processing, by the backup network device, the application-layer data of the network session that include and follow the beginning of the new transaction without performing stateful processing of application-layer data that precede the beginning of the new transaction.