| 研究生: |
李家蓁 Lee, Chia-Chen |
|---|---|
| 論文名稱: |
探討電子商務網站採用 Event Sourcing 做為資料架構對系統效能的影響 Investigating the Effects of adopting Event Sourcing as a Data Architecture on System Performance within E-Commerce Platforms |
| 指導教授: |
廖峻鋒
Liao, Chun-Feng |
| 口試委員: |
馬尚彬
Ma, Shang-Bin 孫士勝 Sun, Shih-Sheng |
| 學位類別: |
碩士
Master |
| 系所名稱: |
資訊學院 - 資訊科學系 Department of Computer Science |
| 論文出版年: | 2024 |
| 畢業學年度: | 112 |
| 語文別: | 中文 |
| 論文頁數: | 60 |
| 中文關鍵詞: | 事件溯源 、增刪查改 、物件關聯對映 、命令查詢職責分離模式 |
| 外文關鍵詞: | Event Sourcing, CRUD, ORM, CQRS |
| 相關次數: | 點閱:45 下載:0 |
| 分享至: |
| 查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報 |
隨著資料量日益增長、業務邏輯的複雜化以及微服務架構的興起,傳統的 CRUD 亦即創建 (Create)、讀取 (Read)、更新 (Update) 和刪除 (Delete)等資料庫 操作和 ORM 模式在規模性、資料一致性以及歷史追蹤上面臨挑戰。因此,Event Sourcing (ES)被提出作為一種可能的解決方案,ES 不是只儲存最終狀態, 而是記錄導致該結果的所有變更,除了提供系統狀態變更的完整歷程追蹤和審 計,也提升了系統在面對大規模資料操作時的擴展性,還確保了在分散式系統 中的資料一致性。雖然理論上 ES 的追溯性和審計性得到了認可,但在實作層 面上,對於採用 ES 的系統架構對效能影響的研究仍然有限。本研究探討了 ES 架構在現代軟體系統中的應用,特別是對於系統效能、規模性的影響。為此, 本研究以 JPetStore 電子商務網站作為研究案例,評估了不同的架構設計,包括 傳統上使用 CRUD 的架構和整合 ES 的變體。透過這些實作,本研究旨在提供 實證基礎以輔助系統設計和技術選擇考量的討論。此外,本研究也關心 ES 實 作過程中的挑戰,ES 的實作需要開發者對業務流程有深入理解,並且能夠處理 事件引起的各種狀態變更。本論文透過深入分析和比較不同架構,揭示採用 ES 對軟體系統效能的具體影響,並分享從傳統 CRUD 重構為 ES 架構的實作心得。
With the increasing volume of data, the complexity of business logic, and the rise of microservices architecture, the traditional CRUD model—Create, Read, Update, Delete—and ORM patterns face challenges in scalability and data consistency. Consequently, Event Sourcing (ES) has been proposed as a potential solution. Unlike traditional methods that only store the final state, ES records all changes leading to that result. This not only provides a complete history and audit trail of system state changes but also enhances system scalability in handling large-scale data operations and ensures data consistency in distributed systems. Although the traceability and auditability of ES are theoretically acknowledged, there is still limited research on the performance impact of systems adopting ES at the implementation level. This study explores the application of the ES architecture in modern software systems, particularly its impact on system performance and scalability. To this end, the research uses the JPetStore e-commerce website as a case study, implementing different architectural designs, including the traditional CRUD-based architecture and its variants integrating ES. Through these implementations, this study aims to provide empirical evidence to support discussions on system design and technical considerations. Additionally, the study addresses challenges in implementing ES, such as technical complexity and event design. Implementing ES requires developers to have a deep understanding of business processes and to manage various state changes triggered by events. This thesis, through in-depth analysis and comparison of different architectures, reveals the specific impacts of adopting ES on software system performance and shares insights from the process of refactoring from traditional CRUD to ES architecture.
謝辭 I
摘要 II
ABSTRACTIII
目錄 IV
圖目錄 VI
表目錄 VIII
第1章 緒論 1
1.1 研究背景 1
1.2 研究動機 3
1.3 研究目標 4
第2章 技術背景與相關研究 7
2.1 技術背景 7
2.1.1 RDBMS 7
2.1.2 CRUD 操作 7
2.1.3 物件關聯對映 (Object-Relational Mapping,ORM) 8
2.1.4 事件溯源 (Event Sourcing) 8
2.1.5 命令查詢職責分離模式(Command Query Responsibility Segregation) 11
2.2 相關研究 12
第 3 章 系統設計 15
3.1 JPETSTORE 原始架構介紹 15
3.1.1 領域模型 16
3.1.2 使用者下單流程 18
3.2 EVENT SOURCING 架構設計 19
3.2.1 事件溯源下聚合狀態的更改機制 20
3.2.2 事件儲存 21
3.2.3 事件設計 27
3.3 結合 CQRS 30
第4章 系統實作 32
4.1 原始架構 32
4.2 EVENT SOURCING 實作 32
4.3 結合 CQRS 的 EVENT SOURCING 實作 36
4.4 實作心得 40
第5章 系統評估 42
5.1 實驗設計 42
5.2 實驗結果 46
5.2.1. 飽和度及平均響應時間 46
5.2.2. 相同工作量的完成時間以及資料儲存的正性 50
第 6 章 結論與未來研究 56
6.1 結論 56
6.2 參考獻59
[1] J. Martin, Managing the data-base environment. Prentice-Hall, 1983.
[2] M. Fowler, "Event sourcing," 2005. [Online]. Available: http://martinfowler.com/eaaDev/EventSourcing.html. [Accessed: Jul. 5, 2024].
[3] G. Young, "CQRS Documents," November 2010. [Online]. Available: https://cqrs.wordpress.com/wp-content/uploads/2010/11/cqrs_documents.pdf. [Accessed: 22-July-2024].
[4] MyBatis Team, "Jpetstore demo 6," [Online]. Available: http://mybatis.org/jpetstore-6/. [Accessed: Jul. 5, 2023].
[5] A. Detti, L. Funari, and L. Petrucci, "μbench: An open-source factory of benchmark microservice applications," IEEE Trans. Parallel Distrib. Syst., vol. 34, no. 3, pp. 968-980, Mar. 2023.
[6] A. Shatnawi et al., "Analyzing program dependencies in Java EE applications," in 2017 IEEE/ACM 14th Int. Conf. Mining Software Repositories (MSR), 2017, pp. 64-74.
[7] Oracle Corporation, "Java pet store," [Online]. Available: https://www.oracle.com/java/technologies/petstore-v1312.html. [Accessed: Nov. 12, 2023].
[8] Z. Long, "Improvement and implementation of a high performance CQRS architecture," in 2017 Int. Conf. Robots & Intelligent System (ICRIS), 2017, pp. 170-173.
[9] C. Richardson, Microservices patterns: With examples in Java. Manning Publications, 2018.
[10] E. Evans, Domain-driven design. Addison-Wesley, 2004.
[11] V. Vernon, Implementing domain-driven design. Addison-Wesley, 2013.
[12] U. Dahan, "Clarified CQRS," 2009. [Online]. Available: https://udidahan.com/2009/12/0/.
[13] M. Fowler, "CQRS," 2011. [Online]. Available: https://www.martinfowler.com/bliki/CQRS.html.
[14] M. Pantelelis and C. Kalloniatis, "Object relational mapping vs. event-sourcing: Systematic review," in Electronic Government and the Information Systems Perspective, Springer Int. Publishing, 2022, pp. 18-31.
[15] M. Overeem, M. Spoor, and S. Jansen, "The dark side of event sourcing: Managing data conversion," in SANER 2017 - 24th IEEE Int. Conf. Software Analysis, Evolution, and Reengineering, 2017, pp. 193-204.
[16] A. Homer et al., Cloud design patterns: Prescriptive architecture guidance for cloud applications. Microsoft patterns & practices, 2014.
[17] M. Pantelelis and C. Kalloniatis, "Mapping CRUD to events towards an object to event-sourcing framework," in 26th Pan-Hellenic Conf. Informatics (PCI 2022), 2022, pp. 5.
[18] F. Alongi et al., "Event-sourced, observable software architectures: An experience report," Software: Pract. Exper., 2022.
[19] S. Han and J.-i. Choi, "V2X-based event acquisition and reproduction architecture with event-sourcing," in Proc. 2020 6th Int. Conf. Computing and Data Engineering, 2020, pp. 164-167.
[20] J. Rybicki, "Application of event sourcing in research data management," in Proc. 2018 4th Int. Conf. Big Data, Small Data, Linked Data and Open Data, 2018, pp. 22-26.
[21] Y. Zhong, W. Li, and J. Wang, "Using event sourcing and CQRS to build a high- performance point trading system," ACM Int. Conf. Proceeding Ser., 2019, pp. 16-19.
[22] K. Munonye and P. Martinek, "Evaluation of data storage patterns in microservices architecture," in SOSE 2020 - IEEE 15th Int. Conf. System of Systems Engineering, 2020, pp. 373-380.
[23] N. van der Hoeven, "Comparing k6 and jmeter for load testing," [Online]. Available: https://k6.io/blog/k6-vs-jmeter/. [Accessed: Jul. 5, 2023].
[24] B. Gregg, "The USE method," [Online]. Available: https://www.brendangregg.com/usemethod.html. [Accessed: Jul. 5, 2024].
[25] A. Debski et al., "A Scalable, Reactive Architecture for Cloud Applications," IEEE Softw., vol. 35, no. 2, pp. 62-71, Mar. 2018.
全文公開日期 2029/07/25