Giter Site home page Giter Site logo

Comments (2)

jaredcwhite avatar jaredcwhite commented on September 20, 2024

I'm very excited about this @ayushn21! I remember feeling disappointed that I had to jump through a lot of hoops to get live reload via SSE to work sorta OK without tying up threads and making regular responses hang. With this new Rack 3 streaming approach, does that mean SSE could work on routes generally without sucking up all the Puma threads?

from bridgetown.

ayushn21 avatar ayushn21 commented on September 20, 2024

With this new Rack 3 streaming approach, does that mean SSE could work on routes generally without sucking up all the Puma threads?

Yes, that's the general idea. The same approach was possible with Rack 2 as well, just felt a bit hacky. Rack 3 has formally adopted the paradigm of bi-directional communication making something like this a lot easier. I really need to blog about this.

We'll still need to create a Thread of our own to free up the Puma thread, but I've got a few prototypes working so hopefully shouldn't be a massive problem.

In terms of doing this in production, that's probably still a bad idea with Puma. Since we're creating our own thread to free up the Puma thread, we're also responsible for managing it. In dev, that's not an issue since it's just one thread for live reload. In production, where there are multiple connections, it could all get unwieldy very quickly without proper thread management which is difficult at the best of times.

This is where Falcon shines actually because it uses Fibers and is incredible at switching between them. In that case we wouldn't have to worry about creating our own thread or anything, we can just let Falcon take care of everything.

from bridgetown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.