节点文献
基于微服务的代码在线评测系统设计与实现
Design and Implementation of Code Online Judge System Based on Microservice
【作者】 张旭;
【导师】 向文;
【作者基本信息】 华中科技大学 , 计算机技术(专业学位), 2022, 硕士
【摘要】 受新冠肺炎疫情的影响,越来越多的学校和教育机构为响应“停课不停学”政策通过网络平台实现线上教学。然而,在计算机编程语言课程的教学当中,学生仅通过视频教学而缺乏实践导致学习效果不佳。对此,进行深入地研究,设计和实现了一个基于微服务的代码在线评测系统,提供在线编写代码和自动评测功能,支持C语言,C++语言和Java语言,实时反馈评测结果,方便教学管理,辅助编程语言类课程的教学。针对教师手工批阅编程作业工作量大,效率低下等问题对系统的功能需求、性能需求和安全需求三个方面进行分析。系统使用前后端分离的开发模式,前端由Vue.js实现,后端基于微服务架构的方法划分为用户管理服务、课程管理服务、题库管理服务、代码管理服务、代码评测服务、中央认证服务和搜索服务,通过UML用例图和E-R图等方式对各个服务模块和数据库进行设计,使用Spring Cloud框架实现服务之间的通信和服务治理。在代码评测服务中结合了静态和动态两种评测方式,静态评测基于代码相似度检测技术使用SIM算法工具比较用户提交代码和参考代码的相似度,据此给出评测结果;动态评测对用户代码进行编译和运行,根据输出结果与测试用例的比对情况给出评测结果,评测过程中通过使用Linux系统函数实现沙箱环境和Docker容器技术确保代码安全性。最后对系统的功能、性能和评测安全进行测试,测试结果表明系统各个功能模块运行正常,性能指标符合需求,具有良好的鲁棒性。经测试和试运行,系统稳定可靠,达到了预期的要求。
【Abstract】 Affected by the epidemic of new coronary pneumonia,more and more schools and educational institutions implement e-learning through network platform in response to the policy of "classes suspended but learning continues".However,in the course of computer programming language teaching,students only through video teaching and lack of practice results in poor learning.Therefore,this paper has carried on the thorough research,an online code judge system based on microservices is designed and implemented,which provides online coding and automatic judge function,and real-time feedback of judge results,so as to facilitate teaching management,teaching of auxiliary programming language courses.Aiming at the problems of heavy workload and low efficiency,this paper analyzes the function requirement,performance requirement and security requirement of the system.The system uses separation of front-end and back-end development mode,the front-end is implemented by Vue.js,the back-end based on microservice architecture is divided into user management service,course management service,problem bank management service,code management service,code judge service,central authentication service and search service,every service module and database are designed by using UML case diagram and E-R diagram,and uses the Spring Cloud framework to implement communication between services and service governance.In code judge service,the system combines static and dynamic judge methods,static judge is based on code similarity detection technology,which uses the SIM algorithm tool to compare the similarity between user submitted code and reference code,and then gives the judge results;the dynamic judge compiles and runs the user code,and gives the judge result according to the comparison between the output result and the test cases,in the judge process,system uses Linux system functions to implement a sandbox environment and the Docker container technology to ensure code security.Finally,this paper test the function,performance and judge security of the system,the test results show that each function module of the system operate normally,the performance indexes meet the requirements,and has good robustness.After testing and trial operation,the system is stable and reliable,and achieves the expected requirements.
【Key words】 e-learning; microservice; online judge; code similarity; Docker container;
- 【网络出版投稿人】 华中科技大学 【网络出版年期】2024年 10期
- 【分类号】TP311.52