Carbonate reservoirs contribute the highest proportion of natural gas production around the world, and commingled production is frequently used to increase production for the multi-layer reservoirs. However, the complex pore structure including pore, fracture, and cavity, and the presence of edge/bottom water increase the difficulties in evaluating its commingled-production performances. In this work, three comingled patterns of digital rocks are reconstructed based on the computerized tomography scanning images, and the lattice Boltzmann method is used to investigate the commingled production with water invasion. The results show that the fracture and cavity commingled production pattern has the largest interlayer heterogeneity, and the production ratio between the two layers can reach 6.7. Commingled production for the system with different interlayer pressure may lead to backflow phenomenon, which is not only dependent on the initial pressure, but also related to the heterogeneity between the producing layers. Especially, if the interlayer heterogeneity is large and the initial pressure of the low-permeability layer is lower, the backflow volume would be very large. The water invasion during commingled production can influence the flow capacity of the other gas layers even there is no pressure interference. In addition, if the water layer has larger pressure, the produced water will continuously flow back to the gas layer until the pressure of the two layers becomes balanced. The coupled effects of pressure interference and water invasion significantly damage the commingled-production performance. This work can help for better understanding of the gas-water two-phase flow behaviors during commingled production, which provides fundamental support for the scientific development of multi-layer carbonated reservoirs.