Dynamic fluctuations in server power consumption significantly impact the thermal environment within the rack and the efficiency of computer room air conditioners (CRACs), necessitating thorough analysis it for safe and effective thermal management. Drawing on field experiment, this study presents an overview of the range and characteristics of variations in rack power consumption within a data center, revealing that 74.3 % of racks display periodic changes in power consumption. The change cycle has a diurnal pattern, and the dynamic changes in rack power consumption depend on the number of servers, the amount of task processing, and the nature of the customers. Subsequently, we designed the rack thermal environment experimental platform to analyze the response characteristics of the rack thermal environment to server power consumption changes and the variation rules of the thermal environment with various server layouts. The results show that a shift in server power severely affects the rack outlet temperature and is accompanied by a specific delay phenomenon. The near heat source effect, thermal buoyancy, and top heat accumulation primarily affect and form the rack thermal environment. It is recommended to place the server in the middle of the rack and with a 1U or 2U gap or uniform arrangement to create a better thermal environment. Finally, we propose three methods for optimizing the rack's thermal environment. Compared to the use of blind plates, the installation of air inlet deflectors, rear baffles, and top outlets can collectively reduce the hot spot temperature by up to 1.3 °C, 2.1 °C, and 0.4 °C, with the supply heat index (SHI) optimized at 0.184, 0.142, and 0.13. The return temperature index (RTI) was optimized at 88.99 %, 88.76 %, and 92.5 %, respectively.