Industrial robots are increasingly used in machining tasks because of their high flexibility and intelligence. However, the low structural stiffness of the robot seriously affects the positional accuracy and machining quality of robot operation equipment. Studying robot stiffness characteristics and optimization methods is an effective way to improve robot stiffness performance. Accordingly, aiming at the poor accuracy of stiffness modeling caused by approximating stiffness of each joint as constant, a variable stiffness identification method is proposed based on space gridding. Then, a task-oriented axial stiffness evaluation index is proposed to realize quantitative assessment of the stiffness performance in the machining direction. Besides, by analyzing the redundant kinematic characteristics of the robot machining system, a configuration optimization method is further come up with to maximize the index. For a large number of points or trajectory processing tasks, a configuration smoothing strategy is proposed to achieve fast acquisition of optimized configurations. Finally, experiments on a KR500 robot are conducted to verify the feasibility and validity of proposed stiffness identification and configuration optimization methods.