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

Support for multiple web workers (websockets?) #315

Open
TSMMark opened this issue Apr 25, 2022 · 2 comments
Open

Support for multiple web workers (websockets?) #315

TSMMark opened this issue Apr 25, 2022 · 2 comments

Comments

@TSMMark
Copy link

TSMMark commented Apr 25, 2022

Hi, thanks for this gem!

I'm wondering if it's possible for this gem to work with a multi-worker / load balanced architecture such as unicorn. I know the docs here say to just change the number workers to 1 — but that is not always feasible.

To my understanding, the main reason multiple-worker architecture poses an issue is because the repl session is stored in web worker memory on the server, which is only an issue because each HTTP request can be load-balanced to any worker, and that worker may or may not be the worker that had the repl session in memory.

Couldn't that issue be solved with websockets? I feel like this is kind of an obvious solution so I'm assuming there are some gotchas that I haven't thought of. Or if you are aware of any similar web console gems that work with multi-worker or use websockets I would love to check them out, please let me know.

@gsamokovarov
Copy link
Collaborator

gsamokovarov commented Apr 26, 2022

You want to debug the process that raised the error and this is tricky in multi-process environment, because we cannot be sure the process processing the input of Web Console is the same as the one that produced the error. The same will be the case with Web Console unless the WS server runs inside the same process. The WS server can very well live in a separate process even in development and with WS, we'll have to depend on the app running Web Console to support that server. I don't think it's good to spend developer's time on setting up infrastructure just to run web-console, and requiring it will force people out of using Web Console, in my opinion.

Web Console is a development tool intended to be run on development servers. I don't think solving the "run the Ruby code on that specific Ruby process in any Rack compatible server" problem is a good return on investment. I don't see many issues about it. If you wanna spend time on Web Console – doing UX work will have greater impact.

The frontend code is heavily neglected, it runs on Action View templates, which is ineffective and the UX itself needs a bit of loving so it looks and feels good for the standards of the modern web.

@TSMMark
Copy link
Author

TSMMark commented Apr 26, 2022

I'm mostly interested in the console or <% console %> functionality more-so than the "console when an error is raised" bit. I use better_errors for that anyway.

The kind of thing I am interested in is a ruby repl that runs in browser that can run commands on the back end — regardless of any error context, and regardless of how many web workers there are. Does that make sense?

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

2 participants