With calcination, sulfur vacancies rich CdS based composite photocatalyst has been synthesized successfully with coordination polymer as the precursor, which is constructed by Cd(II) metal ion and 2-mercaptobenzimidazole ligand. After calcination, Cd(II) ion and thiol group convert to CdS nanoparticle with the size about 5 to 8 nm, which disperses evenly in nitrogen doped carbon matrix (NC) formed by benzimidazole. During this process, some coordinated nitrogen atoms dope in the lattice of CdS and replace sulfur atoms, which leads to the generation of sulfur vacancies. In NC, the major component is graphitic carbon with a sp 2 hybridized pattern. Besides carbon, a small fraction of nitrogen element also exists, including pyridinic-N, pyrolic-N, and quaternary-N. Under visible light irradiation, the composite photocatalyst exhibits very excellent H 2 production ability as well as perfect stability during H 2 production, which does not decay after 30 h. For CdS based composite photocatalysts, temperature exhibits an obvious effect on photocatalytic property, and the main reason accounting for this is the type of nitrogen species in the NC matrix. Specifically, during photocatalysis, quaternary-N acts as the electron carrier, which promotes the separation of the electron−hole pair, and pyridinic-N can serve as H + acceptor as well as active sites for its reduction. Their contents possess great influence on H 2 production activity.