The paper presents a machine learning model for online traffic classification in software-defined networking (SDN) using the Spark framework, addressing the inadequacies of traditional classification techniques. It involves a two-phase process: learning and deployment, where a ML pipeline is established in the learning phase and evaluated three models—decision tree, random forest, and logistic regression—against a dataset of 3,577,296 flows. Ultimately, the decision tree model is selected for deployment due to its superior accuracy of 0.98, outperforming existing methodologies.