A data transmission method, wherein the method comprises: obtaining, by a first device, a congestion status of a transmission port, wherein the transmission port is a communications port used by the first device when a second device transmits data to the first device, and the congestion status is used to indicate whether data congestion occurs on the transmission port; and sending indication information to the second device when a mode switching condition is met, wherein the indication information is used to instruct the second device to switch a transmission mode used when the second device transmits the data, so that the second device transmits the data to the first device in a switched transmission mode, and the mode switching condition is associated with the congestion status of the transmission port; wherein the mode switching condition is a first condition or a second condition, wherein the first condition comprises: the congestion status is used to indicate that data congestion occurs on the transmission port, and a transmission mode prestored in the first device is a first mode, wherein the first mode is used to instruct the second device to transmit the data to the first device in a push manner; and the second condition comprises: the congestion status is used to indicate that data congestion does not occur on the transmission port, and a transmission mode prestored in the first device is a second mode, wherein the second mode is used to instruct the second device to transmit the data to the first device in a pull manner; wherein if the mode switching condition is the first condition, the indication information is used to instruct the second device to switch the transmission mode from the first mode to the second mode, to transmit the data to the first device in the pull manner indicated in the second mode; or if the mode switching condition is the second condition, the indication information is used to instruct the second device to switch the transmission mode from the second mode to the first mode, to transmit the data to the first device in the push manner indicated in the first mode. obtaining, by a first device, a congestion status of a transmission port, wherein the transmission port is a communications port used by the first device when a second device transmits data to the first device, and the congestion status is used to indicate whether data congestion occurs on the transmission port; and sending indication information to the second device when a mode switching condition is met, wherein the indication information is used to instruct the second device to switch a transmission mode used when the second device transmits the data, so that the second device transmits the data to the first device in a switched transmission mode, and the mode switching condition is associated with the congestion status of the transmission port; wherein the mode switching condition is a first condition or a second condition, wherein the first condition comprises: the congestion status is used to indicate that data congestion occurs on the transmission port, and a transmission mode prestored in the first device is a first mode, wherein the first mode is used to instruct the second device to transmit the data to the first device in a push manner; and the second condition comprises: the congestion status is used to indicate that data congestion does not occur on the transmission port, and a transmission mode prestored in the first device is a second mode, wherein the second mode is used to instruct the second device to transmit the data to the first device in a pull manner; wherein if the mode switching condition is the first condition, the indication information is used to instruct the second device to switch the transmission mode from the first mode to the second mode, to transmit the data to the first device in the pull manner indicated in the second mode; or if the mode switching condition is the second condition, the indication information is used to instruct the second device to switch the transmission mode from the second mode to the first mode, to transmit the data to the first device in the push manner indicated in the first mode.