Eventlet Removal Logo
Eventlet Removal

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:

%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#312e81', 'primaryTextColor': '#fff', 'primaryBorderColor': '#433e99', 'lineColor': '#ffffff', 'secondaryColor': '#312e81', 'tertiaryColor': '#312e81' }}}%% timeline title Eventlet Removal Timeline April 8, 2017: Adam Harwell initiated the removal by eliminating direct Eventlet dependencies. May 3, 2017: Michael Johnson introduced enhanced hacking checks. March 22, 2018: Doug Hellmann implemented a lower-constraints testing framework. January 10, 2019: Michael Johnson further enhanced hacking checks and test coverage. March 29, 2020: Andreas Jaeger upgraded coding standards to Python 3 compatibility. July 6, 2022: Gregory Thiemonge finalized dependency management adjustments and concluded Eventlet support.

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.