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

Investigate Node vs C# server resource usage, web socket limitations #10

Closed
tjcouch-sil opened this issue Jan 18, 2023 · 3 comments
Closed
Assignees
Milestone

Comments

@tjcouch-sil
Copy link
Member

tjcouch-sil commented Jan 18, 2023

As an architect, I want to know how well Node would suit us as a web server technology as opposed to C# to determine if we should use a C# web server or Node web server (assuming we do not go with Electron-Edge as referenced in #9).

  • Are we limiting ourselves using Node websocket as opposed to a C# websocket?
  • How do startup and resource use look between C# and Node?
@tjcouch-sil tjcouch-sil self-assigned this Jan 20, 2023
@tjcouch-sil
Copy link
Member Author

tjcouch-sil commented Jan 20, 2023

Node vs C# websockets

It seems from some testing that different socket connections run on different threads in C# without any particular configuration. They seem to swap to different threads sometimes. I'm not clear on what the implications are of this discovery, but I don't believe Node websockets are multithreaded. There must be some locking and unlocking when reading/writing the messages in C# or something. I suppose you could write something to implement such functionality in Node.

EDIT: async/await creates new tasks and may schedule on different threads. So doing things with websocket messages is pretty much inherently multithreaded in C#. This feels much more natural than having to do things to make this happen in Node, but it can still be done.

Resource usage

In Windows 10:

Express:
Start server then navigate to website url: ~1.5-2 seconds
Uses ~45-50 MB memory

ASP.NET:
Start server then navigate to website url: ~.5 seconds
Uses ~28-31 MB memory

@irahopkinson
Copy link
Contributor

@tjcouch-sil I asssume the above results are on Win 10? Do we see similar results on Linux and MacOS? Using WSL2 or dual boot to Linux would be a fair comparison since its the same machine but I'm not sure how you make the comaprison on MacOS. We need to be continually thinking x-platform, perhaps we should determine a way to make a fair comparison.

@tjcouch-sil
Copy link
Member Author

@irahopkinson Yes, that was in Windows 10. Good clarification. I don't have the experience with WSL2 to do much with Linux right now. Maybe we can investigate those further another time. Looks like the electron-edge-js test was successful enough that the startup time will not be that significant a difference (server startup time would affect websocket communication with external executables like FLEx, but internal apis do not need to wait on the server if we use edge as everything is passing through electron ipc and edge).

@darren8c darren8c added this to the Sprint 1 milestone Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

No branches or pull requests

3 participants