This study addresses quality-of-service (QoS) and energy-consumption challenges in Ternary Optical Computer (TOC) by proposing a novel three-phase service model. The model integrates an M/G/1 queuing system with an \(N\) -policy and multiple vacation mechanisms into the TOC service framework for the first time. In this system, the server enters a vacation state when idle and resumes service immediately when the number of customers reaches a predetermined threshold \(N\) . We perform an in-depth analysis of the third phase using stochastic-decomposition methods to model precisely the steady-state queue length. For the first and second phases, we employ an approximate analysis to balance computational complexity and accuracy, yielding the system’s average queue length. By applying Little’s Law, we then derive an expression for the overall system’s sojourn time. Furthermore, we utilize the Renewal Reward Theorem to construct a cost function representing TOC energy consumption, and perform numerical experiments to identify the optimal threshold \(N\) . Our results demonstrate that the proposed model significantly reduces energy consumption while maintaining satisfactory system performance, offering new theoretical insights and practical guidelines for dual-objective optimization in TOC.