Heat shock proteins (Hsps) are molecular chaperones that participate in plant growth and development, and in plant responses to environmental stresses, including heat stress, Hsps' expression is monitored and regulated by specific types of transcription factors known as heat shock factors (Hsfs). Although the roles of Hsfs and Hsps in stress response have been investigated in some plants, their roles are still poorly understood in cucumber (Cucumis sativus L.). To reveal the number of Hsfs and Hsps and their members coping with various stresses in cucumber, the comprehensive analyses of Hsf and Hsp gene families were conducted. A total of 23 Hsfs and 72 Hsps were identified in the cucumber genome (v3.0), and their gene structure and motif composition were found to be relatively conserved in each subfamily. At least 23 pairs of heat shock genes may have undergone duplication in cucumber. The cis-element analysis indicated that the promotors of CsHsfs and CsHsps possess at least one hormone or stress response cis-element, suggesting that CsHsf and CsHsp genes might respond to different stress conditions. RNA-seq showed that most CsHsf and CsHsp genes were sensitive to heat stress, but not all. Interestingly, CsHsf and CsHsp genes up-regulated by heat stress were also up-regulated by NaCl, indicating that cucumber shares common pathways in the responses to heat and salt stress. In addition, our results demonstrated that the fewer introns in the stress genes, the more sensitive they are, which leads to the stronger adaptability of plants to various developmental conditions and environmental stimuli. For instance, comparing with other Hsp families, the genes of CsHsp20 family are shorter in length and have fewer introns, and 39% of them are intronless, however, most of CsHsp20s were highly induced by heat stress. These results provide valuable information to further clarify the functional characterization of the CsHsf and CsHsp genes for plant breeding purposes.