Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap Puma in favour of Falcon as the default web server #951

Open
ayushn21 opened this issue Dec 4, 2024 · 6 comments
Open

Swap Puma in favour of Falcon as the default web server #951

ayushn21 opened this issue Dec 4, 2024 · 6 comments
Assignees
Milestone

Comments

@ayushn21
Copy link
Member

ayushn21 commented Dec 4, 2024

Here's my pitch to swap our default web server. I know we're still only getting v2 out the door, but this is one I'd like to do for v3 ... so a longer term thing.

Why we should

  • Falcon is seriously high performance. Puma is bound by threads, we set a number when we boot Puma up and it's usually in the 10s. Falcon uses fibers .... we don't configure these ... for all practical purposes there isn't an upper limit (technically I believe there is, but we're talking 10s of thousands).
  • Falcon is HTTP/2 native.
  • Falcon is built with streaming in mind. Handling a websocket or SSE connection with Puma is not for the faint hearted. It ties up a thread.... the developer really needs to think about it properly. Action Cable does really funky socket hijacking to take the connection out of Puma. With Falcon, you don't need to worry about that any more ... the way it's built, these things "just work".
  • We can use Falcon for SSL termination ... there's no need to have Caddy/Nginx or something like that in front of it. This will seriously simplify deployments.
  • Falcon is pure Ruby. We should encourage other projects in the Ruby ecosystem, and this is a great chance to have the entire Bridgetown infrastructure run on Ruby without any other pieces like Caddy etc.

Potential pitfalls

  • Falcon is still very new and adoption is limited. But we can and should encourage more widespread use.
  • It's not as battle tested as incumbents so there could be security issues.
  • The community is still fairly small.

Integration issues

I honestly don't think there should be any. The live reload code is the only holdup at the moment and that's easy enough to sort out if we swap to puma. There's a couple of more pieces we need to sort out for Rack compliance, but it's not too relevant I don't think. It should be a straight swap for the most part.

Alongside Falcon, we can also introduce our opinionated deployment tool which I'm currently working on. I've been working with Caddy for SSL termination and a reverse proxy, but bringing all that under the same roof under Falcon would just simplify the setup so much. And it'd all be Ruby!

@ayushn21 ayushn21 self-assigned this Dec 4, 2024
@ayushn21
Copy link
Member Author

ayushn21 commented Dec 4, 2024

@ioquatix if there's anything you'd like to add here, please go ahead :) ... I'm convinced, just gotta get the rest of the core team on board!

@jaredcwhite
Copy link
Member

jaredcwhite commented Dec 4, 2024

I love this energy! I'll try to write up some coherent thoughts over the next few days, but it definitely sounds compelling. I wonder if we can research any other details specifically with regard to the Falcon+Roda combo…whatever defaults we go with in the future should prioritize production-grade routes being handled in hybrid or even 100% SSR projects, and also Sequel DB usage.

@ioquatix
Copy link

ioquatix commented Dec 4, 2024

I agree with everything discussed here so far.

In addition, as long as you are Rack compatible, the server you choose can be left as a decision to the user. Of course, Falcon provides some advantages, but they shouldn't prevent puma being used either IMHO.

@KonnorRogers
Copy link
Member

just here to also chime in Websocket + SSE support also make live_reload in dev even better. I would love to see Bridgetown lead the way on Falcon support. Its a fantastic web server.

@ayushn21
Copy link
Member Author

ayushn21 commented Dec 4, 2024

the server you choose can be left as a decision to the user

Yep that's absolutely where I want to be ... just wanna have a good setup out of the box for Falcon and then the user is free to swap in whatever they want ... we could even have a flag for bridgetown new to set up Puma instead of Falcon ....

@ioquatix
Copy link

ioquatix commented Dec 5, 2024

Using falcon by default definitely opens the door to more advanced capabilities including SSE, WebSockets, etc.

@jaredcwhite jaredcwhite added this to the 2.1 milestone Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants