Add Plack::Handler::Netty implementation plan#661
Merged
Conversation
Proposes a PSGI server handler backed by Netty for PerlOnJava, enabling Dancer2, Catalyst, and Mojolicious applications to run with high-performance async I/O. ## Plan Overview - Target framework: Dancer2 (simplest to test, already installed) - Backend: Netty (battle-tested, async I/O, single-threaded compatible) - Interface: Standard PSGI/Plack (framework-agnostic) - Base: Existing examples/http_server/ prototype ## Why This Approach **Dancer2 first**: Pure Perl, minimal boilerplate, easiest validation **Netty**: Single-threaded event loop compatible with PerlOnJava (no threads/fork yet) **PSGI**: One handler automatically supports all frameworks ## Implementation Phases 1. Core PSGI handler (Week 1) - NettyPSGIServer.java (refactor from prototype) - Plack::Handler::Netty.pm - Basic array response support 2. Dancer2 integration (Week 2) - Test real Dancer2 app - Route parameters, JSON, templates 3. Streaming responses (Week 3) - PSGI callback/iterator support - Chunked encoding 4. Production features (Week 4) - Config options, error handling - Performance testing 5. PR and documentation (Week 5) ## Test Scaffolding Created dev/sandbox/http_server/ with: - test_netty_handler.pl - Minimal PSGI app - dancer_app.pl - Sample Dancer2 application - test_dancer.pl - Dancer2 integration runner - README.md - Test documentation ## Next Steps 1. Review this plan 2. Fix Dancer2 Type::Tiny scoping bug (prerequisite) 3. Implement NettyPSGIServer.java (Phase 1) 4. Implement Plack::Handler::Netty.pm ## References - dev/modules/dancer2_support.md - Dancer2 already installed - examples/http_server/ - Working Netty prototype - dev/modules/mojo_ioloop.md - Mojolicious support (55/108 tests) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Proposes implementing
Plack::Handler::Netty- a PSGI server handler that bridges Perl web frameworks (Dancer2, Catalyst, Mojolicious) to Java's Netty HTTP server. This enables any PSGI-compatible application to run on PerlOnJava with async I/O performance.Motivation
examples/http_server/already demonstrates Netty + PerlOnJava integrationApproach
Target Framework: Dancer2
Starting with Dancer2 because:
Architecture
Key mapping: Convert Netty
HttpRequest→ PSGI%envhash → call$app->(\%env)→ convert PSGI[status, headers, body]→ NettyHttpResponseWhy Netty?
Changes in This PR
This PR contains planning only - no implementation yet:
✅
dev/modules/plack_handler_netty.md- Complete implementation plan with:✅
dev/sandbox/http_server/- Test scaffolding:test_netty_handler.pl- Minimal PSGI app testdancer_app.pl- Sample Dancer2 applicationtest_dancer.pl- Dancer2 integration runnerREADME.md- Test documentationImplementation Phases (Post-Approval)
Prerequisites
dev/modules/dancer2_support.mdIssue 3)makeexamples/http_server/)Testing Plan
Questions for Review
Related Work
dev/modules/dancer2_support.md- Dancer2 installed, blocked by Type::Tiny scopingexamples/http_server/- Working Netty + Perl prototypedev/modules/mojo_ioloop.md- Mojolicious 55/108 tests passingSuccess Metrics
Next Steps After Approval
NettyPSGIServer.java(refactor from prototype)Plack::Handler::Netty.pmThis PR is request for feedback on the plan. Implementation will come in a follow-up PR after review.