Synchrotron radiation induced carbon contaminations on optical elements is widely considered to be a major concern for a beamline. The purpose of this paper is to study on glow discharge cleaning (GDC) of the mirror box, striving to prevent carbon contamination formation fundamentally by obtaining a cleaner vacuum chamber. In order to theoretically understand GDC, a 2D fluid model of Ar/O2 discharge was established, and the discharge physical parameters were obtained under different conditions (Ar/O2 mixing ratio, electrode arrangement). GDC system was designed and built on the basis of simulation to verify the GDC results. Moreover, we analyzed the influence of GDC on the surface of the optical components. It is found that the average density of metastable particles increases with the increase of oxygen-to-argon ratio. The arrangement of a single electrode is more reasonable for GDC compared with dual electrodes. From the results of quadrupole mass spectrum analysis, we identify that the amount of oil molecules could be reduced by 84% after being cleaned by glow discharge, indicating that GDC has a remarkable effect on removing oil molecules on the surface of the mirror box. However, we found that GDC has some damage to the optical element surface.