Case Study: Removal of Eventlet from OpenStack Octavia
The OpenStack Octavia project embarked on a systematic removal of the Eventlet library to address technical debt, improve performance, and ensure compatibility with Python 3 by adopting more suitable libraries such as Cotyledon. This case study outlines the timeline, key contributors, and critical steps undertaken during the removal process.
Motivation for Removing Eventlet π
Complex Debugging
Difficulties arising from monkey-patching made debugging complex and error-prone.
Python Version Compatibility
Eventlet posed compatibility challenges, particularly with the evolution toward Python 3.
Maintenance Overhead
The slow evolution and reduced community support for Eventlet created long-term sustainability concerns.
Timeline and Contributors π
The following timeline illustrates the key milestones and contributions during the migration process:
This timeline highlights the incremental steps taken by contributors to remove Eventlet, ensuring a smooth and systematic migration process.
Additional Details
For more information about the migration process, you can explore the relevant Git history using the following command:
git log --since="2016-01-01" --until="2025-03-10" -S "eventlet" -p
This command filters commits between January 1, 2016, and March 10, 2025, that reference "eventlet" and displays the associated changes.
Steps Undertaken π
1. Initial Dependency Removal
Identified and removed direct dependencies on Eventlet and related Oslo libraries.
Before:
import eventlet
eventlet.monkey_patch()
After:
# Removed all references to eventlet
2. Adoption of Cotyledon
Transitioned to Cotyledon for improved asynchronous performance and maintainability.
Eventlet:
from oslo_service import service
launcher = service.launch(CONF, server)
Cotyledon:
import cotyledon
manager = cotyledon.ServiceManager()
manager.run()
3. Significant Refactoring
Removed Eventlet-specific constructs and ensured compatibility with alternative frameworks.
Eventlet:
eventlet.sleep(1)
Standard Library:
import time
time.sleep(1)
4. Code Quality and Testing Enhancements
Introduced robust hacking checks and improved test coverage.
Example Hacking Check:
def check_no_eventlet_imports(logical_line):
if 'eventlet' in logical_line:
yield logical_line.index('eventlet'),
"O345: Usage of eventlet is prohibited."
Outcomes and Benefits π
- Simplified and Maintainable Codebase: Extensive refactoring and adoption of Cotyledon streamlined the codebase.
- Performance and Stability Improvements: Transitioning to Cotyledon improved performance and service management.
- Enhanced Compatibility: Established ongoing compatibility with modern Python environments.
- Security Enhancement: Proactive dependency management mitigated potential vulnerabilities.
Lessons Learned π
Structured Approach is Key
Incremental removal combined with robust testing strategies is essential to safely refactor complex systems.
Community Alignment
Regular alignment with community standards and leveraging collective knowledge significantly reduced refactoring risks.
Clear Goals and Early Wins
Clearly defined goals and achieving early incremental successes motivated continued progress and stakeholder buy-in.
Recommendations for Other Projects π
Evaluate Dependency Risks Early
Regularly re-evaluate library dependencies to avoid accruing significant technical debt.
Adopt Robust Testing Practices
Enhance automated testing and static checks early in the refactoring cycle to ensure stability.
Choose Sustainable Alternatives
Select technologies like Cotyledon for long-term maintainability and compatibility with modern standards.
Conclusion π
The successful removal of Eventlet from OpenStack Octavia highlights the value of systematic refactoring, proactive dependency management, and careful technology selection. Octavia's transition to Cotyledon illustrates effective software engineering practices that benefit maintainability, performance, and future adaptability.
Call to Action π
Considering removing Eventlet from your project?
- Review Octaviaβs repository for detailed commits and best practices.
- Engage with the community and share experiences in the dedicated OFTC IRC channel #openstack-eventlet-removal.
- Share removal.eventlet.org with your colleagues to give them additional guidance, tools, and support from the broader community.